Exemple #1
0
 public function checkDatabase()
 {
     //delete if module is no longer installed. This should happen automatically
     //after module uninstall but in some cases this went wrong.
     $parts = explode('\\', $this->model_name);
     $module = strtolower($parts[1]);
     if ($module != 'base' && !\GO::modules()->isInstalled($module)) {
         $this->delete();
     } else {
         return parent::checkDatabase();
     }
 }
Exemple #2
0
 public function checkDatabase()
 {
     if (empty($this->user_id)) {
         $this->user_id = 1;
     }
     if (empty($this->description)) {
         $this->description = 'unknown';
     }
     if ($this->description != 'readonly') {
         $this->addGroup(\GO::config()->group_root, Acl::MANAGE_PERMISSION);
         $this->addUser($this->user_id, Acl::MANAGE_PERMISSION);
     }
     return parent::checkDatabase();
 }
Exemple #3
0
 public function checkDatabase()
 {
     if ($this->id == \GO::config()->group_everyone) {
         $stmt = User::model()->find(\GO\Base\Db\FindParams::newInstance()->ignoreAcl());
         while ($user = $stmt->fetch()) {
             $this->addUser($user->id);
         }
     }
     if ($this->id == \GO::config()->group_root) {
         $this->addUser(1);
     }
     return parent::checkDatabase();
 }
Exemple #4
0
 /**
  * When checking all Event models make sure there is a UUID if not create one
  */
 public function checkDatabase()
 {
     if (empty($this->uuid)) {
         $this->uuid = \GO\Base\Util\UUID::create('event', $this->id);
     }
     //in some cases on old databases the repeat_end_time is set but the UNTIL property in the rrule is not. We correct that here.
     if ($this->repeat_end_time > 0 && strpos($this->rrule, 'UNTIL=') === false) {
         $rrule = new \GO\Base\Util\Icalendar\Rrule();
         $rrule->readIcalendarRruleString($this->start_time, $this->rrule);
         $rrule->until = $this->repeat_end_time;
         $this->rrule = $rrule->createRrule();
     }
     parent::checkDatabase();
 }
Exemple #5
0
 public function checkDatabase()
 {
     try {
         $this->alterDatabase(false);
     } catch (Exception $ex) {
         //class doesn't exist?
         echo "ERROR: " . $ex->getMessage() . "\n";
     }
     return parent::checkDatabase();
 }