Ejemplo n.º 1
0
 /**
  * Change group on file(s)
  *
  * @param $group, string : new group to apply to file(s)
  * @param $files, string : the files to apply new rights (relative to CMS_file::FILE_SYSTEM)
  * @return string, the files who can't apply the chmod, else nothing if all is done.
  * @access public
  */
 function changeGroup($group, $files)
 {
     $filesList = CMS_file::getFileList($files);
     if (is_array($filesList) && $filesList) {
         $nok = '';
         foreach ($filesList as $aFile) {
             $nok .= chgrp($aFile['name'], $owner) ? '' : $aFile['name'] . '<br />';
         }
         return $nok;
     } else {
         return '';
     }
 }
Ejemplo n.º 2
0
 /**
  * Destroy this object, in DB and filesystem if needed
  * Destroy title label also
  *
  * @return boolean true on success, false on failure
  * @access public
  */
 function destroy()
 {
     if ($this->_fieldID) {
         //delete all files of objects for this field
         $module = CMS_poly_object_catalog::getModuleCodenameForField($this->_fieldID);
         $filesDir = new CMS_file(PATH_MODULES_FILES_FS . '/' . $module, CMS_file::FILE_SYSTEM, CMS_file::TYPE_DIRECTORY);
         if ($filesDir->exists()) {
             //search all files of this field
             $filesList = $filesDir->getFileList(PATH_MODULES_FILES_FS . '/' . $module . '/*_f' . $this->_fieldID . '_*');
             //then delete them
             foreach ($filesList as $aFile) {
                 if (!CMS_file::deleteFile($aFile['name'])) {
                     $this->raiseError("Can't delete file " . $aFile['name'] . " for field : " . $this->_fieldID);
                     return false;
                 }
             }
         }
         //delete all datas of objects for this field
         $tables = array('mod_subobject_date_deleted', 'mod_subobject_date_edited', 'mod_subobject_date_public', 'mod_subobject_integer_deleted', 'mod_subobject_integer_edited', 'mod_subobject_integer_public', 'mod_subobject_string_deleted', 'mod_subobject_string_edited', 'mod_subobject_string_public', 'mod_subobject_text_deleted', 'mod_subobject_text_edited', 'mod_subobject_text_public');
         foreach ($tables as $aTable) {
             $sql = "\n\t\t\t\t\tdelete from\n\t\t\t\t\t\t" . $aTable . "\n\t\t\t\t\twhere\n\t\t\t\t\t\tobjectFieldID = '" . $this->_fieldID . "'\n\t\t\t\t";
             $q = new CMS_query($sql);
             if ($q->hasError()) {
                 $this->raiseError("Can't delete datas of table " . $aTable . " for field : " . $this->_fieldID);
                 return false;
             }
         }
         //delete title label object
         if (sensitiveIO::IsPositiveInteger($this->_objectFieldValues["labelID"])) {
             $label = new CMS_object_i18nm($this->_objectFieldValues["labelID"]);
             $label->destroy();
         }
         //delete field DB record
         $sql = "\n\t\t\t\tdelete from\n\t\t\t\t\tmod_object_field \n\t\t\t\twhere\n\t\t\t\t\tid_mof='" . $this->_fieldID . "'\n\t\t\t";
         $q = new CMS_query($sql);
         if ($q->hasError()) {
             $this->raiseError("Can't delete datas of table mod_object_field for field : " . $this->_fieldID);
             return false;
         }
         //unset fields catalog in cache
         CMS_cache::clearTypeCache('atm-polymod-structure');
         //Clear polymod cache
         //CMS_cache::clearTypeCacheByMetas('polymod', array('module' => CMS_poly_object_catalog::getModuleCodenameForField($this->_fieldID)));
         CMS_cache::clearTypeCache('polymod');
     }
     //unset fields catalog in cache
     CMS_cache::clearTypeCacheByMetas('atm-polymod-structure', array('type' => 'fields'));
     //finally destroy object instance
     unset($this);
     return true;
 }
Ejemplo n.º 3
0
 //found CLI path
 $needCliPath = false;
 if ($moduleParameters['USE_BACKGROUND_REGENERATOR'][0] == 1) {
     if (APPLICATION_IS_WINDOWS) {
         $needCliPath = true;
         $cliPath = isset($_POST["cliPath"]) ? $_POST["cliPath"] : PATH_PHP_CLI_WINDOWS;
     } elseif (substr(CMS_patch::executeCommand('which php 2>&1', $error), 0, 1) !== '/') {
         $return = CMS_patch::executeCommand('php -v', $error);
         if (strpos(strtolower($return), '(cli)') === false) {
             $needCliPath = true;
             $cliPath = isset($_POST["cliPath"]) ? $_POST["cliPath"] : PATH_PHP_CLI_UNIX;
         }
     }
 }
 //CHMOD scripts with good values
 $scriptsFiles = CMS_file::getFileList(PATH_PACKAGES_FS . '/scripts/*.php');
 foreach ($scriptsFiles as $aScriptFile) {
     //then set it executable
     CMS_file::makeExecutable($aScriptFile["name"]);
 }
 //test temporary directory and create it if none found
 $tmpPath = '';
 if (@is_dir(ini_get("session.save_path")) && is_writable(PATH_TMP_FS)) {
     $tmpPath = ini_get("session.save_path");
 } elseif (@is_dir(PATH_PHP_TMP) && is_writable(PATH_PHP_TMP)) {
     $tmpPath = PATH_PHP_TMP;
 } else {
     if (@is_dir(PATH_TMP_FS) && is_writable(PATH_TMP_FS)) {
         $tmpPath = realpath(PATH_TMP_FS);
         //add tmp path to config.php file
         $configFile = new CMS_file(dirname(__FILE__) . "/config.php");