Beispiel #1
0
 /** Delete module
  *
  * @return bool
  */
 public function deleteModule()
 {
     global $Database;
     // is source available?
     if (is_dir($this->path)) {
         // backup
         if (!ts_BackupHandler::backupModule($this->path)) {
             return false;
         }
     }
     if (!ts_FileHandler::deleteFolder($this->path)) {
         return false;
     }
     // delete entry in database
     $sql = "DELETE FROM #__modules\n\t    WHERE id__module = '" . $this->id . "';";
     if (!$Database->doDelete($sql)) {
         return false;
     }
     return true;
 }
Beispiel #2
0
 /** Preparse and move all files and subfolders within path
  *
  * @return bool
  */
 protected function _preparse()
 {
     global $Config;
     // get new path
     $path_new = $this->_getPath(false, false);
     // free path
     if ($this->path == $path_new) {
         // move
         $path_old = $this->path . '__moved_by_preparser_' . rand(1, 1000);
         ts_FileHandler::copyFolder($this->path, $path_old);
         $this->path = $path_old;
     } elseif (is_dir($path_new)) {
         ts_BackupHandler::backupModule($path_new, 'invalid_name');
     }
     ts_FileHandler::deleteFolder($path_new);
     // load PreParser-object
     $PreParser = new ts_PreParser($this);
     // parse
     if ($PreParser->parse($this->path, $path_new, $Config->get('dir_data'))) {
         // success
         // delete old source
         ts_FileHandler::deleteFolder($this->path);
         $this->path = $path_new;
         return true;
     }
     // failure
     ts_FileHandler::deleteFolder($path_new);
     return false;
 }