Esempio n. 1
0
 /**
  * @return $this
  */
 public function index()
 {
     Config::_getInstance()->load('UpgradeDB');
     if (!config('enabled', 'UpgradeDB')) {
         lang('disabled', 'UpgradeDB');
         exit;
     }
     Error::_getInstance()->flush()->_('verbosity', 'die');
     if (!removeContent(BASE_PATH . config('contentPath', 'Default'))) {
         lang('removeContentFailure', 'UpgradeDB');
         exit;
     }
     lang('removeContentSuccess', 'UpgradeDB');
     linefeed();
     foreach (config('content', 'UpgradeDB') as $type) {
         Config::_getInstance()->load($type);
         if (!$this->skeleton(config('filters', $type))) {
             lang('skeletonContentFailure', 'UpgradeDB', array($type));
             exit;
         }
         lang('skeletonContentSuccess', 'UpgradeDB', array($type));
         linefeed();
     }
     return $this->run();
 }
/**
 * @param string $target
 * @return bool
 */
function removeContent($target)
{
    if (!is_writable($target)) {
        Error::_getInstance()->add('filesystem', 0, array($target));
        return false;
    }
    $files = scandir($target);
    foreach ($files as $file) {
        switch (true) {
            case $file == '.':
            case $file == '..':
                continue;
            case is_dir($target . $file):
                removeContent("{$target}{$file}/");
                rmdir("{$target}{$file}/");
                break;
            default:
                unlink("{$target}{$file}");
        }
    }
    return true;
}
Esempio n. 3
0
     break;
 case 'new':
     editContent(0, $sectionid, $option);
     break;
 case 'edit':
     editContent($id, $sectionid, $option);
     break;
 case 'editA':
     editContent($cid[0], '', $option);
     break;
 case 'save':
     mosCache::cleanCache('com_content');
     saveContent($sectionid, $option);
     break;
 case 'remove':
     removeContent($cid, $sectionid, $option);
     break;
 case 'publish':
     changeContent($cid, 1, $sectionid, $option);
     break;
 case 'unpublish':
     changeContent($cid, 0, $sectionid, $option);
     break;
 case 'toggle_frontpage':
     toggleFrontPage($cid, $sectionid, $option);
     break;
 case 'archive':
     changeContent($cid, -1, $sectionid, $option);
     break;
 case 'unarchive':
     changeContent($cid, 0, $sectionid, $option);