示例#1
0
 public function zipJs($build)
 {
     if (!$build) {
         return;
     }
     //Allow sufficient time
     set_time_limit(0);
     /**
      * Recompress all the files
      */
     $ajax = new CalemZipJustAjaxJs();
     $ajax->process();
     $calemeam = new CalemZipJustCalemJs();
     $calemeam->process();
     $metadata = new CalemZipMetadataJs();
     $metadata->process();
     $message = new CalemZipMessageJs();
     $message->process();
     $groupUser = new CalemZipGroupUserJs();
     $groupUser->package();
     //Global custom info
     $md = new CalemZipCustomMetadataJs();
     $md->package();
     $md = new CalemZipCustomDropdownJs();
     $md->package();
     $md = new CalemZipCustomMessageAllJs();
     $md->package();
     //Converting report
     $tmRpt = microtime(true);
     $rpt = new CalemConvertReportBatch();
     $countRpt = $rpt->process();
     return array('reportTime' => array('start' => $tmRpt, 'end' => microtime(true)));
 }
 public function updateMetadataForFieldName($fldAr)
 {
     //Modifying files
     $path = _CALEM_DIR_ . 'custom/global/metadata/';
     $file = $fldAr['tableId'] . '.metadata';
     $fullPath = $path . $file;
     if (!is_file($fullPath)) {
         $this->logger->error("Field deleted but the metadata file is not found, fld=" . var_export($fldAr, true));
         return $rt = array('id' => $fldAr['id'], 'status' => ERROR_FILE_NOT_FOUND, 'errorInfo' => array('id' => 'CalemFileNotFoundException'));
     }
     $this->backupFile($path, $file);
     $data = file_get_contents($fullPath);
     $md = unserialize($data);
     $fld = array('type' => $fldAr['type']);
     if ($fldAr['type'] == FIELD_VARCHAR) {
         $fld['length'] = intval($fldAr['length']);
     }
     if ($fldAr['required']) {
         $fld['required'] = true;
     }
     //Should copy array so the order is preserved.
     $flds = $md['fields'];
     $newFlds = array();
     foreach ($flds as $key => $value) {
         if ($key == $fldAr['oldId']) {
             $newFlds[$fldAr['id']] = $fld;
         } else {
             $newFlds[$key] = $value;
         }
     }
     $md['fields'] = $newFlds;
     //Now write the file back.
     $rt = $this->storeFile($fldAr, $md, $fullPath);
     if ($rt['status'] != 0) {
         return $rt;
     }
     //Let's repackage metadata
     $cm = new CalemZipCustomMetadataJs();
     $cm->package();
     //So this is a success
     return array('id' => $fldAr['id'], 'status' => 0);
 }