Welcome to Geeklog, Anonymous Monday, September 16 2024 @ 04:08 am EDT
Geeklog Forums
Wamp to Github
Status: offline
::Ben
Forum User
Full Member
Registered: 01/14/05
Posts: 1569
Location:la rochelle, France
I'm creating and testing plugins for Geeklog CMS with WAMP. As files for a plugin are store in 3 directories (plugins, public_html, admin) I wrote a function to copy all new or modified files and folders to a unique folder. And from this folder I can push to Github.
Customize this code for your needs and put it in your system/lib-custom.php file
// Geeklog CMS - Copy plugins to external folder if files are new
global $_PLUGINS;
// List of plugins you want to copy
$github_plugins = array('test','captcha');
foreach ($_PLUGINS as $plugin) {
if (!in_array($plugin, $github_plugins)) continue;
//Sources in plugins folder
$src = $_CONF['path'] . 'plugins/' . $plugin;
//Customize your destination
$dst = "c:/plugins/$plugin";
CUSTOM_recurse_copy($src, $dst);
//Sources in public_html folder
$src = $_CONF['path_html'] . $plugin;
//Customize your destination
$dst = "c:/plugins/$plugin/public_html";
CUSTOM_recurse_copy($src, $dst);
//Sources in admin folder
$src = $_CONF['path_html'] . 'admin/plugins/' . $plugin;
//Customize your destination
$dst = "c:/plugins/$plugin/admin";
CUSTOM_recurse_copy($src, $dst);
}
function CUSTOM_recurse_copy($src,$dst) {
//Uncomment this line if you do not need to copy files
//return;
global $_CONF;
if (is_dir($src)) {
$dir = opendir($src);
if (!is_dir($dst)) mkdir($dst);
while(false !== ( $file = readdir($dir)) ) {
if (( $file != '.' ) && ( $file != '..' )) {
if ( is_dir($src . '/' . $file) ) {
CUSTOM_recurse_copy( $src . '/' . $file, $dst . '/' . $file);
}
else {
//Check if source is newer
if ( file_exists($dst . '/' . $file) ) {
if ( filemtime($dst . '/' . $file) < filemtime($src . '/' . $file) ) copy($src . '/' . $file, $dst . '/' . $file);
} else {
copy($src . '/' . $file, $dst . '/' . $file);
}
}
}
}
closedir($dir);
}
}
I'm available to customise your themes or plugins for your Geeklog CMS
Customize this code for your needs and put it in your system/lib-custom.php file
Text Formatted Code
// Geeklog CMS - Copy plugins to external folder if files are new
global $_PLUGINS;
// List of plugins you want to copy
$github_plugins = array('test','captcha');
foreach ($_PLUGINS as $plugin) {
if (!in_array($plugin, $github_plugins)) continue;
//Sources in plugins folder
$src = $_CONF['path'] . 'plugins/' . $plugin;
//Customize your destination
$dst = "c:/plugins/$plugin";
CUSTOM_recurse_copy($src, $dst);
//Sources in public_html folder
$src = $_CONF['path_html'] . $plugin;
//Customize your destination
$dst = "c:/plugins/$plugin/public_html";
CUSTOM_recurse_copy($src, $dst);
//Sources in admin folder
$src = $_CONF['path_html'] . 'admin/plugins/' . $plugin;
//Customize your destination
$dst = "c:/plugins/$plugin/admin";
CUSTOM_recurse_copy($src, $dst);
}
function CUSTOM_recurse_copy($src,$dst) {
//Uncomment this line if you do not need to copy files
//return;
global $_CONF;
if (is_dir($src)) {
$dir = opendir($src);
if (!is_dir($dst)) mkdir($dst);
while(false !== ( $file = readdir($dir)) ) {
if (( $file != '.' ) && ( $file != '..' )) {
if ( is_dir($src . '/' . $file) ) {
CUSTOM_recurse_copy( $src . '/' . $file, $dst . '/' . $file);
}
else {
//Check if source is newer
if ( file_exists($dst . '/' . $file) ) {
if ( filemtime($dst . '/' . $file) < filemtime($src . '/' . $file) ) copy($src . '/' . $file, $dst . '/' . $file);
} else {
copy($src . '/' . $file, $dst . '/' . $file);
}
}
}
}
closedir($dir);
}
}
I'm available to customise your themes or plugins for your Geeklog CMS
38
19
Quote
All times are EDT. The time is now 04:08 am.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content