Exemple #1
0
 /**
  * Save the current page
  * Save a backup if $backup is true
  *
  */
 public function SaveThis($backup = true)
 {
     if (!is_array($this->meta_data) || !is_array($this->file_sections)) {
         return false;
     }
     //return true if nothing has changed
     if ($this->checksum === $this->Checksum()) {
         return true;
     }
     //file count
     if (!isset($this->meta_data['file_number'])) {
         $this->meta_data['file_number'] = \gp\tool\Files::NewFileNumber();
     }
     if ($backup) {
         $this->SaveBackup();
         //make a backup of the page file
     }
     if (!\gp\tool\Files::SaveData($this->draft_file, 'file_sections', $this->file_sections, $this->meta_data)) {
         return false;
     }
     $this->draft_exists = true;
     return true;
 }