|
@@ -2449,6 +2449,13 @@ function MAKE_PKG_COMPONENT($h,$installer_dir_tar,$installer_url,$installer_tmp,
|
|
|
$skipPhpFiles[] = 'superedit-DB_PROCEDURES_CREATE.php';
|
|
$skipPhpFiles[] = 'superedit-DB_PROCEDURES_CREATE.php';
|
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+/*
|
|
|
$skipPhpFiles = array();
|
|
$skipPhpFiles = array();
|
|
|
$skipPhpFiles[] = 'bash_sync_perms.php';
|
|
$skipPhpFiles[] = 'bash_sync_perms.php';
|
|
|
$skipPhpFiles[] = 'bash_install_check.php';
|
|
$skipPhpFiles[] = 'bash_install_check.php';
|
|
@@ -2500,6 +2507,88 @@ function MAKE_PKG_COMPONENT($h,$installer_dir_tar,$installer_url,$installer_tmp,
|
|
|
|
|
|
|
|
exec($exec,$out,$exit);$out="";$exit="";
|
|
exec($exec,$out,$exit);$out="";$exit="";
|
|
|
DEBUG_S(-3,'Zakodowanie kodu php/kompilacja z licencja i kluczem',array($exec,$out,$exit),__FILE__,__FUNCTION__,__LINE__);
|
|
DEBUG_S(-3,'Zakodowanie kodu php/kompilacja z licencja i kluczem',array($exec,$out,$exit),__FILE__,__FUNCTION__,__LINE__);
|
|
|
|
|
+*/
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ if (empty($installer_dir)) throw new Exception("Install path not found");
|
|
|
|
|
+ if (empty($domains = INSTALL_SES_PROCESY_A::get_same_domains_for_install($h->SERVER_ADDRESS_SHORT, $h->SERVER_ADDRESS))) throw new Exception("Domains not found");
|
|
|
|
|
+
|
|
|
|
|
+ $phpVersionsForSgencoder = '--phpversion 5.5 --phpversion 5.6';// encode for PHP 5.x (currently supported PHP 5.0-5.6)
|
|
|
|
|
+
|
|
|
|
|
+ $domainEncodePhpFiles = [
|
|
|
|
|
+ 'ant.php',
|
|
|
|
|
+ 'api.php',
|
|
|
|
|
+ 'budynki.php',
|
|
|
|
|
+ 'index-ajax.php',
|
|
|
|
|
+ 'index.php',
|
|
|
|
|
+ 'procesy5.php',
|
|
|
|
|
+ 'session-expire.php',
|
|
|
|
|
+ 'test-sync.php',
|
|
|
|
|
+ 'wfs-data.php',
|
|
|
|
|
+ 'wfs-qgis.php',
|
|
|
|
|
+ 'wfs.php',
|
|
|
|
|
+ ];
|
|
|
|
|
+
|
|
|
|
|
+ $cmd = "find . -name '*.php' ";
|
|
|
|
|
+ $out = ''; $ret = '';
|
|
|
|
|
+ exec("cd {$installer_dir}/SE && {$cmd}", $out, $ret);
|
|
|
|
|
+ DEBUG_S(-3,'Files found to encode',array($exec,$out,$ret),__FILE__,__FUNCTION__,__LINE__);
|
|
|
|
|
+ if (0 !== $ret) throw new Exception("Error at find php files");
|
|
|
|
|
+ if (empty($out)) throw new Exception("No php files found");
|
|
|
|
|
+ $allPhpFiles = array_map(function ($phpFilePath) {
|
|
|
|
|
+ return ('./' == substr($phpFilePath, 0, 2))? substr($phpFilePath, 2) : $phpFilePath;
|
|
|
|
|
+ }, $out);
|
|
|
|
|
+ $freeEncodePhpFiles = array_filter($allPhpFiles, function ($phpFilePath) use ($domainEncodePhpFiles) {
|
|
|
|
|
+ if ('se-lib/Vendor/' === substr($phpFilePath, 0, strlen('se-lib/Vendor/'))) return false; // SKIP se-lib/Vendor/*
|
|
|
|
|
+ if ('.ini.php' === substr($phpFilePath, -1 * strlen('.ini.php'))) return false; // SKIP *.ini.php
|
|
|
|
|
+ return (!in_array($phpFilePath, $domainEncodePhpFiles));
|
|
|
|
|
+ });
|
|
|
|
|
+ DEBUG_S(-3,'freeEncodePhpFiles',$freeEncodePhpFiles,__FILE__,__FUNCTION__,__LINE__);
|
|
|
|
|
+ if (empty($freeEncodePhpFiles)) throw new Exception("No php files to encode");
|
|
|
|
|
+
|
|
|
|
|
+ $cmdTempl = "cd {$installer_dir}/SE && /Applications/SourceGuardian.app/Contents/MacOS/sgencoder {$phpVersionsForSgencoder} -b- ";
|
|
|
|
|
+ $cmdDomainEncodeDomainsTempl = " --domain " . implode(" --domain ", array_merge($domains, ['localhost']));
|
|
|
|
|
+ $cmdDomainEncodeFilesTempl = " " . implode(" ", $domainEncodePhpFiles);
|
|
|
|
|
+ $cmdFreeEncodeFilesTempl = " " . implode(" ", $freeEncodePhpFiles);
|
|
|
|
|
+
|
|
|
|
|
+ $cmds = [
|
|
|
|
|
+ $cmdTempl . $cmdDomainEncodeDomainsTempl . $cmdDomainEncodeFilesTempl,
|
|
|
|
|
+ $cmdTempl . $cmdFreeEncodeFilesTempl,
|
|
|
|
|
+ ];
|
|
|
|
|
+
|
|
|
|
|
+ $returnValues = [];
|
|
|
|
|
+ foreach ($cmds as $cmd) {
|
|
|
|
|
+ $out = ''; $ret = '';
|
|
|
|
|
+ exec($cmd, $out, $ret);
|
|
|
|
|
+ $encoderSummaryLine = end($out);
|
|
|
|
|
+ $returnValues[] = $encoderSummaryLine;
|
|
|
|
|
+ DEBUG_S(-3,'Encoded files',array($cmd, $out, $ret),__FILE__,__FUNCTION__,__LINE__);
|
|
|
|
|
+ if (empty($out)) throw new Exception("No output for encode files command");
|
|
|
|
|
+ }
|
|
|
|
|
+ $statusInfo = array_reduce($returnValues, function ($ret, $encoderSummaryLine) {
|
|
|
|
|
+ DEBUG_S(-3,'DBG reduce [$ret, $encoderSummaryLine]',array($ret, $encoderSummaryLine),__FILE__,__FUNCTION__,__LINE__);
|
|
|
|
|
+ $matches = [];
|
|
|
|
|
+ preg_match_all('/(\d+) files, (\d+) processed, (\d+) errors/', $encoderSummaryLine, $matches, PREG_SET_ORDER, 0);
|
|
|
|
|
+ return [
|
|
|
|
|
+ 'files' => $ret['files'] + (int)$matches[0][1],
|
|
|
|
|
+ 'processed' => $ret['processed'] + (int)$matches[0][2],
|
|
|
|
|
+ 'errors' => $ret['errors'] + (int)$matches[0][3],
|
|
|
|
|
+ ];
|
|
|
|
|
+ }, [
|
|
|
|
|
+ 'files' => 0,
|
|
|
|
|
+ 'processed' => 0,
|
|
|
|
|
+ 'errors' => 0,
|
|
|
|
|
+ ]);
|
|
|
|
|
+ if ($statusInfo['errors'] === 0 && $statusInfo['files'] > 0) {
|
|
|
|
|
+ DEBUG_S(-3, "{$statusInfo['files']} files, {$statusInfo['processed']} processed, {$statusInfo['errors']} errors", [], __FILE__,__FUNCTION__,__LINE__);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ throw new Exception("{$statusInfo['files']} files, {$statusInfo['processed']} processed, {$statusInfo['errors']} errors");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
//usuniecie musi byc przed instalacja TODO
|
|
//usuniecie musi byc przed instalacja TODO
|
|
|
//$last_command_id++;
|
|
//$last_command_id++;
|