mirror of
https://github.com/e107inc/e107.git
synced 2025-08-04 13:47:31 +02:00
Clear DB cache before e107_update and some cleanup in admin->cache code.
This commit is contained in:
@@ -34,7 +34,7 @@ include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_'.e_PAGE);
|
|||||||
$e_sub_cat = 'cache';
|
$e_sub_cat = 'cache';
|
||||||
|
|
||||||
require_once("auth.php");
|
require_once("auth.php");
|
||||||
$ec = e107::getCache();
|
|
||||||
$frm = e107::getForm();
|
$frm = e107::getForm();
|
||||||
|
|
||||||
$emessage = eMessage::getInstance();
|
$emessage = eMessage::getInstance();
|
||||||
@@ -65,38 +65,38 @@ if (isset($_POST['trigger_empty_cache']))
|
|||||||
switch ($_POST['option_clear_cache'])
|
switch ($_POST['option_clear_cache'])
|
||||||
{
|
{
|
||||||
case 'empty_contentcache':
|
case 'empty_contentcache':
|
||||||
$ec->clear();
|
e107::getCache()->clearAll('content');
|
||||||
e107::getAdminLog()->flushMessages(CACLAN_5);
|
e107::getAdminLog()->flushMessages(CACLAN_5);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'empty_syscache':
|
case 'empty_syscache':
|
||||||
$ec->clear_sys();
|
e107::getCache()->clearAll('system');
|
||||||
e107::getAdminLog()->flushMessages(CACLAN_16);
|
e107::getAdminLog()->flushMessages(CACLAN_16);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'empty_dbcache':
|
case 'empty_dbcache':
|
||||||
admin_page_cache_erase(e_CACHE_DB, '*.php');
|
e107::getCache()->clearAll('db');
|
||||||
e107::getAdminLog()->flushMessages(CACLAN_24);
|
e107::getAdminLog()->flushMessages(CACLAN_24);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'empty_imgcache':
|
case 'empty_imgcache':
|
||||||
admin_page_cache_erase(e_CACHE_IMAGE, '*.cache\.bin');
|
e107::getCache()->clearAll('image');
|
||||||
e107::getAdminLog()->flushMessages(CACLAN_25);
|
e107::getAdminLog()->flushMessages(CACLAN_25);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// used in standard page output and internal JS includes
|
// used in standard page output and internal JS includes
|
||||||
case 'empty_browsercache':
|
case 'empty_browsercache':
|
||||||
e107::getConfig()->set('e_jslib_browser_cache', time())->save(false);
|
e107::getCache()->clearAll('browser');
|
||||||
e107::getAdminLog()->flushMessages(CACLAN_25);
|
e107::getAdminLog()->flushMessages(CACLAN_25);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// all
|
// all
|
||||||
default:
|
default:
|
||||||
$ec->clear();
|
e107::getCache()->clearAll('content');
|
||||||
$ec->clear_sys();
|
e107::getCache()->clearAll('system');
|
||||||
admin_page_cache_erase(e_CACHE_DB, '*.php');
|
e107::getCache()->clearAll('db');
|
||||||
admin_page_cache_erase(e_CACHE_IMAGE, '*.cache\.bin');
|
e107::getCache()->clearAll('image');
|
||||||
e107::getConfig()->set('e_jslib_browser_cache', time())->save(false);
|
e107::getCache()->clearAll('browser');
|
||||||
e107::getAdminLog()->flushMessages(CACLAN_26);
|
e107::getAdminLog()->flushMessages(CACLAN_26);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -196,22 +196,4 @@ e107::getRender()->tablerender(CACLAN_3, $emessage->render().$text);
|
|||||||
|
|
||||||
require_once("footer.php");
|
require_once("footer.php");
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $path
|
|
||||||
* @param string $mask
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
function admin_page_cache_erase($path, $mask)
|
|
||||||
{
|
|
||||||
$fl = e107::getFile(false);
|
|
||||||
$fl->mode = 'fname';
|
|
||||||
$files = $fl->get_files($path, $fmask);
|
|
||||||
if($files)
|
|
||||||
{
|
|
||||||
foreach ($files as $file)
|
|
||||||
{
|
|
||||||
unlink($path.$file);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
?>
|
@@ -273,6 +273,8 @@ function update_706_to_800($type='')
|
|||||||
$sql = e107::getDb();
|
$sql = e107::getDb();
|
||||||
$sql2 = e107::getDb('sql2');
|
$sql2 = e107::getDb('sql2');
|
||||||
$tp = e107::getParser();
|
$tp = e107::getParser();
|
||||||
|
|
||||||
|
e107::getCache()->clearAll('db');
|
||||||
|
|
||||||
// List of unwanted $pref values which can go
|
// List of unwanted $pref values which can go
|
||||||
$obs_prefs = array('frontpage_type','rss_feeds', 'log_lvcount', 'zone', 'upload_allowedfiletype', 'real', 'forum_user_customtitle',
|
$obs_prefs = array('frontpage_type','rss_feeds', 'log_lvcount', 'zone', 'upload_allowedfiletype', 'real', 'forum_user_customtitle',
|
||||||
@@ -1033,23 +1035,15 @@ function update_706_to_800($type='')
|
|||||||
if($count != 1)
|
if($count != 1)
|
||||||
{
|
{
|
||||||
if ($just_check) return update_needed('Add Media-Manager Categories and Import existing images.');
|
if ($just_check) return update_needed('Add Media-Manager Categories and Import existing images.');
|
||||||
|
|
||||||
$query = "INSERT INTO `".MPREFIX."core_media_cat` (`media_cat_id`, `media_cat_owner`, `media_cat_title`, `media_cat_diz`, `media_cat_class`) VALUES
|
|
||||||
(1, '_common', '_common', '(Common Area)', 'Media in this category will be available in all areas of admin. ', 253, '', 0),
|
|
||||||
(2, 'news', 'news', 'News', 'Will be available in the news area. ', 253, '', 0),
|
|
||||||
(3, 'page', 'page', 'Custom Pages', 'Available in the custom pages area of admin. ', 253, '', 0),
|
|
||||||
(4, 'gallery', 'gallery_1', 'Gallery 1', 'Available to the public at /gallery.php ', 0, '', 0),
|
|
||||||
(5, 'download', 'thumb', 'Download Thumbnails', 'Available to the downloads plugin', 253, '', 0),
|
|
||||||
(6, 'download', 'image', 'Download Images', 'Available to the downloads plugin', 253, '', 0),
|
|
||||||
(7, '_icon', '_icon_16', 'Icons 16px', 'Available where icons are used in admin. ', 253, '', 0),
|
|
||||||
(8, '_icon', '_icon_32', 'Icons 32px', 'Available where icons are used in admin. ', 253, '', 0),
|
|
||||||
(9, '_icon', '_icon_48', 'Icons 48px', 'Available where icons are used in admin. ', 253, '', 0),
|
|
||||||
(10, '_icon', '_icon_64', 'Icons 64px', 'Available where icons are used in admin. ', 253, '', 0);
|
|
||||||
|
|
||||||
";
|
|
||||||
|
|
||||||
mysql_query($query);
|
|
||||||
|
|
||||||
|
|
||||||
|
mysql_query("INSERT INTO `".MPREFIX."core_media_cat` VALUES(0, '_common', '_common', '(Common Area)', 'Media in this category will be available in all areas of admin. ', 253, '', 0);");
|
||||||
|
mysql_query("INSERT INTO `".MPREFIX."core_media_cat` VALUES(0, 'news', 'news', 'News', 'Will be available in the news area. ', 253, '', 1);");
|
||||||
|
mysql_query("INSERT INTO `".MPREFIX."core_media_cat` VALUES(0, 'page', 'page', 'Custom Pages', 'Will be available in the custom pages area of admin. ', 253, '', 0);");
|
||||||
|
mysql_query("INSERT INTO `".MPREFIX."core_media_cat` VALUES(0, 'download', 'download_image', 'Download Images', '', 253, '', 0);");
|
||||||
|
mysql_query("INSERT INTO `".MPREFIX."core_media_cat` VALUES(0, 'download', 'download_thumb', 'Download Thumbnails', '', 253, '', 0);");
|
||||||
|
mysql_query("INSERT INTO `".MPREFIX."core_media_cat` VALUES(0, 'gallery', 'gallery_1', 'Gallery', 'Visible to the public at /gallery.php', 0, '', 0);");
|
||||||
|
|
||||||
$med->import('news_thumb', e_IMAGE.'newspost_images',"^thumb_");
|
$med->import('news_thumb', e_IMAGE.'newspost_images',"^thumb_");
|
||||||
$med->import('news',e_IMAGE.'newspost_images');
|
$med->import('news',e_IMAGE.'newspost_images');
|
||||||
$med->import('page',e_IMAGE.'custom');
|
$med->import('page',e_IMAGE.'custom');
|
||||||
|
@@ -264,4 +264,65 @@ class ecache {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Clear Full Catche
|
||||||
|
/**
|
||||||
|
* @param string $type: content | system| browser | db | image
|
||||||
|
* @example clearAll('db');
|
||||||
|
*/
|
||||||
|
|
||||||
|
function clearAll($type)
|
||||||
|
{
|
||||||
|
|
||||||
|
$path = null;
|
||||||
|
$mask = null;
|
||||||
|
|
||||||
|
if($type =='content')
|
||||||
|
{
|
||||||
|
$this->clear();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($type == 'system')
|
||||||
|
{
|
||||||
|
$this->clear_sys();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($type == 'browser')
|
||||||
|
{
|
||||||
|
e107::getConfig()->set('e_jslib_browser_cache', time())->save(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($type == 'db')
|
||||||
|
{
|
||||||
|
$path = e_CACHE_DB;
|
||||||
|
$mask = '*.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
if($type == 'image')
|
||||||
|
{
|
||||||
|
$path = e_CACHE_IMAGE;
|
||||||
|
$mask = '*.cache\.bin';
|
||||||
|
}
|
||||||
|
|
||||||
|
if((null == $path) || (null == $mask))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$fl = e107::getFile(false);
|
||||||
|
$fl->mode = 'fname';
|
||||||
|
$files = $fl->get_files($path, $fmask);
|
||||||
|
if($files)
|
||||||
|
{
|
||||||
|
foreach ($files as $file)
|
||||||
|
{
|
||||||
|
unlink($path.$file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -30,7 +30,7 @@ class e_media
|
|||||||
* @param string $fmask [optional] filetypes eg. .jpg|.gif
|
* @param string $fmask [optional] filetypes eg. .jpg|.gif
|
||||||
* @return e_media
|
* @return e_media
|
||||||
*/
|
*/
|
||||||
public function import($cat,$epath,$fmask='')
|
public function import($cat='',$epath,$fmask='')
|
||||||
{
|
{
|
||||||
if(!vartrue($cat)){ return $this;}
|
if(!vartrue($cat)){ return $this;}
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ class e_media
|
|||||||
foreach($img_array as $f)
|
foreach($img_array as $f)
|
||||||
{
|
{
|
||||||
$fullpath = $tp->createConstants($f['path'].$f['fname'],1);
|
$fullpath = $tp->createConstants($f['path'].$f['fname'],1);
|
||||||
|
// echo "<br />cat=".$cat;
|
||||||
$insert = array(
|
$insert = array(
|
||||||
'media_caption' => $f['fname'],
|
'media_caption' => $f['fname'],
|
||||||
'media_description' => '',
|
'media_description' => '',
|
||||||
@@ -79,6 +79,7 @@ class e_media
|
|||||||
|
|
||||||
if(!$sql->db_Select('core_media','media_url',"media_url = '".$fullpath."' LIMIT 1"))
|
if(!$sql->db_Select('core_media','media_url',"media_url = '".$fullpath."' LIMIT 1"))
|
||||||
{
|
{
|
||||||
|
|
||||||
if($sql->db_Insert("core_media",$insert))
|
if($sql->db_Insert("core_media",$insert))
|
||||||
{
|
{
|
||||||
$mes->addSuccess("Imported Media: ".$f['fname']);
|
$mes->addSuccess("Imported Media: ".$f['fname']);
|
||||||
|
@@ -132,8 +132,8 @@ class gallery_cat_admin_ui extends e_admin_ui
|
|||||||
'slideshow_auto' => array('title'=> 'Slide auto-start', 'type'=>'boolean', 'data' => 'integer','help' => 'When enabled image-rotation begins automatically when the page is loaded.'),
|
'slideshow_auto' => array('title'=> 'Slide auto-start', 'type'=>'boolean', 'data' => 'integer','help' => 'When enabled image-rotation begins automatically when the page is loaded.'),
|
||||||
'slideshow_freq' => array('title'=> 'Slide frequency', 'type' => 'number', 'data' => 'integer', 'help'=>'When auto-start is enabled, this dictates how long a slides stays put before the next jump. '), // 'validate' => 'regex', 'rule' => '#^[\d]+$#i', 'help' => 'allowed characters are a-zA-Z and underscore')),
|
'slideshow_freq' => array('title'=> 'Slide frequency', 'type' => 'number', 'data' => 'integer', 'help'=>'When auto-start is enabled, this dictates how long a slides stays put before the next jump. '), // 'validate' => 'regex', 'rule' => '#^[\d]+$#i', 'help' => 'allowed characters are a-zA-Z and underscore')),
|
||||||
'slideshow_circular' => array('title'=> 'Slide circular-mode', 'type' => 'boolean', 'data' => 'integer', 'help'=>'By default when the first/last slide is reached, calling prev/next does nothing. If you want the effect to continue enable this option.'), //
|
'slideshow_circular' => array('title'=> 'Slide circular-mode', 'type' => 'boolean', 'data' => 'integer', 'help'=>'By default when the first/last slide is reached, calling prev/next does nothing. If you want the effect to continue enable this option.'), //
|
||||||
'slideshow_effect' => array('title'=> 'Slide Effect', 'type' => 'dropdown', 'data' => 'str', 'help'=>'Type of effect. '), //
|
'slideshow_effect' => array('title'=> 'Slide effect', 'type' => 'dropdown', 'data' => 'str', 'help'=>'Type of effect. '), //
|
||||||
'slideshow_transition' => array('title'=> 'Slide Transition', 'type' => 'dropdown', 'data' => 'str', 'help'=>'Type of transition. ') //
|
'slideshow_transition' => array('title'=> 'Slide transition', 'type' => 'dropdown', 'data' => 'str', 'help'=>'Type of transition. ') //
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user