コード例 #1
0
function _languageFile_save($filepath, $translation)
{
    $headerMessage = "### NOTE: This file was last updated: " . date('Y-m-d H:i:s') . "\n";
    $headerMessage .= "### NOTE: Changes to this file will be overwritten next time you upgrade!\n";
    $headerMessage .= "### NOTE: Either send us your changes or create a new language called custom.php to avoid this\n";
    $headerMessage .= "### Default Text => Translation Text";
    saveStruct($filepath, $translation, true, $headerMessage);
}
コード例 #2
0
function saveSettings($forceDevFile = false)
{
    // added arg in 2.53
    if (inCLI() && !isInstalled()) {
        return;
    }
    // prevent cron.php from saving auto-generated settings until software has been installed (not all setting defaults can be set from CLI as $_SERVER values aren't available).
    $settingsPath = $forceDevFile ? SETTINGS_DEV_FILEPATH : SETTINGS_FILEPATH;
    saveStruct($settingsPath, $GLOBALS['SETTINGS'], true);
}
コード例 #3
0
function saveSchema($tableName, $schema, $schemaDir = '')
{
    global $APP;
    // error checking
    if (!$tableName) {
        die(__FUNCTION__ . ": no tableName specified!");
    }
    // get schema filepath
    $tableNameWithoutPrefix = getTableNameWithoutPrefix($tableName);
    if (!$schemaDir) {
        $schemaFilepath = DATA_DIR . "/schema/{$tableNameWithoutPrefix}.ini.php";
    } else {
        $schemaFilepath = "{$schemaDir}/{$tableNameWithoutPrefix}.ini.php";
    }
    // sort schema
    $metaData = array();
    $fields = array();
    foreach ($schema as $name => $value) {
        if (is_array($value)) {
            $fields[$name] = $value;
        } else {
            $metaData[$name] = $value;
        }
    }
    ksort($metaData);
    uasort($fields, '__sortSchemaFieldsByOrder');
    // sort schema keys
    $schema = $metaData + $fields;
    // add _tableName (v2.16+)
    if ($schema) {
        // we need to do this in saveSchema as well as load in case the table was renamed (we want to save the new tablename value)
        $schema['_tableName'] = $tableNameWithoutPrefix;
    }
    // save schema
    saveStruct($schemaFilepath, $schema);
    // debug: save in old format - uncomment, click "Save Details" under Section Editors for the table you want, then re-comment
    //saveINI($schemaFilepath, $schema, true); die("saved in old format: $schemaFilepath");
}