예제 #1
0
 /**
  * Enter description here...
  *
  */
 function deleteAll()
 {
     if (!file_exists($this->path)) {
         return;
     }
     $subdirs =& $this->listAll('dir', false, true);
     foreach ($subdirs as $subdir) {
         $subdirectory = new mosDirectory($subdir);
         $subdirectory->deleteAll();
         unset($subdirectory);
     }
     $filemanager =& mosFileManager::getInstance();
     $files =& $this->listAll('file', false, true);
     foreach ($files as $file) {
         $filemanager->deleteFile($file);
     }
     $filemanager->deleteDirectory($this->path);
 }
예제 #2
0
/**
 * Template uninstall method
 * @param int The id of the module
 * @param string The URL option
 * @param int The client id
 */
function template_uninstall($id, $option, $client = 0)
{
    $id = str_replace(array('\\', '/'), '', $id);
    $mosConfig_absolute_path = mamboCore::get('mosConfig_absolute_path');
    // Find if normal or admin template and delete corresponding files & directories
    if ($client == 'admin') {
        $basepath = mamboCore::get('mosConfig_absolute_path') . '/administrator/templates/' . $id;
    } else {
        $basepath = mamboCore::get('mosConfig_absolute_path') . '/templates/' . $id;
    }
    //Use $basepath to remove the template files and directory
    $tdir = new mosDirectory($basepath);
    $tdir->deleteAll();
    $message = new mosError(T_('Uninstall template - '), _MOS_ERROR_INFORM);
    HTML_installer::showInstallMessage($message, T_('Success'), returnTo($option, 'template', $client));
    exit;
}
예제 #3
0
 /**
  * This routine is not called - uninstalling templates is done by just deleting
  * the whole directory.  It might be better to manage the uninstall via the XML.
  * Just deleting the template leaves all the files in the "media" directory.
  * But the following code has never been tested.
  **/
 function uninstall_template()
 {
     $name = str_replace(' ', '_', strtolower($this->getName('template')));
     $client_id = $this->client == 'administrator' ? 1 : 0;
     if ($client_id) {
         $this->user_dir = mosPathName(mamboCore::get('mosConfig_absolute_path') . '/administrator/templates/');
     } else {
         $this->user_dir = mosPathName(mamboCore::get('mosConfig_absolute_path') . '/templates/' . $name);
     }
     $userdir = new mosDirectory($this->user_dir);
     $userdir->deleteAll();
     $mediadir = mamboCore::get('mosConfig_absolute_path') . '/images/stories/';
     $this->deleteFileSet($this->media, $mediadir);
     $fmanager =& mosFileManager::getInstance();
     $fmanager->deleteFile($this->xmlfile);
     $this->errors->addErrorDetails($this->getDescription('template'), _MOS_ERROR_INFORM);
 }