Ejemplo n.º 1
0
 /**
  * Delete session that are older than the given time in secounds
  *
  * @param int		$time
  * @return void
  */
 public function gc($time)
 {
     foreach (\CCFile::ls(\CCStorage::path('sessions/*')) as $file) {
         if (filemtime($file) - (time() - $time) < 0) {
             if (!\CCFile::delete($file)) {
                 throw new Exception("Manager_File::gc - cannot delete session file.");
             }
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * delete the configuration data
  *
  * @param string		$file
  * @return void
  */
 public function delete($file)
 {
     // check for absolut path
     if (substr($file, 0, 1) == '/') {
         return CCFile::delete($file);
     }
     return CCFile::delete($this->path($file));
 }
Ejemplo n.º 3
0
 /**
  * uninstall an orbit module
  *
  * @param array 		$params 
  */
 public function action_uninstall($params)
 {
     $path = $params[0];
     if (empty($path)) {
         CCCli::line('no ship path given.', 'red');
         return;
     }
     /*
      * direct install if starting with /
      */
     if (substr($path, 0, 1) == '/') {
         // fix path
         if (substr($path, -1) != '/') {
             $path .= '/';
         }
         // is directory
         if (!is_dir($path)) {
             CCCli::line('could not find a ship at path: ' . $path, 'red');
             return;
         }
         // are ya serius..
         if (!CCCli::confirm("are you sure you want to uninstall this ship?", true)) {
             return;
         }
         // run the uninstaller
         try {
             \CCOrbit::uninstall($path);
         } catch (\Exception $e) {
             CCCli::line($e->getMessage(), 'red');
             CCCli::line('ship destroying failure.', 'red');
             return;
         }
         // also remove the direcoty?
         if (CCCli::confirm("do you also wish to remove the ship files?", true)) {
             \CCFile::delete($path);
         }
         // we are done
         CCCli::line('ship destroyed!', 'green');
         return;
     }
     // check if the module is in our orbit path
     if (is_dir(ORBITPATH . $path)) {
         // there is a ship yay
         CCCli::line('found ship at path: ' . ORBITPATH . $path, 'green');
         return static::action_uninstall(array(ORBITPATH . $path));
     }
     // nothing to do here
     CCCli::line('could not find a ship at this path or name.', 'red');
     return;
 }