Skip to content

Commit

Permalink
Merge branch 'master' into feature/integrate-recaptcha-plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
mystralkk committed Dec 2, 2017
2 parents b63192a + cde5e9f commit d558aed
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 6 deletions.
2 changes: 1 addition & 1 deletion language/english.php
Expand Up @@ -1554,7 +1554,7 @@
153 => 'You last emailed an article %1$d seconds ago. This site requires at least %2$d seconds between emailing articles.',
400 => 'Not all required fields have been passed validation', // Error codes in the 400 range reserved for CUSTOM membership
401 => 'Please enter Fullname',
500 => 'The Template Cache has been successfully cleared.'
500 => 'The Data, Template, Resource, and File Manager Cache has been successfully cleared.'
);

###############################################################################
Expand Down
2 changes: 1 addition & 1 deletion language/english_utf-8.php
Expand Up @@ -1555,7 +1555,7 @@
153 => 'You last emailed an article %1$d seconds ago. This site requires at least %2$d seconds between emailing articles.',
400 => 'Not all required fields have been passed validation', // Error codes in the 400 range reserved for CUSTOM membership
401 => 'Please enter Fullname',
500 => 'The Template Cache has been successfully cleared.'
500 => 'The Data, Template, Resource, and File Manager Cache has been successfully cleared.'
);

###############################################################################
Expand Down
2 changes: 1 addition & 1 deletion language/japanese_utf-8.php
Expand Up @@ -1556,7 +1556,7 @@
153 => 'あなたは %1$d 秒前に友だちに記事を送信しています。次に送信する前に %2$d 秒以上あけてください。',
400 => '検証に通っていない必須のフィールドがあります。',
401 => '氏名を入力してください。',
500 => 'テンプレートのキャッシュを削除しました。'
500 => 'The Data, Template, Resource, and File Manager Cache has been successfully cleared.'
);

###############################################################################
Expand Down
63 changes: 61 additions & 2 deletions public_html/admin/clearctl.php
Expand Up @@ -40,12 +40,71 @@
exit;
}

// Clean directory
function clean_directory($dir, $leave_dirs = array(), $leave_files = array()) {

foreach( glob("$dir/*") as $file ) {
if (is_dir($file)) {
if (!in_array(basename($file), $leave_dirs)) {
delete_files($file); // delete all sub directories and files in those directories
}
} elseif( !in_array(basename($file), $leave_files) ) {
unlink($file);
}
}
}

// Delete all files in a directory and any sub directory
function delete_files($dir) {

foreach(glob($dir . '/*') as $file) {
if (is_dir($file)) {
delete_files($file);
} else {
unlink($file);
}
}
rmdir($dir);
}

/*
* Main processing
*/
CTL_clearCache(); // Clearing Template Cache

// Clearing Theme Template Cache
CTL_clearCache();

// Clearing Resource Cache (CSS, and Javascript concatenated and minified files)
Geeklog\Cache::clear();

// Clean out Data directory (includes things like temp uploaded plugin files, user batch files, etc...)
$leave_dirs = array('cache', 'layout_cache', 'layout_css');
$leave_files = array('cacert.pem', 'README');
clean_directory($_CONF['path_data'], $leave_dirs, $leave_files);

// Clean out File Manager Thumbnail Files
$leave_dirs = array();
$leave_files = array('index.html');
clean_directory($_CONF['path_images'] . '_thumbs/articles/', $leave_dirs, $leave_files);

$leave_dirs = array();
$leave_files = array('index.html');
clean_directory($_CONF['path_images'] . '_thumbs/userphotos/', $leave_dirs, $leave_files);

$leave_dirs = array();
$leave_files = array('index.html');
clean_directory($_CONF['path_images'] . '_thumbs/library/image/', $leave_dirs, $leave_files);

$leave_dirs = array('Image');
$leave_files = array();
clean_directory($_CONF['path_images'] . '_thumbs/library/', $leave_dirs, $leave_files);

$leave_dirs = array('articles', 'library', 'userphotos');
$leave_files = array();
clean_directory($_CONF['path_images'] . '_thumbs/', $leave_dirs, $leave_files);

Geeklog\Cache::clear(); // Clearing Resource Cache (CSS, and Javascript concatenated and minified files)
// Allow Plugins to clear any cached items
PLG_clearCache();

COM_redirect($_CONF['site_admin_url'] . '/index.php?msg=500');

2 changes: 1 addition & 1 deletion public_html/admin/install/devel-db-update.php
Expand Up @@ -74,7 +74,7 @@ function update_DatabaseFor220()
$_SQL[] = "ALTER TABLE {$_TABLES['storysubmission']} ADD `meta_keywords` TEXT NULL AFTER `meta_description`";

// Add `status_code` column to the `routes` table
$_SQL[] = "ALTER TABLE {$_TABLES['routes']} ADD `status_code` INT(11) NOT NULL DEFAULT 302 AFTER `route`";
$_SQL[] = "ALTER TABLE {$_TABLES['routes']} ADD `status_code` INT NOT NULL DEFAULT 200 AFTER `route`";

// Add `css_id` and `css_classes` columns to the `blocks` table
$_SQL[] = "ALTER TABLE {$_TABLES['blocks']} ADD `css_id` VARCHAR(255) NOT NULL DEFAULT '' AFTER `help`";
Expand Down
21 changes: 21 additions & 0 deletions system/lib-plugins.php
Expand Up @@ -2315,6 +2315,27 @@ function PLG_getItemInfo($type, $id, $what, $uid = 0, $options = array())
return PLG_callFunctionForOnePlugin($function, $args);
}

/**
* Asks each plugin tif they want to clear any cache of files they control
* Used by clear cache in Geeklog Administration
*
* @return array Plugins that cleared their cache files and if they where successful or not
*/
function PLG_clearCache()
{
global $_PLUGINS;

$plugin_cache_name = array();
foreach ($_PLUGINS as $pi_name) {
$function = 'plugin_clearcache_' . $pi_name;
if (function_exists($function)) {
$plugin_cache_name[$pi_name] = $function(); // Should return true if success
}
}

return $plugin_cache_name;
}

/**
* Geeklog is about to perform an operation on a trackback or pingback comment
* to one of the items under the plugin's control and asks for the plugin's
Expand Down

0 comments on commit d558aed

Please sign in to comment.