2012-03-29 16:42:09 -04:00
< ? php
2012-10-18 11:32:36 -04:00
2018-02-01 13:06:32 +00:00
use ProcessMaker\Util\Common ;
2017-08-14 16:13:46 -04:00
use ProcessMaker\Core\System ;
2017-08-23 15:39:12 -04:00
2018-02-01 13:06:32 +00:00
use Illuminate\Database\QueryException ;
use Illuminate\Support\Facades\DB ;
2017-08-14 16:51:17 -04:00
global $translation ;
2017-08-14 16:13:46 -04:00
2017-08-14 16:51:17 -04:00
include PATH_LANGUAGECONT . " translation. " . SYS_LANG ;
2012-03-29 16:42:09 -04:00
2017-08-23 15:39:12 -04:00
class InstallerModule extends Controller
2012-04-12 17:50:43 -04:00
{
2020-04-09 17:45:04 -04:00
const MYSQL_VERSION_MAXIMUM_SUPPORTED = " 5.7 " ;
2025-03-27 12:06:06 +00:00
const PHP_VERSION_MINIMUM_SUPPORTED = " 8.1 " ;
const PHP_VERSION_NOT_SUPPORTED = " 8.4 " ;
2012-10-18 11:32:36 -04:00
public $path_config ;
public $path_languages ;
public $path_plugins ;
public $path_xmlforms ;
public $path_shared ;
public $path_sep ;
2013-04-26 17:01:09 -04:00
public $systemName ;
2012-10-18 11:32:36 -04:00
public $link ; #resource for database connection
2018-02-01 13:06:32 +00:00
/**
* Default name for connection
*
* @ var string
*/
const CONNECTION_INSTALL = 'install' ;
const CONNECTION_TEST_INSTALL = 'testInstall' ;
2012-10-18 11:32:36 -04:00
2018-02-01 13:06:32 +00:00
/**
* Constructor
* We defined the paths for the installer
*/
2017-12-04 13:25:35 +00:00
public function __construct ()
2012-10-18 11:32:36 -04:00
{
$this -> path_config = PATH_CORE . 'config/' ;
$this -> path_languages = PATH_CORE . 'content/languages/' ;
$this -> path_plugins = PATH_CORE . 'plugins/' ;
$this -> path_xmlforms = PATH_CORE . 'xmlform/' ;
$this -> path_public = PATH_HOME . 'public_html/index.html' ;
$this -> path_shared = PATH_TRUNK . 'shared/' ;
$this -> path_sep = PATH_SEP ;
2013-04-26 17:01:09 -04:00
$this -> systemName = '' ;
2015-01-31 15:56:34 -04:00
$this -> path_translations = PATH_CORE . 'js/labels/' ;
$this -> path_translationsMafe = PATH_HOME . 'public_html/translations/' ;
2012-03-29 16:42:09 -04:00
}
2017-12-04 13:25:35 +00:00
public function index ( $httpData )
2012-10-18 11:32:36 -04:00
{
2017-05-31 12:11:58 -04:00
if ( file_exists ( FILE_PATHS_INSTALLED )) {
$this -> setJSVar ( 'messageError' , G :: LoadTranslation ( 'ID_PROCESSMAKER_ALREADY_INSTALLED' ));
$this -> includeExtJS ( 'installer/stopInstall' );
$this -> setView ( 'installer/mainStopInstall' );
G :: RenderPage ( 'publish' , 'extJs' );
return ;
}
2015-02-19 17:54:54 -04:00
if (( strtoupper ( substr ( PHP_OS , 0 , 3 )) == 'WIN' ) && ( file_exists ( $this -> path_shared . 'partner.info' ))) {
2017-05-31 12:11:58 -04:00
$this -> setJSVar ( 'messageError' , G :: LoadTranslation ( 'ID_NO_INSTALL' ));
$this -> includeExtJS ( 'installer/stopInstall' );
$this -> setView ( 'installer/mainStopInstall' );
G :: RenderPage ( 'publish' , 'extJs' );
2013-08-30 10:32:17 -04:00
return ;
}
2017-12-04 13:25:35 +00:00
$licenseContent = file_get_contents ( PATH_TRUNK . 'LICENSE.txt' );
2012-10-18 11:32:36 -04:00
2017-12-04 13:25:35 +00:00
$this -> includeExtJS ( 'installer/CardLayout' , false );
$this -> includeExtJS ( 'installer/Wizard' , false );
$this -> includeExtJS ( 'installer/Header' , false );
$this -> includeExtJS ( 'installer/Card' , false );
2012-10-18 11:32:36 -04:00
2017-12-04 13:25:35 +00:00
$this -> includeExtJS ( 'installer/installer_cards' );
$this -> includeExtJS ( 'installer/main' , false );
2012-10-18 11:32:36 -04:00
2017-12-04 13:25:35 +00:00
$this -> setView ( 'installer/main' );
G :: RenderPage ( 'publish' , 'extJs' );
2012-03-29 16:42:09 -04:00
}
2018-02-01 13:06:32 +00:00
/**
* Set config connection
*
* @ param string $nameConnection name Connection
* @ param string $host
* @ param string $user
* @ param string $pass
* @ param string $database
* @ param int $port
* @ param array $options
*
* @ throws Exception
*/
public static function setNewConnection ( $nameConnection , $host , $user , $pass , $database , $port , $options = [])
{
try {
if ( empty ( $port )) {
$dbHost = explode ( ':' , $host );
$port = 3306 ;
if ( count ( $dbHost ) > 1 ) {
$port = $dbHost [ 1 ];
}
$host = $dbHost [ 0 ];
}
config ([ 'database.connections.' . $nameConnection => [
'driver' => 'mysql' ,
'host' => $host ,
'port' => $port ,
'database' => $database ,
'username' => $user ,
'password' => $pass ,
'unix_socket' => '' ,
2025-06-11 10:56:06 +00:00
'charset' => 'utf8mb4' ,
'collation' => 'utf8mb4_0900_ai_ci' ,
2018-02-01 13:06:32 +00:00
'prefix' => '' ,
'strict' => false ,
'engine' => 'InnoDB' ,
'options' => $options
]]);
DB :: connection ( $nameConnection ) -> getPdo ();
} catch ( Exception $e ) {
throw new Exception ( G :: LoadTranslation ( 'ID_MYSQL_CREDENTIALS_WRONG' ));
}
}
/**
* Get system information for review the requirements to install ProcessMaker
*
* @ return object
*/
2017-12-04 13:25:35 +00:00
public function getSystemInfo ()
2012-10-18 11:32:36 -04:00
{
2017-12-04 13:25:35 +00:00
$this -> setResponseType ( 'json' );
2012-10-18 11:32:36 -04:00
// PHP info and verification
$phpVer = phpversion ();
2017-12-04 13:25:35 +00:00
preg_match ( '/[0-9\.]+/' , $phpVer , $match );
$phpVerNum = ( float ) $match [ 0 ];
2012-10-18 11:32:36 -04:00
$info = new stdclass ();
$info -> php = new stdclass ();
$info -> mysql = new stdclass ();
$info -> openssl = new stdclass ();
$info -> curl = new stdclass ();
$info -> dom = new stdclass ();
$info -> gd = new stdclass ();
$info -> multibyte = new stdclass ();
$info -> soap = new stdclass ();
$info -> ldap = new stdclass ();
$info -> memory = new stdclass ();
2017-12-04 13:25:35 +00:00
$info -> php -> version = $phpVer ;
2018-06-13 12:00:06 -04:00
$info -> php -> result = (
version_compare ( phpversion (), self :: PHP_VERSION_MINIMUM_SUPPORTED , '>=' ) &&
version_compare ( phpversion (), self :: PHP_VERSION_NOT_SUPPORTED , '<' )) ? true : false ;
2012-10-18 11:32:36 -04:00
// MYSQL info and verification
$info -> mysql -> result = false ;
2017-12-04 13:25:35 +00:00
if ( function_exists ( 'mysqli_query' )) {
$mysqlVer = mysqli_get_client_info ();
preg_match ( '/[0-9\.]+/' , $mysqlVer , $match );
$mysqlNum = ( float ) $match [ 0 ];
2012-10-18 11:32:36 -04:00
$info -> mysql -> version = 'Client API version ' . $mysqlVer ;
2017-12-04 13:25:35 +00:00
$info -> mysql -> result = $mysqlNum >= 5.0 ;
2012-10-18 11:32:36 -04:00
}
2012-03-29 16:42:09 -04:00
2012-10-18 11:32:36 -04:00
// OpenSSL info
$info -> openssl -> result = false ;
2013-03-11 10:23:59 -04:00
$info -> openssl -> version = G :: LoadTranslation ( 'ID_NOT_ENABLED' );
2017-12-04 13:25:35 +00:00
if ( function_exists ( 'openssl_open' )) {
2012-10-18 11:32:36 -04:00
$info -> openssl -> result = true ;
2013-03-11 10:23:59 -04:00
$info -> openssl -> version = G :: LoadTranslation ( 'ID_ENABLED' );
2012-10-18 11:32:36 -04:00
}
2012-03-29 16:42:09 -04:00
2012-10-18 11:32:36 -04:00
// Curl info
$info -> curl -> result = false ;
2013-03-11 10:23:59 -04:00
$info -> curl -> version = G :: LoadTranslation ( 'ID_NOT_ENABLED' );
2017-12-04 13:25:35 +00:00
if ( function_exists ( 'curl_version' )) {
2012-10-18 11:32:36 -04:00
$info -> curl -> result = true ;
$version = curl_version ();
$info -> curl -> version = 'cURL ' . $version [ 'version' ];
$info -> openssl -> version = $version [ 'ssl_version' ];
}
2012-03-29 16:42:09 -04:00
2012-10-18 11:32:36 -04:00
// DOMDocument info
$info -> dom -> result = false ;
2013-03-11 10:23:59 -04:00
$info -> dom -> version = G :: LoadTranslation ( 'ID_NOT_ENABLED' );
2017-12-04 13:25:35 +00:00
if ( class_exists ( 'DOMDocument' )) {
2012-10-18 11:32:36 -04:00
$info -> dom -> result = true ;
2013-03-11 10:23:59 -04:00
$info -> dom -> version = G :: LoadTranslation ( 'ID_ENABLED' );
2012-10-18 11:32:36 -04:00
}
2012-03-29 16:42:09 -04:00
2012-10-18 11:32:36 -04:00
// GD info
$info -> gd -> result = false ;
2013-03-11 10:23:59 -04:00
$info -> gd -> version = G :: LoadTranslation ( 'ID_NOT_ENABLED' );
2017-12-04 13:25:35 +00:00
if ( function_exists ( 'gd_info' )) {
2012-10-18 11:32:36 -04:00
$info -> gd -> result = true ;
$gdinfo = gd_info ();
$info -> gd -> version = $gdinfo [ 'GD Version' ];
}
2012-03-29 16:42:09 -04:00
2012-10-18 11:32:36 -04:00
// Multibyte info
$info -> multibyte -> result = false ;
2013-03-11 10:23:59 -04:00
$info -> multibyte -> version = G :: LoadTranslation ( 'ID_NOT_ENABLED' );
2017-12-04 13:25:35 +00:00
if ( function_exists ( 'mb_check_encoding' )) {
2012-10-18 11:32:36 -04:00
$info -> multibyte -> result = true ;
2013-03-11 10:23:59 -04:00
$info -> multibyte -> version = G :: LoadTranslation ( 'ID_ENABLED' );
2012-10-18 11:32:36 -04:00
}
2012-03-29 16:42:09 -04:00
2012-10-18 11:32:36 -04:00
// soap info
$info -> soap -> result = false ;
2013-03-11 10:23:59 -04:00
$info -> soap -> version = G :: LoadTranslation ( 'ID_NOT_ENABLED' );
2017-12-04 13:25:35 +00:00
if ( class_exists ( 'SoapClient' )) {
2012-10-18 11:32:36 -04:00
$info -> soap -> result = true ;
2013-03-11 10:23:59 -04:00
$info -> soap -> version = G :: LoadTranslation ( 'ID_ENABLED' );
2012-10-18 11:32:36 -04:00
}
2012-03-29 16:42:09 -04:00
2012-10-18 11:32:36 -04:00
// ldap info
$info -> ldap -> result = false ;
2013-03-11 10:23:59 -04:00
$info -> ldap -> version = G :: LoadTranslation ( 'ID_NOT_ENABLED' );
2017-12-04 13:25:35 +00:00
if ( function_exists ( 'ldap_connect' )) {
2012-10-18 11:32:36 -04:00
$info -> ldap -> result = true ;
2013-03-11 10:23:59 -04:00
$info -> ldap -> version = G :: LoadTranslation ( 'ID_ENABLED' );
2012-10-18 11:32:36 -04:00
}
2012-09-26 12:56:24 -04:00
2012-10-18 11:32:36 -04:00
// memory limit verification
2017-12-04 13:25:35 +00:00
$memory = ( int ) ini_get ( 'memory_limit' );
2019-07-10 08:43:16 -04:00
$info -> memory -> version = changeAbbreviationOfDirectives ( ini_get ( 'memory_limit' ));
2017-12-04 13:25:35 +00:00
$info -> memory -> result = $memory > 255 ;
2012-09-26 12:56:24 -04:00
2012-10-18 11:32:36 -04:00
return $info ;
2012-04-26 13:21:41 -04:00
}
2012-03-29 16:42:09 -04:00
2017-12-04 13:25:35 +00:00
public function is_dir_writable ( $path )
2012-10-18 11:32:36 -04:00
{
2017-12-04 13:25:35 +00:00
return G :: is_writable_r ( $path );
2012-04-26 13:21:41 -04:00
}
2012-03-29 16:42:09 -04:00
2017-12-04 13:25:35 +00:00
/**
* Test db connection
*
* @ return StdClass
*/
public function testConnection ()
2012-10-18 11:32:36 -04:00
{
2017-12-04 13:25:35 +00:00
$this -> setResponseType ( 'json' );
$info = new StdClass ();
try {
2019-08-21 10:22:17 -04:00
$info = $this -> testMySQLConnection ();
2017-12-04 13:25:35 +00:00
} catch ( Exception $e ) {
$info -> result = false ;
$info -> message = G :: LoadTranslation ( 'DBCONNECTIONS_MSGA' );
2012-10-18 11:32:36 -04:00
}
2017-12-04 13:25:35 +00:00
return $info ;
2012-03-29 16:42:09 -04:00
}
2012-10-18 11:32:36 -04:00
/**
* log the queries and other information to install . log ,
* the install . log files should be placed in shared / logs
* for that reason we are using the $_REQUEST of pathShared
*/
2018-02-01 13:06:32 +00:00
private function installLog ( $text )
2012-10-18 11:32:36 -04:00
{
//if this function is called outside the createWorkspace, just returns and do nothing
2017-12-04 13:25:35 +00:00
if ( ! isset ( $_REQUEST [ 'pathShared' ])) {
2012-10-18 11:32:36 -04:00
return ;
}
2017-12-04 13:25:35 +00:00
//log file is in shared/logs
$pathShared = trim ( $_REQUEST [ 'pathShared' ]);
2018-02-01 13:06:32 +00:00
if ( substr ( $pathShared , - 1 ) !== '/' ) {
2012-10-18 11:32:36 -04:00
$pathShared .= '/' ;
}
2025-04-08 16:05:19 +00:00
$pathSharedLog = $pathShared . 'logs/' ;
2013-04-22 17:01:26 -04:00
G :: verifyPath ( $pathSharedLog , true );
$logFile = $pathSharedLog . 'install.log' ;
2012-10-18 11:32:36 -04:00
2017-12-04 13:25:35 +00:00
if ( ! is_file ( $logFile )) {
G :: mk_dir ( dirname ( $pathShared ));
$fpt = fopen ( $logFile , 'w' );
2012-10-18 11:32:36 -04:00
if ( $fpt !== null ) {
2017-12-04 13:25:35 +00:00
fwrite ( $fpt , sprintf ( " %s %s \n " , date ( 'Y:m:d H:i:s' ), '----- ' . G :: LoadTranslation ( 'ID_STARTING_LOG_FILE' ) . ' ------' ));
fclose ( $fpt );
2012-10-18 11:32:36 -04:00
} else {
2018-02-01 13:06:32 +00:00
throw new Exception ( G :: LoadTranslation ( 'ID_FILE_NOT_WRITEABLE' , SYS_LANG , [ $logFile ]));
2012-10-18 11:32:36 -04:00
return $false ;
}
}
2015-11-26 20:11:58 -04:00
2015-05-11 16:36:07 -04:00
$filter = new InputFilter ();
$logFile = $filter -> validateInput ( $logFile , 'path' );
2015-11-26 20:11:58 -04:00
2017-12-04 13:25:35 +00:00
$fpt = fopen ( $logFile , 'a' );
fwrite ( $fpt , sprintf ( " %s %s \n " , date ( 'Y:m:d H:i:s' ), trim ( $text )));
fclose ( $fpt );
2012-10-18 11:32:36 -04:00
return true ;
2012-03-29 16:42:09 -04:00
}
2012-10-18 11:32:36 -04:00
2017-08-05 12:35:14 -04:00
/**
* Display an error when processMaker is already installed
*
* @ return void
*/
2017-12-04 13:25:35 +00:00
private function displayError ()
{
2017-08-05 12:35:14 -04:00
$this -> setJSVar ( 'messageError' , G :: LoadTranslation ( 'ID_PROCESSMAKER_ALREADY_INSTALLED' ));
$this -> includeExtJS ( 'installer/stopInstall' );
$this -> setView ( 'installer/mainStopInstall' );
G :: RenderPage ( 'publish' , 'extJs' );
2012-03-29 16:42:09 -04:00
}
2012-10-18 11:32:36 -04:00
2017-12-04 13:25:35 +00:00
public function forceTogenerateTranslationsFiles ( $url )
2012-10-18 11:32:36 -04:00
{
$ch = curl_init ();
2018-10-19 17:01:49 -04:00
curl_setopt ( $ch , CURLOPT_URL , G :: browserCacheFilesUrl ( System :: getServerProtocolHost () . " /js/ext/translation.en.js?r= " . rand ( 1 , 10000 )));
2013-04-26 16:34:48 -04:00
curl_setopt ( $ch , CURLOPT_RETURNTRANSFER , 1 );
curl_setopt ( $ch , CURLOPT_FRESH_CONNECT , 1 );
curl_setopt ( $ch , CURLOPT_TIMEOUT , 60 );
curl_setopt ( $ch , CURLOPT_CONNECTTIMEOUT , 20 );
curl_exec ( $ch );
curl_close ( $ch );
2012-09-26 12:56:24 -04:00
}
2012-03-29 16:42:09 -04:00
2012-10-18 11:32:36 -04:00
/**
* query_sql_file send many statements to server
*
* @ param string $file
* @ param string $connection
* @ return array $report
*/
2017-12-04 13:25:35 +00:00
public function mysqlFileQuery ( $file )
2012-10-18 11:32:36 -04:00
{
2017-12-04 13:25:35 +00:00
if ( ! is_file ( $file )) {
2018-02-01 13:06:32 +00:00
throw new Exception ( G :: LoadTranslation ( 'ID_SQL_FILE_INVALID' , SYS_LANG , [ $file ]));
2012-10-18 11:32:36 -04:00
return $false ;
}
2018-02-01 13:06:32 +00:00
$this -> installLog ( G :: LoadTranslation ( 'ID_PROCESING' , SYS_LANG , [ $file ]));
2017-12-04 13:25:35 +00:00
$startTime = microtime ( true );
//New Update, to support more complex queries
2012-03-29 16:42:09 -04:00
2017-12-04 13:25:35 +00:00
$lines = file ( $file );
2012-10-18 11:32:36 -04:00
$previous = null ;
2018-02-01 13:06:32 +00:00
DB :: connection ( self :: CONNECTION_INSTALL )
-> statement ( " SET NAMES 'utf8' " );
2012-10-18 11:32:36 -04:00
foreach ( $lines as $j => $line ) {
2017-12-04 13:25:35 +00:00
$line = trim ( $line ); // Remove comments from the script
2012-04-23 18:13:06 -04:00
2018-02-01 13:06:32 +00:00
if ( strpos ( $line , '--' ) === 0 ) {
$line = substr ( $line , 0 , strpos ( $line , '--' ));
2012-10-18 11:32:36 -04:00
}
2012-04-23 18:13:06 -04:00
2017-12-04 13:25:35 +00:00
if ( empty ( $line )) {
2012-10-18 11:32:36 -04:00
continue ;
}
2012-09-26 12:56:24 -04:00
2018-02-01 13:06:32 +00:00
if ( strpos ( $line , '#' ) === 0 ) {
$line = substr ( $line , 0 , strpos ( $line , '#' ));
2012-10-18 11:32:36 -04:00
}
2012-09-26 12:56:24 -04:00
2017-12-04 13:25:35 +00:00
if ( empty ( $line )) {
2012-10-18 11:32:36 -04:00
continue ;
}
2012-09-26 12:56:24 -04:00
2012-10-18 11:32:36 -04:00
// Concatenate the previous line, if any, with the current
if ( $previous ) {
2018-02-01 13:06:32 +00:00
$line = $previous . ' ' . $line ;
2012-10-18 11:32:36 -04:00
}
$previous = null ;
2012-09-26 12:56:24 -04:00
2012-10-18 11:32:36 -04:00
// If the current line doesnt end with ; then put this line together
// with the next one, thus supporting multi-line statements.
2018-02-01 13:06:32 +00:00
if ( strrpos ( $line , ';' ) !== strlen ( $line ) - 1 ) {
2012-10-18 11:32:36 -04:00
$previous = $line ;
continue ;
}
2012-09-26 12:56:24 -04:00
2018-02-01 13:06:32 +00:00
$line = substr ( $line , 0 , strrpos ( $line , ';' ));
DB :: connection ( self :: CONNECTION_INSTALL )
-> statement ( $line );
2012-10-18 11:32:36 -04:00
}
2012-09-26 12:56:24 -04:00
2017-12-04 13:25:35 +00:00
$endTime = microtime ( true );
2018-02-01 13:06:32 +00:00
$this -> installLog ( G :: LoadTranslation ( 'ID_FILE_PROCESSED' , SYS_LANG , [ basename ( $file ), $endTime - $startTime ]));
2012-10-18 11:32:36 -04:00
return true ;
}
2012-04-23 18:13:06 -04:00
2012-10-18 11:32:36 -04:00
/**
* Privates functions section , non callable by http request
*/
2017-12-04 13:25:35 +00:00
private function testMySQLConnection ()
2012-10-18 11:32:36 -04:00
{
2018-02-01 13:06:32 +00:00
try {
$filter = new InputFilter ();
$info = new StdClass ();
$info -> result = false ;
$info -> message = '' ;
if ( ! function_exists ( 'mysqli_connect' )) {
$info -> message = G :: LoadTranslation ( 'ID_PHP_MYSQLI_NOT_INSTALL' );
return $info ;
}
$dataRequest = $_REQUEST ;
$db_hostname = $filter -> validateInput ( $dataRequest [ 'db_hostname' ]);
$db_port = $filter -> validateInput ( $dataRequest [ 'db_port' ]);
$db_username = $filter -> validateInput ( $dataRequest [ 'db_username' ]);
$db_password = urlencode ( $dataRequest [ 'db_password' ]);
$db_password = urldecode ( $filter -> validateInput ( $db_password ));
$fp = @ fsockopen ( $db_hostname , $db_port , $errno , $errstr , 30 );
if ( ! $fp ) {
$info -> message .= G :: LoadTranslation ( 'ID_CONNECTION_ERROR' , SYS_LANG , [ " $errstr ( $errno ) " ]);
return $info ;
}
2012-03-29 16:42:09 -04:00
2018-02-01 13:06:32 +00:00
$db_username = $filter -> validateInput ( $db_username , 'nosql' );
$db_hostname = $filter -> validateInput ( $db_hostname , 'nosql' );
2015-11-26 20:11:58 -04:00
2018-02-01 13:06:32 +00:00
self :: setNewConnection ( self :: CONNECTION_TEST_INSTALL , $db_hostname , $db_username , $db_password , '' , $db_port );
$query = " SELECT * FROM `information_schema`.`USER_PRIVILEGES` where (GRANTEE = \" ' $db_username '@' $db_hostname ' \" OR GRANTEE = \" ' $db_username '@'%%' \" ) " ;
$response = DB :: connection ( self :: CONNECTION_TEST_INSTALL ) -> select ( $query );
if ( ! is_array ( $response )) {
$info -> message .= G :: LoadTranslation ( 'ID_CONNECTION_ERROR_PRIVILEGE' , SYS_LANG , [ $db_username ]);
return $info ;
}
$info -> message .= G :: LoadTranslation ( 'ID_MYSQL_SUCCESS_CONNECT' );
$info -> result = true ;
} catch ( Exception $e ) {
$info -> result = false ;
$info -> message = G :: LoadTranslation ( 'ID_MYSQL_CREDENTIALS_WRONG' );
2012-10-18 11:32:36 -04:00
}
return $info ;
2012-03-29 16:42:09 -04:00
}
2025-06-13 11:14:23 -04:00
2017-07-28 11:33:56 -04:00
/**
* Verify / create framework shared directory structure
*
*/
private function verifySharedFrameworkPaths ( $sharedPath )
{
2025-04-10 00:36:27 +00:00
// Check if $sharedPath ends with a slash and append if necessary
if ( substr ( $sharedPath , - 1 ) !== DIRECTORY_SEPARATOR ) {
$sharedPath .= DIRECTORY_SEPARATOR ;
}
2017-07-28 11:33:56 -04:00
$paths = [
2025-04-10 00:36:27 +00:00
$sharedPath . 'fonts' => 0770 ,
2017-08-07 13:02:26 -04:00
$sharedPath . 'framework' => 0770 ,
$sharedPath . 'framework' . DIRECTORY_SEPARATOR . 'cache' => 0770 ,
2017-07-28 11:33:56 -04:00
];
foreach ( $paths as $path => $permission ) {
if ( ! file_exists ( $path )) {
G :: mk_dir ( $path , $permission );
}
if ( ! file_exists ( $path )) {
return false ;
}
}
return true ;
}
2012-10-18 11:32:36 -04:00
}