Example #1
0
 /**
  * Update the DB based on previously recorded changes
  *
  * @return boolean true on success
  */
 function dbupdate()
 {
     global $DB;
     // Start transaction because of urltitle validation
     $DB->begin('SERIALIZABLE');
     // validate url title / slug
     if (empty($this->urlname) || isset($this->dbchanges['cat_urlname'])) {
         // Url title has changed or is empty
         $this->set('urlname', urltitle_validate($this->urlname, $this->name, $this->ID, false, $this->dbprefix . 'urlname', $this->dbIDname, $this->dbtablename));
     }
     if (parent::dbupdate() === false) {
         // The update was unsuccessful
         $DB->rollback();
         return false;
     }
     // The chapter was updated successful
     $DB->commit();
     return true;
 }