Source for file jAppManager.class.php

Documentation is available at jAppManager.class.php

  1. <?php
  2. /**
  3. @package    jelix
  4. @subpackage utils
  5. @author     Loic Mathaud
  6. @contributor Laurent Jouanneau
  7. @copyright  2006 Loic Mathaud, 2010-2011 Laurent Jouanneau
  8. @link        http://www.jelix.org
  9. @licence  http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public Licence, see LICENCE file
  10. */
  11.  
  12. /**
  13. * utilities to manage a jelix application
  14. @package    jelix
  15. @subpackage utils
  16. @since 1.0b1
  17. @static
  18. */
  19. class jAppManager {
  20.  
  21.     private function __construct({}
  22.  
  23.     /**
  24.      * close the application, by creating a CLOSED file
  25.      * @param string $message the message to display
  26.      * @since 1.2
  27.      */
  28.     public static function close($message=''{
  29.         file_put_contents(jApp::configPath('CLOSED')$message);
  30.     }
  31.  
  32.     /**
  33.      * open the application
  34.      * @since 1.2
  35.      */
  36.     public static function open({
  37.         if (file_exists(jApp::configPath('CLOSED')))
  38.             unlink(jApp::configPath('CLOSED'));
  39.     }
  40.  
  41.     /**
  42.      * tell if the application is opened
  43.      * @return boolean true if the application is opened
  44.      * @since 1.2
  45.      */
  46.     public static function isOpened({
  47.         return !file_exists(jApp::configPath('CLOSED'));
  48.     }
  49.  
  50.     public static function clearTemp($path=''{
  51.         if ($path == ''{
  52.             $path jApp::tempBasePath();
  53.             if ($path == ''{
  54.                 throw new Exception("default temp base path is not defined",1);
  55.             }
  56.         }
  57.  
  58.         if ($path == DIRECTORY_SEPARATOR || $path == '' || $path == '/'{
  59.             throw new Exception('given temp path is invalid'2);
  60.         }
  61.         if (!file_exists($path))
  62.             throw new Exception('given temp path does not exists'3);
  63.  
  64.         if (!is_writeable($path))
  65.             throw new Exception('given temp path does not exists'4);
  66.  
  67.         jFile::removeDir($pathfalse);
  68.     }
  69. }

Documentation generated on Wed, 24 Sep 2014 21:56:13 +0200 by phpDocumentor 1.4.3