1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-02 12:48:26 +02:00

Reformatted e107_make.php

This commit is contained in:
Nick Liu
2020-02-11 23:39:39 +01:00
parent 39c097953f
commit a9d8344659

View File

@@ -13,11 +13,13 @@ $build = new e107Build($argv[1]);
exit;*/ exit;*/
function showUsage() { function showUsage()
{
echo "\nUsage: {$_SERVER['argv'][0]} <config_file_name>\n\n"; echo "\nUsage: {$_SERVER['argv'][0]} <config_file_name>\n\n";
} }
class e107Build { class e107Build
{
public $config, $path, $version, $tag, $lastversion, $lastversiondate, $dbchange, $beta, $error, $rc; public $config, $path, $version, $tag, $lastversion, $lastversiondate, $dbchange, $beta, $error, $rc;
@@ -41,7 +43,6 @@ class e107Build {
$this->rc = false; $this->rc = false;
// $this->config['baseDir'] = realpath(getcwd()); // $this->config['baseDir'] = realpath(getcwd());
$this->config['baseDir'] = dirname(__FILE__); $this->config['baseDir'] = dirname(__FILE__);
@@ -136,155 +137,50 @@ class e107Build {
} }
} }
private function status($msg, $heading = false)
private function gitArchive($zipFile, $since=null)
{ {
$file = $this->tempDir.$zipFile; if ($heading == false)
$this->status("Zipping up temp Release archive..");
if(!empty($since))
{ {
$cmd = "git archive -o ".$file." HEAD $(git diff --name-only --diff-filter=ACMRTUXB ".$since.")"; echo date('m/d/Y h:i:s') . ' ';
} }
else
if ($heading != false)
{ {
$cmd = "git archive -o ".$file." HEAD"; echo "\n\n>>>> ";
} }
$this->changeDir($this->gitDir); echo $msg . "\n";
$this->run($cmd); if ($heading != false)
}
private function changeDir($dir)
{ {
$this->status("Changing to dir: ".$dir); echo "\n";
chdir($dir);
} }
private function emptyExportDir() }
private function ReadMeProblems()
{ {
if(is_dir($this->exportDir)) //check for readme files associated with configured releases
$error = false;
foreach ($this->config['releases'] as $rel)
{ {
//$this->status("Cleaning out export directory. "); if (isset($rel['readme']))
$this->rmdir($this->exportDir);
mkdir($this->exportDir,0755);
}
else
{ {
$this->status("Making export directory. "); $fname = "{$this->config['baseDir']}/readme/{$this->config['main']['name']}/{$rel['readme']}";
mkdir($this->exportDir,0755); if (!is_readable($fname))
}
}
private function gitClone()
{ {
if(empty($this->gitRepo)) echo "ERROR: readme file $fname does not exist.\n";
{ $error = true;
$this->status("No Repo selected"); }
return false; }
} }
$this->status("Cloning git repo", true); return $error;
$this->run("git clone ".$this->gitRepo." ".$this->gitDir);
// $this->run("mv ".$tempDir."/.git ".$repoDir."/.git");
// $this->run("mv ".$tempDir."/* ".$repoDir);
// $this->run("/bin/cp -rfv ".$tempDir."/* ".$repoDir);
// $this->run("git --work-tree=".$repoDir." --git-dir=".$repoDir."/.git pull");
// $this->run("chown -R ".$dir.":".$dir." ".$repoDir);
$this->run("chmod 0755 ".$this->gitDir);
if(!is_dir($this->gitDir."/.git"))
{
$this->status("There was a problem. Check your setup:\n
cd /usr/bin/<br />
sudo ln -s /usr/local/cpanel/3rdparty/bin/git* .<br />
git --version
<br /><br />
Make sure TCP port 9418 is open!");
} }
}
private function gitArchiveUnzip($file)
{
$this->status("Unzipping temp archive to export folder", true);
$filepath = $this->tempDir.$file;
$cmd = 'unzip -q -o '.$filepath.' -d '.$this->exportDir;
$this->run($cmd);
}
private function run($cmd)
{
$return = `$cmd 2>&1`;
$this->status($cmd.":");
if($return)
{
// $return = $this->parseReturn($return);
// $this->lastRunMessage = $return;
$this->status(print_r($return,true));
}
// print_r($return);
// $this->alert($return);
}
private function generateReadme($additional='',$dbchange=FALSE)
{
if($this->testCoreImage)
{
return false;
}
$TEMPLATE = "[oldversion] -> [newversion] Upgrade Guide\n";
$TEMPLATE .= "This is an update from [oldversion] to [newversion] only. If you are upgrading from any other version besides [oldversion] ,\n";
$TEMPLATE .= "then you have downloaded the wrong package. For those users that have been using the current SVN version of e107, from any other version besides [oldversion] ";
$TEMPLATE .= "this is the correct version to use.\n";
$TEMPLATE .= "\nIncluded in these releases are security related file changes and so you must upgrade your site with all these files.\n";
$TEMPLATE .= "\nTo install, simply upload the files to your server overwriting the existing [oldversion] files.\n";
$TEMPLATE .= ($dbchange==FALSE) ? "There are no database changes in this release." : "This version contains database changes.\n After uploading the files, go to the admin area and click 'Update'.";
if($additional)
{
$TEMPLATE .= "\n".$additional."\n";
}
$srch[0] = "[oldversion]";
$repl[0] = $this->lastversion;
$srch[1] = "[newversion]";
$repl[1] = $this->version;
$text = str_replace($srch,$repl,$TEMPLATE);
echo ("Generating ReadMe Data: ".$this->lastversion ." -> ".$this->version."\n");
return $text;
}
private function buildLastConfig() private function buildLastConfig()
{ {
if (!$this->lastversion || !$this->lastversiondate) if (!$this->lastversion || !$this->lastversiondate)
@@ -322,7 +218,41 @@ class e107Build {
} }
} }
private function generateReadme($additional = '', $dbchange = FALSE)
{
if ($this->testCoreImage)
{
return false;
}
$TEMPLATE = "[oldversion] -> [newversion] Upgrade Guide\n";
$TEMPLATE .= "This is an update from [oldversion] to [newversion] only. If you are upgrading from any other version besides [oldversion] ,\n";
$TEMPLATE .= "then you have downloaded the wrong package. For those users that have been using the current SVN version of e107, from any other version besides [oldversion] ";
$TEMPLATE .= "this is the correct version to use.\n";
$TEMPLATE .= "\nIncluded in these releases are security related file changes and so you must upgrade your site with all these files.\n";
$TEMPLATE .= "\nTo install, simply upload the files to your server overwriting the existing [oldversion] files.\n";
$TEMPLATE .= ($dbchange == FALSE) ? "There are no database changes in this release." : "This version contains database changes.\n After uploading the files, go to the admin area and click 'Update'.";
if ($additional)
{
$TEMPLATE .= "\n" . $additional . "\n";
}
$srch[0] = "[oldversion]";
$repl[0] = $this->lastversion;
$srch[1] = "[newversion]";
$repl[1] = $this->version;
$text = str_replace($srch, $repl, $TEMPLATE);
echo("Generating ReadMe Data: " . $this->lastversion . " -> " . $this->version . "\n");
return $text;
}
public function makeBuild() public function makeBuild()
{ {
@@ -337,7 +267,6 @@ class e107Build {
} }
if ($this->preprocess()) if ($this->preprocess())
{ {
$this->createReleases(); $this->createReleases();
@@ -351,36 +280,6 @@ class e107Build {
return; return;
} }
private function ReadMeProblems()
{
//check for readme files associated with configured releases
$error = false;
foreach($this->config['releases'] as $rel)
{
if(isset($rel['readme']))
{
$fname = "{$this->config['baseDir']}/readme/{$this->config['main']['name']}/{$rel['readme']}";
if(!is_readable($fname))
{
echo "ERROR: readme file $fname does not exist.\n";
$error = true;
}
}
}
return $error;
}
private function cleanupFiles() private function cleanupFiles()
{ {
$dir = "{$this->config['baseDir']}/target/{$this->config['main']['name']}"; $dir = "{$this->config['baseDir']}/target/{$this->config['main']['name']}";
@@ -393,8 +292,6 @@ class e107Build {
`$cmd`; `$cmd`;
chdir($this->config['baseDir']); chdir($this->config['baseDir']);
} }
else else
@@ -440,16 +337,6 @@ class e107Build {
} }
public function coreImageTest()
{
//$this->checkoutSvn();
//Export files to export dir
//$this->exportSvn();
$this->CreateCoreImage();
}
private function preprocess() private function preprocess()
{ {
//Update current cvs //Update current cvs
@@ -528,28 +415,55 @@ class e107Build {
*/ */
} }
private function gitClone()
private function copyCoreImage()
{ {
if (empty($this->gitRepo))
$orig = $this->tempDir."core_image.php";
$dest = $this->exportDir."e107_admin/core_image.php";
if(!file_exists($orig))
{ {
$this->status("ERROR: Image file not found"); $this->status("No Repo selected");
return false;
} }
$this->status("Copying Core Image into export directory", true); $this->status("Cloning git repo", true);
$this->run("/bin/cp -rf ".$orig." ".$dest);
if(!file_exists($dest)) $this->run("git clone " . $this->gitRepo . " " . $this->gitDir);
// $this->run("mv ".$tempDir."/.git ".$repoDir."/.git");
// $this->run("mv ".$tempDir."/* ".$repoDir);
// $this->run("/bin/cp -rfv ".$tempDir."/* ".$repoDir);
// $this->run("git --work-tree=".$repoDir." --git-dir=".$repoDir."/.git pull");
// $this->run("chown -R ".$dir.":".$dir." ".$repoDir);
$this->run("chmod 0755 " . $this->gitDir);
if (!is_dir($this->gitDir . "/.git"))
{ {
$this->status("ERROR: Image file didnt copy."); $this->status("There was a problem. Check your setup:\n
cd /usr/bin/<br />
sudo ln -s /usr/local/cpanel/3rdparty/bin/git* .<br />
git --version
<br /><br />
Make sure TCP port 9418 is open!");
} }
} }
private function run($cmd)
{
$return = `$cmd 2>&1`;
$this->status($cmd . ":");
if ($return)
{
// $return = $this->parseReturn($return);
// $this->lastRunMessage = $return;
$this->status(print_r($return, true));
}
// print_r($return);
// $this->alert($return);
}
private function createReleases() private function createReleases()
{ {
@@ -652,17 +566,16 @@ class e107Build {
$releaseDir = "{$this->config['baseDir']}/target/{$this->config['main']['name']}/release/" . $this->releaseDir; $releaseDir = "{$this->config['baseDir']}/target/{$this->config['main']['name']}/release/" . $this->releaseDir;
// $newfile // $newfile
/** /**
* git archive -o update.zip HEAD $(git diff --name-only [id]) * git archive -o update.zip HEAD $(git diff --name-only [id])
*
Of course you need to replace the [id]-part with the ID of your commit. So if the ID of your commit is 599313e986c56e5451caa14d32c6b18273f4331b then your command would look like this: * Of course you need to replace the [id]-part with the ID of your commit. So if the ID of your commit is 599313e986c56e5451caa14d32c6b18273f4331b then your command would look like this:
git archive -o update.zip HEAD $(git diff --name-only 599313e986c56e5451caa14d32c6b18273f4331b) * git archive -o update.zip HEAD $(git diff --name-only 599313e986c56e5451caa14d32c6b18273f4331b)
1 * 1
*
git archive -o update.zip HEAD $(git diff --name-only 599313e986c56e5451caa14d32c6b18273f4331b) * git archive -o update.zip HEAD $(git diff --name-only 599313e986c56e5451caa14d32c6b18273f4331b)
*/ */
@@ -677,7 +590,6 @@ git archive -o update.zip HEAD $(git diff --name-only 599313e986c56e5451caa14d3
// $xtarcmd = "touch -t {$reftime} ../reftime && find . -newer ../reftime -type f -print0 | xargs -0 tar --no-recursion -zc -f{$gzfile} >/dev/null 2>&1"; // $xtarcmd = "touch -t {$reftime} ../reftime && find . -newer ../reftime -type f -print0 | xargs -0 tar --no-recursion -zc -f{$gzfile} >/dev/null 2>&1";
$this->status('Creating ZIP archive'); $this->status('Creating ZIP archive');
$this->status($zipcmd); $this->status($zipcmd);
`$zipcmd`; `$zipcmd`;
@@ -709,30 +621,24 @@ git archive -o update.zip HEAD $(git diff --name-only 599313e986c56e5451caa14d3
} // end loop } // end loop
} }
private function checkoutSvn() private function emptyExportDir()
{ {
if (is_dir($this->exportDir))
return false;
if($this->beta)
{ {
$this->status("Beta Mode - skipping svn checkout"); //$this->status("Cleaning out export directory. ");
return; $this->rmdir($this->exportDir);
mkdir($this->exportDir, 0755);
}
else
{
$this->status("Making export directory. ");
mkdir($this->exportDir, 0755);
} }
$dir = "{$this->config['baseDir']}/target/{$this->config['main']['name']}/checkout";
$this->status("Checking out current svn to {$dir}");
$cmd = "svn checkout --username {$this->config['main']['svn_username']} --password {$this->config['main']['svn_password']} --no-auth-cache --non-interactive {$this->config['main']['svn_path']} {$dir}";
$this->status($cmd);
`$cmd`;
} }
private function rmdir($dir) private function rmdir($dir)
{ {
@@ -758,84 +664,40 @@ git archive -o update.zip HEAD $(git diff --name-only 599313e986c56e5451caa14d3
} }
private function gitArchive($zipFile, $since = null)
private function exportSvn($tag='')
{ {
$file = $this->tempDir . $zipFile;
$this->status("Zipping up temp Release archive..");
if (!empty($since))
if(is_dir($this->exportDir))
{ {
$this->status("Cleaning out export directory. "); $cmd = "git archive -o " . $file . " HEAD $(git diff --name-only --diff-filter=ACMRTUXB " . $since . ")";
$this->rmdir($this->exportDir);
}
if(is_dir($this->tempDir))
{
$this->status("Cleaning out temp directory. ");
$this->rmdir($this->tempDir);
mkdir($this->tempDir,0755);
}
$this->status("Exporting from Github to temp directory ");
/*
if($tag == '')
{
$this->status("Exporting current svn to {$dir}");
$path = $this->config['main']['svn_path'];
} }
else else
{ {
$this->status("Exporting tag {$tag} to {$dir}"); $cmd = "git archive -o " . $file . " HEAD";
$path = "{$this->config['main']['svn_tag_path']}/{$tag}";
} }
*/
$filePath = $this->tempDir. "master.zip"; $this->changeDir($this->gitDir);
$cmd = 'wget https://codeload.github.com/e107inc/e107/zip/master -O '.$filePath; // , 'e107-master.zip', 'temp');
// $cmd = "svn export --username {$this->config['main']['svn_username']} --password {$this->config['main']['svn_password']} --no-auth-cache --non-interactive --force {$path} {$dir}"; $this->run($cmd);
$this->status($cmd); }
private function changeDir($dir)
`$cmd`;
if(!file_exists($filePath))
{ {
$this->status("FAIL: Couldn't retrieve zip file from github."); $this->status("Changing to dir: " . $dir);
return false; chdir($dir);
} }
$cmd = 'unzip -o '.$filePath.' -d '.$this->tempDir; private function gitArchiveUnzip($file)
$this->status($cmd);
`$cmd`;
if(!is_dir($this->tempDir."e107-master"))
{ {
$this->status("FAIL: Couldn't unzip .".$filePath. " to ".$this->tempDir); $this->status("Unzipping temp archive to export folder", true);
return false; $filepath = $this->tempDir . $file;
} $cmd = 'unzip -q -o ' . $filepath . ' -d ' . $this->exportDir;
$cmd = "mv ".$this->tempDir."e107-master ".$this->exportDir; $this->run($cmd);
$this->status($cmd);
`$cmd`;
if(!is_dir($this->exportDir))
{
$this->status("GIT Export FAILED for some reason");
}
} }
private function editVersion($dir = 'checkout') private function editVersion($dir = 'checkout')
@@ -853,7 +715,6 @@ git archive -o update.zip HEAD $(git diff --name-only 599313e986c56e5451caa14d3
} }
$fname = "{$this->config['baseDir']}/target/{$this->config['main']['name']}/" . $dir . "/e107_admin/ver.php"; $fname = "{$this->config['baseDir']}/target/{$this->config['main']['name']}/" . $dir . "/e107_admin/ver.php";
$this->status("Writing new version {$version} to ver.php in " . $dir . " directory.", true); $this->status("Writing new version {$version} to ver.php in " . $dir . " directory.", true);
@@ -873,104 +734,9 @@ git archive -o update.zip HEAD $(git diff --name-only 599313e986c56e5451caa14d3
$contents .= "?>\n"; $contents .= "?>\n";
return file_put_contents($fname, $contents); return file_put_contents($fname, $contents);
} }
private function commitFile($fname, $message="no remarks")
{
if(($this->beta == TRUE) || ($this->live != TRUE) || $this->rc)
{
return;
}
$dir = "{$this->config['baseDir']}/target/{$this->config['main']['name']}/checkout";
chdir($dir);
$cmd = "svn commit --username {$this->config['main']['svn_username']} --password {$this->config['main']['svn_password']} --no-auth-cache --non-interactive -m \"{$message}\" {$fname}";
$this->status("commiting $fname to svn");
$this->status($cmd);
return `$cmd`;
// return true;
}
private function tagFiles($tagid)
{
if(($this->beta == TRUE) || $this->live != TRUE || $this->rc)
{
return;
}
$this->status("Creating Tag of $tagid");
$cmd = "svn copy --username {$this->config['main']['svn_username']} --password {$this->config['main']['svn_password']} --no-auth-cache --non-interactive -m \"Auto creating of tag during build\" {$this->config['main']['svn_path']} {$this->config['main']['svn_tag_path']}/{$tagid}";
$this->status($cmd);
return `$cmd`;
}
private function pause($seconds)
{
if($this->pause !== true)
{
return false;
}
$this->status(" (Pausing for ".$seconds." seconds...)",true);
sleep($seconds);
}
private function createCoreImage()
{
// $dir = "{$this->config['baseDir']}/target/{$this->config['main']['name']}/export";
// $this->exportDir;
// chdir($dir);
//Delete or create any files as per config
if($this->testCoreImage != TRUE)
{
// $this->filesDelete($this->config['preprocess']['files_delete']);
// $this->filesCreate($this->config['preprocess']['files_create']);
}
//create new image file - writes directly to cvsroot
chdir($this->config['baseDir']);
$_current = $this->exportDir;
$_deprecated = "{$this->config['baseDir']}/deprecated/{$this->config['main']['name']}";
/* if(!$this->beta)
{
$_image = "{$this->config['baseDir']}/target/{$this->config['main']['name']}/checkout/e107_admin/core_image.php";
}
else
{
$_image = "{$this->config['baseDir']}/target/{$this->config['main']['name']}/export/e107_admin/core_image.php";
}
*/
if($this->testCoreImage)
{
$_image = "{$this->config['baseDir']}/test_core_image.php";
}
else
{
$_image = $this->tempDir."core_image.php";
}
$this->status("Creating new core_image.php file ({$_image})", true);
new coreImage($_current, $_deprecated, $_image);
$dir = "{$this->config['baseDir']}/target/{$this->config['main']['name']}/export";
chdir($dir);
}
private function filesCreate($parm) private function filesCreate($parm)
{ {
$fnames = explode(",", $parm); $fnames = explode(",", $parm);
@@ -1041,7 +807,6 @@ git archive -o update.zip HEAD $(git diff --name-only 599313e986c56e5451caa14d3
// $result = rename($dir,$temp); // $result = rename($dir,$temp);
// $cmd = ($restore == false) ? "mv {$dir} {$temp}" : "mv {$temp} {$dir}";; // $cmd = ($restore == false) ? "mv {$dir} {$temp}" : "mv {$temp} {$dir}";;
// $this->status($cmd); // $this->status($cmd);
$this->rmdir($dir); $this->rmdir($dir);
@@ -1057,8 +822,83 @@ git archive -o update.zip HEAD $(git diff --name-only 599313e986c56e5451caa14d3
} }
} }
private function createCoreImage()
{
// $dir = "{$this->config['baseDir']}/target/{$this->config['main']['name']}/export";
// $this->exportDir;
// chdir($dir);
//Delete or create any files as per config
if ($this->testCoreImage != TRUE)
{
// $this->filesDelete($this->config['preprocess']['files_delete']);
// $this->filesCreate($this->config['preprocess']['files_create']);
}
//create new image file - writes directly to cvsroot
chdir($this->config['baseDir']);
$_current = $this->exportDir;
$_deprecated = "{$this->config['baseDir']}/deprecated/{$this->config['main']['name']}";
/* if(!$this->beta)
{
$_image = "{$this->config['baseDir']}/target/{$this->config['main']['name']}/checkout/e107_admin/core_image.php";
}
else
{
$_image = "{$this->config['baseDir']}/target/{$this->config['main']['name']}/export/e107_admin/core_image.php";
}
*/
if ($this->testCoreImage)
{
$_image = "{$this->config['baseDir']}/test_core_image.php";
}
else
{
$_image = $this->tempDir . "core_image.php";
}
$this->status("Creating new core_image.php file ({$_image})", true);
new coreImage($_current, $_deprecated, $_image);
$dir = "{$this->config['baseDir']}/target/{$this->config['main']['name']}/export";
chdir($dir);
}
private function pause($seconds)
{
if ($this->pause !== true)
{
return false;
}
$this->status(" (Pausing for " . $seconds . " seconds...)", true);
sleep($seconds);
}
private function copyCoreImage()
{
$orig = $this->tempDir . "core_image.php";
$dest = $this->exportDir . "e107_admin/core_image.php";
if (!file_exists($orig))
{
$this->status("ERROR: Image file not found");
}
$this->status("Copying Core Image into export directory", true);
$this->run("/bin/cp -rf " . $orig . " " . $dest);
if (!file_exists($dest))
{
$this->status("ERROR: Image file didnt copy.");
}
}
private function moveReadme($readme) private function moveReadme($readme)
{ {
@@ -1068,30 +908,14 @@ git archive -o update.zip HEAD $(git diff --name-only 599313e986c56e5451caa14d3
$this->status("Copying readme file $readme to $to - " . ($result ? "SUCCESS" : "FAIL")); $this->status("Copying readme file $readme to $to - " . ($result ? "SUCCESS" : "FAIL"));
} }
private function status($msg, $heading = false) public function coreImageTest()
{ {
if($heading == false) //$this->checkoutSvn();
{ //Export files to export dir
echo date('m/d/Y h:i:s').' '; //$this->exportSvn();
$this->CreateCoreImage();
} }
if($heading != false)
{
echo "\n\n>>>> ";
}
echo $msg."\n";
if($heading != false)
{
echo "\n";
}
}
function deleteAll($directory, $empty = false) function deleteAll($directory, $empty = false)
{ {
if (substr($directory, -1) == "/") if (substr($directory, -1) == "/")
@@ -1142,8 +966,127 @@ git archive -o update.zip HEAD $(git diff --name-only 599313e986c56e5451caa14d3
} }
} }
private function checkoutSvn()
{
return false;
if ($this->beta)
{
$this->status("Beta Mode - skipping svn checkout");
return;
}
$dir = "{$this->config['baseDir']}/target/{$this->config['main']['name']}/checkout";
$this->status("Checking out current svn to {$dir}");
$cmd = "svn checkout --username {$this->config['main']['svn_username']} --password {$this->config['main']['svn_password']} --no-auth-cache --non-interactive {$this->config['main']['svn_path']} {$dir}";
$this->status($cmd);
`$cmd`;
}
private function exportSvn($tag = '')
{
if (is_dir($this->exportDir))
{
$this->status("Cleaning out export directory. ");
$this->rmdir($this->exportDir);
}
if (is_dir($this->tempDir))
{
$this->status("Cleaning out temp directory. ");
$this->rmdir($this->tempDir);
mkdir($this->tempDir, 0755);
}
$this->status("Exporting from Github to temp directory ");
/*
if($tag == '')
{
$this->status("Exporting current svn to {$dir}");
$path = $this->config['main']['svn_path'];
}
else
{
$this->status("Exporting tag {$tag} to {$dir}");
$path = "{$this->config['main']['svn_tag_path']}/{$tag}";
}
*/
$filePath = $this->tempDir . "master.zip";
$cmd = 'wget https://codeload.github.com/e107inc/e107/zip/master -O ' . $filePath; // , 'e107-master.zip', 'temp');
// $cmd = "svn export --username {$this->config['main']['svn_username']} --password {$this->config['main']['svn_password']} --no-auth-cache --non-interactive --force {$path} {$dir}";
$this->status($cmd);
`$cmd`;
if (!file_exists($filePath))
{
$this->status("FAIL: Couldn't retrieve zip file from github.");
return false;
}
$cmd = 'unzip -o ' . $filePath . ' -d ' . $this->tempDir;
$this->status($cmd);
`$cmd`;
if (!is_dir($this->tempDir . "e107-master"))
{
$this->status("FAIL: Couldn't unzip ." . $filePath . " to " . $this->tempDir);
return false;
}
$cmd = "mv " . $this->tempDir . "e107-master " . $this->exportDir;
$this->status($cmd);
`$cmd`;
if (!is_dir($this->exportDir))
{
$this->status("GIT Export FAILED for some reason");
}
}
private function commitFile($fname, $message = "no remarks")
{
if (($this->beta == TRUE) || ($this->live != TRUE) || $this->rc)
{
return;
}
$dir = "{$this->config['baseDir']}/target/{$this->config['main']['name']}/checkout";
chdir($dir);
$cmd = "svn commit --username {$this->config['main']['svn_username']} --password {$this->config['main']['svn_password']} --no-auth-cache --non-interactive -m \"{$message}\" {$fname}";
$this->status("commiting $fname to svn");
$this->status($cmd);
return `$cmd`;
// return true;
}
private function tagFiles($tagid)
{
if (($this->beta == TRUE) || $this->live != TRUE || $this->rc)
{
return;
}
$this->status("Creating Tag of $tagid");
$cmd = "svn copy --username {$this->config['main']['svn_username']} --password {$this->config['main']['svn_password']} --no-auth-cache --non-interactive -m \"Auto creating of tag during build\" {$this->config['main']['svn_path']} {$this->config['main']['svn_tag_path']}/{$tagid}";
$this->status($cmd);
return `$cmd`;
}
} }
@@ -1151,7 +1094,6 @@ git archive -o update.zip HEAD $(git diff --name-only 599313e986c56e5451caa14d3
/***************************************************************************************** /*****************************************************************************************
****************************************************************************************** ******************************************************************************************
******************************************************************************************/ ******************************************************************************************/
class coreImage class coreImage
{ {
@@ -1246,7 +1188,8 @@ class coreImage
fwrite($fp, $data); fwrite($fp, $data);
} }
function scan($dir, $image = array()) { function scan($dir, $image = array())
{
// echo "Scanning directory $dir \n"; // echo "Scanning directory $dir \n";
$handle = opendir($dir . '/'); $handle = opendir($dir . '/');
@@ -1254,27 +1197,35 @@ class coreImage
while (false !== ($readdir = readdir($handle))) while (false !== ($readdir = readdir($handle)))
{ {
if ($readdir != '.' && $readdir != '..' && $readdir != '/' && !in_array($readdir,$exclude) && (strpos('._', $readdir) === FALSE)) { if ($readdir != '.' && $readdir != '..' && $readdir != '/' && !in_array($readdir, $exclude) && (strpos('._', $readdir) === FALSE))
{
$path = $dir . '/' . $readdir; $path = $dir . '/' . $readdir;
if (is_dir($path)) { if (is_dir($path))
{
$dirs[$path] = $readdir; $dirs[$path] = $readdir;
} else if (!isset($image[$readdir])) { }
else if (!isset($image[$readdir]))
{
$files[$readdir] = $this->checksum($path, TRUE); $files[$readdir] = $this->checksum($path, TRUE);
} }
} }
} }
closedir($handle); closedir($handle);
if (isset($dirs)) { if (isset($dirs))
{
ksort($dirs); ksort($dirs);
foreach ($dirs as $dir_path => $dir_list) { foreach ($dirs as $dir_path => $dir_list)
{
$list[$dir_list] = ($set = $this->scan($dir_path, $image[$dir_list])) ? $set : array(); $list[$dir_list] = ($set = $this->scan($dir_path, $image[$dir_list])) ? $set : array();
} }
} }
if (isset($files)) { if (isset($files))
{
ksort($files); ksort($files);
foreach ($files as $file_name => $file_list) { foreach ($files as $file_name => $file_list)
{
$list[$file_name] = $file_list; $list[$file_name] = $file_list;
} }
} }
@@ -1282,10 +1233,9 @@ class coreImage
return $list; return $list;
} }
function checksum($filename) { function checksum($filename)
{
$checksum = md5(str_replace(array(chr(13), chr(10)), '', file_get_contents($filename))); $checksum = md5(str_replace(array(chr(13), chr(10)), '', file_get_contents($filename)));
return $checksum; return $checksum;
} }
} }