mirror of
https://github.com/e107inc/e107.git
synced 2025-07-31 11:50:30 +02:00
Support for automated git sync with a theme repo.
This commit is contained in:
@@ -173,6 +173,19 @@ class cron_admin_ui extends e_admin_ui
|
|||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(is_dir(e_THEME.$pref['sitetheme']."/.git"))
|
||||||
|
{
|
||||||
|
$cronDefaults['_system'][8] = array(
|
||||||
|
'name' => LAN_CRON_65,
|
||||||
|
'category' => 'update',
|
||||||
|
'function' => 'gitrepoTheme',
|
||||||
|
'description' => LAN_CRON_20_6."<br /><span class='label label-warning'>".LAN_WARNING."</span> ".LAN_CRON_20_8,
|
||||||
|
// 'available' => e107::getPref('ban_retrigger')
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -63,6 +63,39 @@ class _system_cron
|
|||||||
$fl->chmod(e_BASE."cron.php",0755);
|
$fl->chmod(e_BASE."cron.php",0755);
|
||||||
$fl->chmod(e_HANDLER."bounce_handler.php",0755);
|
$fl->chmod(e_HANDLER."bounce_handler.php",0755);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the current Theme Repo
|
||||||
|
* When using private repos on Github, you'll need to get a personal access token @see https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line
|
||||||
|
* (with 'repo' access) and then modify the .git/config file :
|
||||||
|
* @example:
|
||||||
|
* [remote "origin"]
|
||||||
|
* url = https://[TOKEN]@github.com/[USER]/[REPO].git
|
||||||
|
*/
|
||||||
|
function gitrepoTheme()
|
||||||
|
{
|
||||||
|
$mes = e107::getMessage();
|
||||||
|
$fl = e107::getFile();
|
||||||
|
$theme = e107::getPref('sitetheme');
|
||||||
|
|
||||||
|
if(is_dir(e_THEME.$theme."/.git")) // Check it's a Git Repo
|
||||||
|
{
|
||||||
|
$return = $fl->gitPull($theme, 'theme');
|
||||||
|
|
||||||
|
$mes->addSuccess($return);
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$mes->addError("No git repo found in theme folder"); //TODO LAN
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1471,17 +1471,20 @@ class e_file
|
|||||||
$cmd3 = 'cd '.$dir.'; '.$gitPath.' pull'; // Run Pull request
|
$cmd3 = 'cd '.$dir.'; '.$gitPath.' pull'; // Run Pull request
|
||||||
|
|
||||||
|
|
||||||
// $mes->addDebug($cmd1);
|
|
||||||
|
$text = '';
|
||||||
|
|
||||||
|
|
||||||
$mes->addDebug($cmd2);
|
$mes->addDebug($cmd2);
|
||||||
$mes->addDebug($cmd3);
|
$mes->addDebug($cmd3);
|
||||||
|
|
||||||
// return false;
|
|
||||||
|
|
||||||
// $text = `$cmd1 2>&1`;
|
// $text = `$cmd1 2>&1`;
|
||||||
$text = `$cmd2 2>&1`;
|
$text .= `$cmd2 2>&1`;
|
||||||
$text .= `$cmd3 2>&1`;
|
$text .= `$cmd3 2>&1`;
|
||||||
|
|
||||||
if(deftrue('e_DEBUG'))
|
|
||||||
|
|
||||||
|
if(deftrue('e_DEBUG') || deftrue('e_GIT_DEBUG'))
|
||||||
{
|
{
|
||||||
$message = date('r')."\t\tgitPull()\t\t".$text;
|
$message = date('r')."\t\tgitPull()\t\t".$text;
|
||||||
file_put_contents(e_LOG."fileClass.log",$message,FILE_APPEND);
|
file_put_contents(e_LOG."fileClass.log",$message,FILE_APPEND);
|
||||||
|
@@ -104,3 +104,5 @@ define("LAN_CRON_BACKUP", "Backup");
|
|||||||
define("LAN_CRON_LOGGING", "Logging");
|
define("LAN_CRON_LOGGING", "Logging");
|
||||||
define("LAN_CRON_RUNNING", "Running");
|
define("LAN_CRON_RUNNING", "Running");
|
||||||
|
|
||||||
|
define("LAN_CRON_65", "Update git theme repository");
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user