tangra logo
   
[ class tree: tangra_lib ] [ index: tangra_lib ] [ all elements ]
 

Source for file can_upgrade_loader.class.php

Documentation is available at can_upgrade_loader.class.php

  1. <?php
  2.  
  3. // $Id$
  4.  
  5.  
  6. /**
  7.  * Contains class Can_Upgrade_Loader
  8.  *
  9.  * @package  tangra_lib
  10.  * @subpackage  modules_manager
  11.  */
  12.  
  13. /**
  14.  * Loads can_upgrade file (from module installation package)
  15.  *
  16.  * @package  tangra_lib
  17.  * @subpackage  modules_manager
  18.  */
  19. class Can_Upgrade_Loader extends Tangra_Class {
  20.     /**
  21.      * Path to can_upgrade file
  22.      *
  23.      * @var string 
  24.      * @internal
  25.      */
  26.     private $file_path;
  27.  
  28.     /**
  29.      * Constructor
  30.      *
  31.      * @param string $file_path Path to can_upgrade file
  32.      */
  33.     function __construct($file_path{
  34.         $this->file_path = $file_path;
  35.     }
  36.  
  37.  
  38.     /**
  39.      * Returns true if can upgrade, false otherwise
  40.      *
  41.      * @return boolean 
  42.      */
  43.     public function get_can_upgrade({
  44.         $ret array();
  45.         if (file_exists($this->file_path)) {
  46.             $cnt @file($this->file_path);
  47.             if ($cnt !== false{
  48.                 foreach($cnt as $row{
  49.                     $row trim($row);
  50.                     if ($row{
  51.                         $pair explode('='$row);
  52.                         if (count($pair== 2{
  53.                             if (trim($pair[0&& trim($pair[1]))) {
  54.                                 $ret[$pair[0]] $pair[1];
  55.                             }
  56.                         }
  57.                     }
  58.                 }
  59.             else {
  60.                 throw new Tangra_Exception('Cannot load '.$this->file_path);
  61.             }
  62.         }
  63.  
  64.         return $ret;
  65.     }
  66. }