From fe61a2c2fd93b04ba21d3fb2705e73a428378c08 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Thu, 17 Apr 2014 23:32:22 +0200 Subject: [PATCH] Even more removals of deprecated revision-stuff (was used in SVN to show updates). MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- inc/loader/load-revision.php | 67 +---- inc/modules/admin/what-updates.php | 6 +- inc/revision-functions.php | 263 +----------------- inc/versions.php | 50 +--- inc/wrapper-functions.php | 62 ++--- .../de/html/admin/admin_update_download.tpl | 4 +- templates/de/html/copyright.tpl | 2 +- templates/de/html/copyright_backlink.tpl | 2 +- templates/de/html/mediadata.tpl | 41 ++- 9 files changed, 62 insertions(+), 435 deletions(-) diff --git a/inc/loader/load-revision.php b/inc/loader/load-revision.php index 9292bb922f..f551ef47b7 100644 --- a/inc/loader/load-revision.php +++ b/inc/loader/load-revision.php @@ -1,68 +1,3 @@ loadCacheFile('revision')) { - // Load revision from cache - $GLOBALS['cache_array']['revision'] = $GLOBALS['cache_instance']->getArrayFromCache(); -} elseif (((isHtmlOutputMode())) || (isAjaxOutputMode()) || (isRawOutputMode())) { - // Create cache file here - $GLOBALS['cache_instance']->init(); - - // add the new RevInfos in and saves it to the cache - $GLOBALS['cache_instance']->addRow(getArrayFromRepositoryData()); - - // Close the cache - $GLOBALS['cache_instance']->finalize(); - - // Generate FQFN for old revision file - $FQFN = sprintf('%s/.revision', getCachePath()); - - // Is it there? - if (isFileReadable($FQFN)) { - // Then remove it - removeFile($FQFN); - } // END - if -} - -// [EOF] +// @DEPRECATED ?> diff --git a/inc/modules/admin/what-updates.php b/inc/modules/admin/what-updates.php index 41fc659241..e7d8f5ce88 100644 --- a/inc/modules/admin/what-updates.php +++ b/inc/modules/admin/what-updates.php @@ -62,7 +62,6 @@ if (empty($response[0]) && empty($response[1]) && empty($response[2]) && empty($ $ONLINE = array( 'version' => trim(str_replace(PHP_EOL, '', $response[0])), 'changed' => trim(str_replace(PHP_EOL, '', $response[1])), - 'revision' => trim(str_replace(PHP_EOL, '', $response[2])), 'code' => '200 OK' ); } else { @@ -75,15 +74,12 @@ if (empty($response[0]) && empty($response[1]) && empty($response[2]) && empty($ if (empty($ONLINE['version'])) { // Disconnected? displayErrorMessage('{--ADMIN_CANNOT_CHECK_VERSION--} (' . $ONLINE['code'] . ')'); -} elseif (($ONLINE['version'] != getFullVersion()) || ($ONLINE['revision'] > getCurrentRepositoryRevision())) { +} elseif ($ONLINE['version'] != getFullVersion()) { // New full-version available (all previous released patches are included in this version!) $ONLINE['changed'] = generateDateTime($ONLINE['changed'], 2); // Load template loadTemplate('admin_update_download', FALSE, $ONLINE); -} elseif ($ONLINE['revision'] < getCurrentRepositoryRevision()) { - // Installed revision is newer than on server - displayMessage('{--ADMIN_LOCAL_REVISION_IS_NEWER_THAN_UPDATE--}'); } else { // You have the latest version! displayMessage('{--ADMIN_NO_UPDATES_AVAILABLE--}'); diff --git a/inc/revision-functions.php b/inc/revision-functions.php index 6e8da9535b..f551ef47b7 100644 --- a/inc/revision-functions.php +++ b/inc/revision-functions.php @@ -1,264 +1,3 @@ 'quix0r', - // No default value for current file name - 'File' => 11, - // No default value for revision number - 'Revision' => 10, - // No default value for date - 'Date' => 9, - // Default branch - 'Tag' => 8 - ); - - // Add Revision, Date, Tag and Author - $GLOBALS['repository_search_for'] = array( - 'File', - 'Revision', - 'Date', - 'Tag', - 'Author' - ); -} - -// "Getter" for revision/version data -function getRepositoryData ($type = 'Revision') { - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ret[' . $type . '] - ENTERED!'); - // Default is an invalid value to find bugs... :-) - $ret = 'INVALID'; - - // By default nothing is new... ;-) - $new = FALSE; - - // Is the cache entry there? - if (isset($GLOBALS['cache_array']['revision'][$type][0])) { - // Found so increase cache hit - incrementStatsEntry('cache_hits'); - - // Return it - $ret = $GLOBALS['cache_array']['revision'][$type][0]; - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ret[' . $type . ']=' . $ret); - } else { - // FQFN of revision file - $FQFN = sprintf('%s/.revision', getCachePath()); - - // Check if 'check_revision_data' is setted (switch for manually rewrite the .revision-File) - if ((isGetRequestElementSet('check_revision_data')) && (getRequestElement('check_revision_data') == 'yes')) { - // Forced rebuild of .revision file - $new = TRUE; - } else { - // Check for revision file - if (!isFileReadable($FQFN)) { - // Not found, so we need to create it - $new = TRUE; - } else { - // Revision file found - $ins_vers = explode(PHP_EOL, readFromFile($FQFN)); - - // Get array for mapping information - $mapper = array_flip($GLOBALS['repository_search_for']); - //* DEBUG: */ debugOutput('
mapper='.print_r($mapper, TRUE).'
ins_vers=
'.print_r($ins_vers, TRUE).'
'); - - // Is the content valid? - if ((!is_array($ins_vers)) || (count($ins_vers) <= 0) || (!isset($ins_vers[$mapper[$type]])) || (trim($ins_vers[$mapper[$type]]) == '') || ($ins_vers[0]) == 'new') { - // File needs update! - $new = TRUE; - } else { - // Generate fake cache entry - foreach ($mapper as $map => $idx) { - $GLOBALS['cache_array']['revision'][$map][0] = $ins_vers[$idx]; - } // END - foreach - - // Return found value - $ret = getRepositoryData($type); - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ret[' . $type . ']=' . $ret); - } - } - } - - // Has it been updated? - if ($new === TRUE) { - // Write it - writeToFile($FQFN, implode(PHP_EOL, getArrayFromRepositoryData())); - - // ... and call recursive - $ret = getRepositoryData($type); - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ret[' . $type . ']=' . $ret); - } // END - if - } - - // Return the value - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ret[' . $type . ']=' . $ret . ' - EXIT!'); - return $ret; -} - -// Extracts requested revision info from given file data -function extractRevisionInfoFromData ($fileData, $search) { - // Default is to return empty string - $ret = ''; - - // Searches for "$search-tag:VALUE$" or "$search-tag::VALUE$"(the stylish keywordversion ;-)) in the lates modified file - $GLOBALS['revision_res'] += preg_match('@\$' . $search . '(:|::) (.*) \$@U', $fileData, $t); - - // Make sure only valid and trimmed entries are used - if (isset($t[2])) { - $ret = trim($t[2]); - } // END - if - - // Return the result - return $ret; -} - -// Extracts requested revison info for given file name by reading it's content -// and parsing it with extractRevisionInfoFromData(). -function extractRevisionInfoFromFile ($FQFN, $search) { - // Read the file - $fileData = readFromFile($FQFN); - - // Call the extract function and return the result - return extractRevisionInfoFromData($fileData, $search); -} - -// Gets an array back for current repository data. -// @TODO This function does also set and get in 'cache_array' -function getArrayFromRepositoryData () { - // Init array - $GLOBALS['cache_array']['revision'] = array(); - - // Init variables - $next_dir = ''; - - // Directory to start with search - $last_changed = array( - 'path_name' => '', - 'time' => 0 - ); - - // Init return array - $akt_vers = array(); - - // Init value for counting the founded keywords - $GLOBALS['revision_res'] = '0'; - - // Searches all Files and there date of the last modifikation and puts the newest File in $last_changed. - searchDirsRecursive($next_dir, $last_changed, 'Revision'); - - // Get file - $last_file = readFromFile($last_changed['path_name']); - - // Save the last-changed filename for debugging - $GLOBALS['cache_array']['revision']['File'][0] = $last_changed['path_name']; - - // This foreach loops the $searchFor-Tags (array('Revision', 'Date', 'Tag', 'Author') --> could easaly extended in the future) - foreach ($GLOBALS['repository_search_for'] as $search) { - // This extracts the requested data $search from file data $last_file - if ($search != 'File') { - // Skip 'File' because we have set it some lines above - $GLOBALS['cache_array']['revision'][$search][0] = extractRevisionInfoFromData($last_file, $search); - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'search=' . $search . ',data=' . $GLOBALS['cache_array']['revision'][$search][0]); - } // END - if - } // END - foreach - - // at least 3 keyword-Tags are needed for propper values - if ($GLOBALS['revision_res'] && $GLOBALS['revision_res'] >= 3 - && isset($GLOBALS['cache_array']['revision']['Revision'][0]) && !empty($GLOBALS['cache_array']['revision']['Revision'][0]) - && isset($GLOBALS['cache_array']['revision']['Date'][0]) && !empty($GLOBALS['cache_array']['revision']['Date'][0]) - && isset($GLOBALS['cache_array']['revision']['Tag'][0]) && !empty($GLOBALS['cache_array']['revision']['Tag'][0])) { - // Prepare content witch need special treadment - - // Prepare timestamp for date - preg_match('@(....)-(..)-(..) (..):(..):(..)@', $GLOBALS['cache_array']['revision']['Date'][0], $match_d); - $GLOBALS['cache_array']['revision']['Date'][0] = mktime($match_d[4], $match_d[5], $match_d[6], $match_d[2], $match_d[3], $match_d[1]); - - // Add author to the Tag if the author is set and is not quix0r (lead coder) - if ((isset($GLOBALS['cache_array']['revision']['Author'][0])) && ($GLOBALS['cache_array']['revision']['Author'][0] != 'quix0r')) { - $GLOBALS['cache_array']['revision']['Tag'][0] .= '-' . strtoupper($GLOBALS['cache_array']['revision']['Author'][0]); - } // END - if - - } else { - // No valid Data from the last modificated file so read the Revision from the Server. Fallback-solution!! Should not be removed I think. - $version = sendHttpGetRequest('check-updates3.php'); - - // Invalid request reply? - if (!isset($version[11])) { - // Cannot continue here - reportBug(__FUNCTION__, __LINE__, 'Invalid response from check-updates3.php, count should be at least 11, is ' . count($version)); - } // END - if - - // Prepare content - // Only sets not setted or not proper values to the Online-Server-Fallback-Solution - foreach ($GLOBALS['repository_search_for'] as $entry) { - // Is it not set or empty? - if ((!isset($GLOBALS['cache_array']['revision'][$entry][0])) || (empty($GLOBALS['cache_array']['revision']['File'][0]))) { - // Is default data entry nummerical? - if (is_numeric($GLOBALS['default_repository_data'][$entry])) { - // Use entry from $version - $GLOBALS['cache_array']['revision'][$entry][0] = trim($version[$GLOBALS['default_repository_data'][$entry]]); - } else { - // Non-numeric -> use it directly - $GLOBALS['cache_array']['revision'][$entry][0] = $GLOBALS['default_repository_data'][$entry]; - } - } // END - if - } // END - if - } - - // Temporary remove [0] from array - $array = $GLOBALS['cache_array']['revision']; - foreach ($array as $key => $value) { - if ((is_array($value)) && (isset($value[0]))) { - unset($array[$key][0]); - $array[$key] = $value[0]; - } // END - if - } // END - if - - // Return prepared array - return $array; -} - -// [EOF] +// @DEPRECATED ?> diff --git a/inc/versions.php b/inc/versions.php index 0428116f93..f551ef47b7 100644 --- a/inc/versions.php +++ b/inc/versions.php @@ -1,51 +1,3 @@ diff --git a/inc/wrapper-functions.php b/inc/wrapper-functions.php index b315b3cb68..9cc88986eb 100644 --- a/inc/wrapper-functions.php +++ b/inc/wrapper-functions.php @@ -10,11 +10,6 @@ * -------------------------------------------------------------------- * * Kurzbeschreibung : Wrapper-Funktionen * * -------------------------------------------------------------------- * - * $Revision:: $ * - * $Date:: $ * - * $Tag:: 0.2.1-FINAL $ * - * $Author:: $ * - * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * * Copyright (c) 2009 - 2013 by Mailer Developer Team * * For more information visit: http://mxchange.org * @@ -1421,30 +1416,6 @@ function encodeEntities ($str) { return $str; } -// "Getter" for date from patch_ctime -function getDateFromRepository () { - // Is it cached? - if (!isset($GLOBALS[__FUNCTION__])) { - // Then set it - $GLOBALS[__FUNCTION__] = generateDateTime(getConfig('CURRENT_REPOSITORY_DATE'), '5'); - } // END - if - - // Return cache - return $GLOBALS[__FUNCTION__]; -} - -// "Getter" for date/time from patch_ctime -function getDateTimeFromRepository () { - // Is it cached? - if (!isset($GLOBALS[__FUNCTION__])) { - // Then set it - $GLOBALS[__FUNCTION__] = generateDateTime(getConfig('CURRENT_REPOSITORY_DATE'), '2'); - } // END - if - - // Return cache - return $GLOBALS[__FUNCTION__]; -} - // Getter for current year (default) function getYear ($timestamp = NULL) { // Is it cached? @@ -1913,6 +1884,18 @@ function getTableType () { return $GLOBALS[__FUNCTION__]; } +// "Getter" for db_type +function getDbType () { + // Is there cache? + if (!isset($GLOBALS[__FUNCTION__])) { + // Determine it + $GLOBALS[__FUNCTION__] = getConfig('_DB_TYPE'); + } // END - if + + // Return cache + return $GLOBALS[__FUNCTION__]; +} + // "Getter" for salt_length function getSaltLength () { // Is there cache? @@ -1961,18 +1944,6 @@ function getTitle () { return $GLOBALS[__FUNCTION__]; } -// "Getter" for curr_svn_revision -function getCurrentRepositoryRevision () { - // Is there cache? - if (!isset($GLOBALS[__FUNCTION__])) { - // Determine it - $GLOBALS[__FUNCTION__] = getConfig('CURRENT_REPOSITORY_REVISION'); - } // END - if - - // Return cache - return $GLOBALS[__FUNCTION__]; -} - // "Getter" for server_url function getServerUrl () { // Is there cache? @@ -3596,5 +3567,14 @@ function getGenericHashFileName () { return sprintf('%s%s.%s%s', getPath(), getCachePath(), getFileHash(), getCacheExtension()); } +// "Compiles" the given value and sets it in given key +function setSessionCompiled ($key, $value) { + // "Compile" the value + $value = doFinalCompilation(compileRawCode($value)); + + // And set it + return setSession($key, $value); +} + // [EOF] ?> diff --git a/templates/de/html/admin/admin_update_download.tpl b/templates/de/html/admin/admin_update_download.tpl index d9baa6f477..e03193280a 100644 --- a/templates/de/html/admin/admin_update_download.tpl +++ b/templates/de/html/admin/admin_update_download.tpl @@ -7,12 +7,12 @@
{--ADMIN_YOUR_VERSION_IS--}:
-
v{?FULL_VERSION?} R{?CURRENT_REPOSITORY_REVISION?}
+
v{?FULL_VERSION?}
{--ADMIN_ONLINE_VERSION_IS--}:
-
v$content[version] R$content[revision]
+
v$content[version]
diff --git a/templates/de/html/copyright.tpl b/templates/de/html/copyright.tpl index 89c86e42d0..1ca47ad182 100644 --- a/templates/de/html/copyright.tpl +++ b/templates/de/html/copyright.tpl @@ -2,7 +2,7 @@