Exemplo n.º 1
0
 /**
  * Removes an app
  * @param string $name name of the application to remove
  * @param array $options options
  * @return boolean
  *
  * This function removes an app. $options is an associative array. The
  * following keys are optional:ja
  *   - keeppreferences: boolean, if true the user preferences won't be deleted
  *   - keepappconfig: boolean, if true the config will be kept
  *   - keeptables: boolean, if true the database will be kept
  *   - keepfiles: boolean, if true the user files will be kept
  *
  * This function works as follows
  *   -# including appinfo/remove.php
  *   -# removing the files
  *
  * The function will not delete preferences, tables and the configuration,
  * this has to be done by the function oc_app_uninstall().
  */
 public static function removeApp($name, $options = array())
 {
     if (isset($options['keeppreferences']) and $options['keeppreferences'] == false) {
         // todo
         // remove preferences
     }
     if (isset($options['keepappconfig']) and $options['keepappconfig'] == false) {
         // todo
         // remove app config
     }
     if (isset($options['keeptables']) and $options['keeptables'] == false) {
         // todo
         // remove app database tables
     }
     if (isset($options['keepfiles']) and $options['keepfiles'] == false) {
         // todo
         // remove user files
     }
     if (OC_Installer::isDownloaded($name)) {
         $appdir = OC_App::getInstallPath() . '/' . $name;
         OC_Helper::rmdirr($appdir);
         return true;
     } else {
         OC_Log::write('core', 'can\'t remove app ' . $name . '. It is not installed.', OC_Log::ERROR);
         return false;
     }
 }