当前位置: 首页>>代码示例>>PHP>>正文


PHP gpFiles::RmAll方法代码示例

本文整理汇总了PHP中gpFiles::RmAll方法的典型用法代码示例。如果您正苦于以下问题:PHP gpFiles::RmAll方法的具体用法?PHP gpFiles::RmAll怎么用?PHP gpFiles::RmAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gpFiles的用法示例。


在下文中一共展示了gpFiles::RmAll方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: DeleteTheme

 /**
  * Delete a remote theme
  *
  */
 function DeleteTheme()
 {
     global $langmessage, $dataDir, $gpLayouts, $config;
     $config_before = $config;
     $gpLayoutsBefore = $gpLayouts;
     $theme_folder_name =& $_POST['folder'];
     $theme_folder = $dataDir . '/data/_themes/' . $theme_folder_name;
     if (empty($theme_folder_name) || !ctype_alnum($theme_folder_name)) {
         message($langmessage['OOPS'] . ' (Invalid Request)');
         return false;
     }
     $order = false;
     if (isset($config['themes'][$theme_folder_name]['order'])) {
         $order = $config['themes'][$theme_folder_name]['order'];
     }
     if (!$this->CanDeleteTheme($theme_folder_name, $message)) {
         message($message);
         return false;
     }
     //remove layouts
     $rm_addon = false;
     foreach ($gpLayouts as $layout_id => $layout_info) {
         if (!isset($layout_info['is_addon']) || !$layout_info['is_addon']) {
             continue;
         }
         $layout_folder = dirname($layout_info['theme']);
         if ($layout_folder != $theme_folder_name) {
             continue;
         }
         if (array_key_exists('addon_key', $layout_info)) {
             $rm_addon = $layout_info['addon_key'];
         }
         $this->RmLayoutPrep($layout_id);
         unset($gpLayouts[$layout_id]);
     }
     //remove from settings
     unset($config['themes'][$theme_folder_name]);
     if ($rm_addon) {
         includeFile('admin/admin_addon_installer.php');
         $installer = new admin_addon_installer();
         if (!$installer->Uninstall($rm_addon)) {
             $gpLayouts = $gpLayoutsBefore;
         }
         $installer->OutputMessages();
     } else {
         if (!admin_tools::SaveAllConfig()) {
             $config = $config_before;
             $gpLayouts = $gpLayoutsBefore;
             message($langmessage['OOPS'] . ' (s1)');
             return false;
         }
         message($langmessage['SAVED']);
         if ($order) {
             $img_path = common::IdUrl('ci');
             common::IdReq($img_path);
         }
     }
     //delete the folder if it hasn't already been deleted by admin_addon_installer
     $dir = $dataDir . '/data/_themes/' . $theme_folder_name;
     if (file_exists($dir)) {
         gpFiles::RmAll($dir);
     }
 }
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:67,代码来源:admin_theme_content.php

示例2: CleanCache

 /**
  * Delete all files older than 2 weeks
  * If there are more than 200 files older than one week
  *
  */
 static function CleanCache()
 {
     global $dataDir;
     $dir = $dataDir . '/data/_cache';
     $files = scandir($dir);
     $times = array();
     foreach ($files as $file) {
         if ($file == '.' || $file == '..' || strpos($file, '.php') !== false) {
             continue;
         }
         $full_path = $dir . '/' . $file;
         $time = filemtime($full_path);
         $diff = time() - $time;
         //if relatively new ( < 3 days), don't delete it
         if ($diff < 259200) {
             continue;
         }
         //if old ( > 14 days ), delete it
         if ($diff > 1209600) {
             gpFiles::RmAll($full_path);
             continue;
         }
         $times[$file] = $time;
     }
     //reduce further if needed till we have less than 200 files
     arsort($times);
     $times = array_keys($times);
     while (count($times) > 200) {
         $full_path = $dir . '/' . array_pop($times);
         gpFiles::RmAll($full_path);
     }
 }
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:37,代码来源:admin_tools.php

示例3: CleanInstallFolder

 function CleanInstallFolder()
 {
     $addoncode = $this->addon_folder;
     $folders = gpFiles::readDir($addoncode, 1);
     foreach ($folders as $folder) {
         if (!isset($this->config[$folder])) {
             $full_path = $addoncode . '/' . $folder;
             gpFiles::RmAll($full_path);
         }
     }
 }
开发者ID:rizub4u,项目名称:gpEasy-CMS,代码行数:11,代码来源:admin_addon_install.php

示例4: RemovePlugin

 /**
  * Remove a plugin
  *
  */
 function RemovePlugin()
 {
     global $langmessage, $dataDir;
     $plugin =& $_REQUEST['plugin'];
     if (!is_array($this->cke_config['plugins']) || !array_key_exists($plugin, $this->cke_config['plugins'])) {
         message($langmessage['OOPS'] . ' ( )');
         return;
     }
     unset($this->cke_config['plugins'][$plugin]);
     if (!$this->SaveConfig()) {
         message($langmessage['OOPS'] . ' (Not Saved)');
     } else {
         message($langmessage['SAVED']);
     }
     $path = $dataDir . '/data/_ckeditor/' . $plugin;
     gpFiles::RmAll($path);
 }
开发者ID:Knuzen,项目名称:gpEasy-CMS,代码行数:21,代码来源:admin_ckeditor.php

示例5: ChangeInstallConfirmed

 function ChangeInstallConfirmed(&$addonName)
 {
     global $dataDir, $langmessage;
     $installFolder = $dataDir . '/data/_addoncode/' . $addonName;
     $fromFolder = $dataDir . '/addons/' . $addonName;
     if (!file_exists($installFolder)) {
         message($langmessage['OOPS']);
         return;
     }
     if (!file_exists($fromFolder)) {
         message($langmessage['OOPS']);
         return;
     }
     if (is_link($installFolder)) {
         unlink($installFolder);
         if (!admin_addon_install::CopyAddonDir($fromFolder, $installFolder)) {
             message($langmessage['OOPS']);
             return;
         }
     } else {
         gpFiles::RmAll($installFolder);
         if (!symlink($fromFolder, $installFolder)) {
             message($langmessage['OOPS']);
             return;
         }
     }
     message('Install Type Changed');
 }
开发者ID:rizub4u,项目名称:gpEasy-CMS,代码行数:28,代码来源:admin_addons.php

示例6: DeleteThemeConfirmed

 /**
  * Finalize theme removal
  *
  */
 function DeleteThemeConfirmed()
 {
     global $langmessage, $dataDir, $gpLayouts, $config;
     $gpLayoutsBefore = $gpLayouts;
     $can_delete = true;
     $theme_folder_name =& $_POST['folder'];
     $theme_folder = $dataDir . '/data/_themes/' . $theme_folder_name;
     if (empty($theme_folder_name) || !ctype_alnum($theme_folder_name) || !isset($config['themes'][$theme_folder_name])) {
         message($langmessage['OOPS']);
         return false;
     }
     $order = false;
     if (isset($config['themes'][$theme_folder_name]['order'])) {
         $order = $config['themes'][$theme_folder_name]['order'];
     }
     if (!$this->CanDeleteTheme($theme_folder_name, $message)) {
         message($message);
         return false;
     }
     //remove layouts
     foreach ($gpLayouts as $layout_id => $layout_info) {
         if (!isset($layout_info['is_addon']) || !$layout_info['is_addon']) {
             continue;
         }
         $layout_folder = dirname($layout_info['theme']);
         if ($layout_folder == $theme_folder_name) {
             $this->RmLayout($layout_id);
         }
     }
     //delete the folder
     $dir = $dataDir . '/data/_themes/' . $theme_folder_name;
     gpFiles::RmAll($dir);
     //remove from settings
     unset($config['themes'][$theme_folder_name]);
     if (admin_tools::SaveAllConfig()) {
         message($langmessage['SAVED']);
         if ($order) {
             $img_path = common::IdUrl('ci');
             common::IdReq($img_path);
         }
     } else {
         $gpLayouts = $gpLayoutsBefore;
         message($langmessage['OOPS'] . ' (s1)');
     }
 }
开发者ID:rizub4u,项目名称:gpEasy-CMS,代码行数:49,代码来源:admin_theme_content.php

示例7: RmAll

 /**
  * Remove a file or directory and it's contents
  *
  */
 public static function RmAll($path)
 {
     if (empty($path)) {
         return false;
     }
     if (is_link($path)) {
         return @unlink($path);
     }
     if (!is_dir($path)) {
         return @unlink($path);
     }
     $success = true;
     $subDirs = array();
     //$files = scandir($path);
     $files = gpFiles::ReadDir($path, false);
     foreach ($files as $file) {
         $full_path = $path . '/' . $file;
         if (!is_link($full_path) && is_dir($full_path)) {
             $subDirs[] = $full_path;
             continue;
         }
         if (!@unlink($full_path)) {
             $success = false;
         }
     }
     foreach ($subDirs as $subDir) {
         if (!gpFiles::RmAll($subDir)) {
             $success = false;
         }
     }
     if ($success) {
         return gpFiles::RmDir($path);
     }
     return false;
 }
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:39,代码来源:Files.php

示例8: CleanAddonFolder

 /**
  * Remove unused code folders created by incomplete addon installations
  *
  */
 function CleanAddonFolder()
 {
     global $config;
     //get a list of all folders
     $folder = '/data/_addoncode';
     $code_folders = $this->GetCleanFolders($folder);
     $folder = '/data/_addondata';
     $data_folders = $this->GetCleanFolders($folder);
     //check against folders used by addons
     $addons = $config['addons'];
     foreach ($addons as $addon_key => $info) {
         $addon_config = gpPlugin::GetAddonConfig($addon_key);
         if (array_key_exists($addon_config['code_folder_part'], $code_folders)) {
             $code_folders[$addon_config['code_folder_part']] = false;
         }
         if (array_key_exists($addon_config['data_folder_part'], $data_folders)) {
             $data_folders[$addon_config['data_folder_part']] = false;
         }
     }
     //remove unused folders
     $folders = array_filter($code_folders) + array_filter($data_folders);
     foreach ($folders as $folder => $full_path) {
         gpFiles::RmAll($full_path);
     }
 }
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:29,代码来源:admin_addons.php

示例9: CleanTemp

 /**
  * Clean old files and folders from the temporary folder
  * Delete after 36 hours (129600 seconds)
  *
  */
 function CleanTemp()
 {
     global $dataDir;
     $temp_folder = $dataDir . '/data/_temp';
     $files = gpFiles::ReadDir($temp_folder, false);
     foreach ($files as $file) {
         if ($file == 'index.html') {
             continue;
         }
         $full_path = $temp_folder . '/' . $file;
         $mtime = (int) filemtime($full_path);
         $diff = time() - $mtime;
         if ($diff < 129600) {
             continue;
         }
         gpFiles::RmAll($full_path);
     }
 }
开发者ID:rizub4u,项目名称:gpEasy-CMS,代码行数:23,代码来源:sessions.php

示例10: CleanInstallFolder

 /**
  * Remove unused code folders created by incomplete addon installations
  *
  */
 function CleanInstallFolder()
 {
     if (!$this->remote_install) {
         return;
     }
     if (file_exists($this->source)) {
         gpFiles::RmAll($this->source);
     }
     if (file_exists($this->trash_path)) {
         gpFiles::RmAll($this->trash_path);
     }
 }
开发者ID:barbrick,项目名称:gpEasy-CMS,代码行数:16,代码来源:admin_addon_installer.php

示例11: RemoveResized

 /**
  * Remove all of the resized images for an image that is deleted
  *
  */
 function RemoveResized($removed)
 {
     global $dataDir;
     foreach ($removed as $key => $info) {
         $img = admin_uploaded::TrimBaseDir($info['realpath']);
         $index = array_search($img, gp_resized::$index);
         if (!$index) {
             continue;
         }
         unset(gp_resized::$index[$index]);
         $folder = $dataDir . '/data/_resized/' . $index;
         if (file_exists($folder)) {
             gpFiles::RmAll($folder);
         }
     }
 }
开发者ID:rizub4u,项目名称:gpEasy-CMS,代码行数:20,代码来源:admin_uploaded.php

示例12: DeleteFromTrash

 /**
  * Check and remove the requested files from the trash
  *
  */
 function DeleteFromTrash()
 {
     global $dataDir, $langmessage;
     if (empty($_POST['titles']) || !is_array($_POST['titles'])) {
         message($langmessage['OOPS'] . ' (No Titles)');
         return;
     }
     $titles = array();
     $incomplete = false;
     foreach ($_POST['titles'] as $trash_index) {
         $title_info = admin_trash::GetInfo($trash_index);
         if ($title_info === false) {
             $incomplete = true;
             continue;
         }
         $titles[$trash_index] = $title_info;
     }
     if (!admin_trash::ModTrashData(null, $titles)) {
         return false;
     }
     //remove the data
     foreach ($titles as $trash_index => $info) {
         gpFiles::RmAll($info['rm_path']);
         unset($this->trash_files[$trash_index]);
     }
     if ($incomplete) {
         message($langmessage['delete_incomplete']);
     }
 }
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:33,代码来源:admin_trash.php


注:本文中的gpFiles::RmAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。