/**
  * read structure
  */
 function readStructure($a_force = false, $a_dir = "", $a_comp_prefix = "", $a_plugin_path = "")
 {
     global $ilDB;
     if (!$a_force && $this->ini->readVariable("db", "structure_reload") != "1") {
         return;
     }
     require_once './Services/UICore/classes/class.ilCachedCtrl.php';
     ilCachedCtrl::flush();
     require_once './Services/GlobalCache/classes/class.ilGlobalCache.php';
     ilGlobalCache::flushAll();
     // prefix for component
     $this->comp_prefix = $a_comp_prefix;
     // plugin path
     $this->plugin_path = $a_plugin_path;
     // only run one time per db_update request
     if (!$this->executed) {
         if ($a_dir == "") {
             $this->start_dir = ILIAS_ABSOLUTE_PATH;
             $this->read(ILIAS_ABSOLUTE_PATH);
         } else {
             $this->start_dir = $a_dir;
             $this->read($a_dir);
         }
         $this->store();
         $this->determineClassFileIds();
         $this->executed = true;
         if (!$a_force) {
             $this->ini->setVariable("db", "structure_reload", "0");
             $this->ini->write();
         }
     }
     // read module information
     // not clear whether this is a good place for module reading info
     // or not
     include_once "./Services/UICore/classes/class.ilCtrl.php";
     $ctrl = new ilCtrl();
     //		$ctrl->storeCommonStructures();
 }
 public function saveCache()
 {
     /**
      * @var $ini ilIniFile
      */
     require_once 'Services/GlobalCache/classes/class.ilGlobalCache.php';
     ilGlobalCache::flushAll();
     $ini = $this->setup->getClient()->ini;
     if (!$ini->readGroup('cache')) {
         $ini->addGroup('cache');
     }
     $activate_global_cache = 'activate_global_cache';
     $global_cache_service_type = 'global_cache_service_type';
     $ini->setVariable('cache', $activate_global_cache, $_POST[$activate_global_cache]);
     $ini->setVariable('cache', $global_cache_service_type, $_POST[$global_cache_service_type]);
     $ini->write();
     ilUtil::sendSuccess($this->lng->txt('saved_successfully'), true);
     ilUtil::redirect('setup.php?cmd=cache');
 }
Beispiel #3
0
 /**
  * Update all languages
  */
 public final function updateLanguages()
 {
     global $ilCtrl;
     ilGlobalCache::flushAll();
     include_once "./Services/Language/classes/class.ilObjLanguage.php";
     $langs = $this->getAvailableLangFiles($this->getLanguageDirectory());
     $prefix = $this->getPrefix();
     foreach ($langs as $lang) {
         $txt = file($this->getLanguageDirectory() . "/" . $lang["file"]);
         $lang_array = array();
         // get language data
         if (is_array($txt)) {
             foreach ($txt as $row) {
                 if ($row[0] != "#" && strpos($row, "#:#") > 0) {
                     $a = explode("#:#", trim($row));
                     $lang_array[$prefix . "_" . trim($a[0])] = trim($a[1]);
                     ilObjLanguage::replaceLangEntry($prefix, $prefix . "_" . trim($a[0]), $lang["key"], trim($a[1]));
                     //echo "<br>-$prefix-".$prefix."_".trim($a[0])."-".$lang["key"]."-";
                 }
             }
         }
         ilObjLanguage::replaceLangModule($lang["key"], $prefix, $lang_array);
     }
 }
 /**
  * Replace lang entry
  */
 static final function replaceLangEntry($a_module, $a_identifier, $a_lang_key, $a_value, $a_local_change = null, $a_remarks = null)
 {
     global $ilDB;
     ilGlobalCache::flushAll();
     if (isset($a_remarks)) {
         $a_remarks = substr($a_remarks, 0, 250);
     }
     if ($a_remarks == '') {
         unset($a_remarks);
     }
     if (isset($a_value)) {
         $a_value = substr($a_value, 0, 4000);
     }
     if ($a_value == '') {
         unset($a_value);
     }
     $ilDB->replace('lng_data', array('module' => array('text', $a_module), 'identifier' => array('text', $a_identifier), 'lang_key' => array('text', $a_lang_key)), array('value' => array('text', $a_value), 'local_change' => array('timestamp', $a_local_change), 'remarks' => array('text', $a_remarks)));
     return true;
     /*
     $ilDB->manipulate(sprintf("DELETE FROM lng_data WHERE module = %s AND ".
     	"identifier = %s AND lang_key = %s",
     	$ilDB->quote($a_module, "text"), $ilDB->quote($a_identifier, "text"),
     	$ilDB->quote($a_lang_key, "text")));
     
     
     $ilDB->manipulate(sprintf("INSERT INTO lng_data " .
     	"(module, identifier, lang_key, value, local_change) " .
     	"VALUES (%s,%s,%s,%s,%s)",
     	$ilDB->quote($a_module, "text"), $ilDB->quote($a_identifier, "text"),
     	$ilDB->quote($a_lang_key, "text"), $ilDB->quote($a_value, "text"),
     	$ilDB->quote($a_local_change, "timestamp")));
     */
 }