Jelajahi Sumber

Merge branch 'FreshRSS/dev' into Minz_Dispatcher_paths

Alexandre Alapetite 8 tahun lalu
induk
melakukan
e6c1c7d4cb
4 mengubah file dengan 46 tambahan dan 26 penghapusan
  1. 1 0
      .gitignore
  2. 3 0
      CHANGELOG.md
  3. 41 26
      constants.php
  4. 1 0
      lib/Minz/Log.php

+ 1 - 0
.gitignore

@@ -0,0 +1 @@
+constants.local.php

+ 3 - 0
CHANGELOG.md

@@ -10,12 +10,14 @@
 	* Add more Unicode glyphs in the Open Sans font [#1032](https://github.com/FreshRSS/FreshRSS/pull/1032)
 	* Show URL to add subscriptions from third-party tools [#1247](https://github.com/FreshRSS/FreshRSS/issues/1247)
 	* Improved message when checking for new versions [#1586](https://github.com/FreshRSS/FreshRSS/issues/1586)
+	* Hebrew [#1716](https://github.com/FreshRSS/FreshRSS/pull/1716)
 * SimplePie
 	* Remove "SimplePie" name from HTTP User-Agent string [#1656](https://github.com/FreshRSS/FreshRSS/pull/1656)
 * Bug fixing
 	* Work-around for `CURLOPT_FOLLOWLOCATION` `open_basedir` bug in favicons and PubSubHubbub [#1655](https://github.com/FreshRSS/FreshRSS/issues/1655)
 	* Fix PDO PostgreSQL detection [#1690](https://github.com/FreshRSS/FreshRSS/issues/1690)
 	* Fix punycode warning in PHP 7.2 [#1699](https://github.com/FreshRSS/FreshRSS/issues/1699)
+	* Fix ExtensionManager exception handling [#1724](https://github.com/FreshRSS/FreshRSS/pull/1724)
 * CLI
 	* New command `./cli/db-optimize.php` for database optimisation [#1583](https://github.com/FreshRSS/FreshRSS/issues/1583)
 	* Check PHP requirements before running `actualize_script.php` (cron for refreshing feeds) [#1711](https://github.com/FreshRSS/FreshRSS/pull/1711)
@@ -27,6 +29,7 @@
 	* Show existing extensions in admin panel [#1708](https://github.com/FreshRSS/FreshRSS/pull/1708)
 	* New function `$entry->_hash($hex)` for extensions that change the content of entries [#1707](https://github.com/FreshRSS/FreshRSS/pull/1707)
 * Misc.
+	* Customisable `constants.local.php` [#1725](https://github.com/FreshRSS/FreshRSS/pull/1725)
 	* Basic mechanism to limit the size of the logs [#1712](https://github.com/FreshRSS/FreshRSS/pull/1712)
 	* Translation validation tool [#1653](https://github.com/FreshRSS/FreshRSS/pull/1653)
 	* Translation manipulation tool [#1658](https://github.com/FreshRSS/FreshRSS/pull/1658)

+ 41 - 26
constants.php

@@ -1,35 +1,50 @@
 <?php
+//NB: Do not edit; use ./constants.local.php instead.
+
+//<Not customisable>
 define('FRESHRSS_VERSION', '1.8.1-dev');
 define('FRESHRSS_WEBSITE', 'https://freshrss.org');
 define('FRESHRSS_WIKI', 'https://freshrss.github.io/FreshRSS/');
 
-define('FRESHRSS_USERAGENT', 'FreshRSS/' . FRESHRSS_VERSION . ' (' . PHP_OS . '; ' . FRESHRSS_WEBSITE . ')');
+define('FRESHRSS_PATH', __DIR__);
+define('PUBLIC_PATH', FRESHRSS_PATH . '/p');
+define('PUBLIC_TO_INDEX_PATH', '/i');
+define('INDEX_PATH', PUBLIC_PATH . PUBLIC_TO_INDEX_PATH);
+define('PUBLIC_RELATIVE', '..');
+define('LIB_PATH', FRESHRSS_PATH . '/lib');
+define('APP_PATH', FRESHRSS_PATH . '/app');
+define('EXTENSIONS_PATH', FRESHRSS_PATH . '/extensions');
+//</Not customisable>
+
+function safe_define($name, $value) {
+	if (!defined($name)) {
+		return define($name, $value);
+	}
+}
+
+if (file_exists(__DIR__ . '/constants.local.php')) {
+	//Include custom / local settings:
+	include(__DIR__ . '/constants.local.php');
+}
+
+safe_define('FRESHRSS_USERAGENT', 'FreshRSS/' . FRESHRSS_VERSION . ' (' . PHP_OS . '; ' . FRESHRSS_WEBSITE . ')');
 
 // PHP text output compression http://php.net/ob_gzhandler (better to do it at Web server level)
-define('PHP_COMPRESSION', false);
+safe_define('PHP_COMPRESSION', false);
 
 // Maximum log file size in Bytes, before it will be divided by two
-define('MAX_LOG_SIZE', 1048576);
-
-// Constantes de chemins
-define('FRESHRSS_PATH', dirname(__FILE__));
-
-	define('PUBLIC_PATH', FRESHRSS_PATH . '/p');
-		define('PUBLIC_TO_INDEX_PATH', '/i');
-		define('INDEX_PATH', PUBLIC_PATH . PUBLIC_TO_INDEX_PATH);
-		define('PUBLIC_RELATIVE', '..');
-
-	define('DATA_PATH', FRESHRSS_PATH . '/data');
-		define('UPDATE_FILENAME', DATA_PATH . '/update.php');
-		define('USERS_PATH', DATA_PATH . '/users');
-		define('ADMIN_LOG', USERS_PATH . '/_/log.txt');
-		define('API_LOG', USERS_PATH . '/_/log_api.txt');
-		define('CACHE_PATH', DATA_PATH . '/cache');
-		define('PSHB_LOG', USERS_PATH . '/_/log_pshb.txt');
-		define('PSHB_PATH', DATA_PATH . '/PubSubHubbub');
-
-	define('LIB_PATH', FRESHRSS_PATH . '/lib');
-	define('APP_PATH', FRESHRSS_PATH . '/app');
-	define('EXTENSIONS_PATH', FRESHRSS_PATH . '/extensions');
-
-define('TMP_PATH', sys_get_temp_dir());
+safe_define('MAX_LOG_SIZE', 1048576);
+
+//This directory must be writable
+safe_define('DATA_PATH', FRESHRSS_PATH . '/data');
+
+safe_define('UPDATE_FILENAME', DATA_PATH . '/update.php');
+safe_define('USERS_PATH', DATA_PATH . '/users');
+safe_define('ADMIN_LOG', USERS_PATH . '/_/log.txt');
+safe_define('API_LOG', USERS_PATH . '/_/log_api.txt');
+safe_define('CACHE_PATH', DATA_PATH . '/cache');
+safe_define('PSHB_LOG', USERS_PATH . '/_/log_pshb.txt');
+safe_define('PSHB_PATH', DATA_PATH . '/PubSubHubbub');
+
+//Directory used for feed mutex with *.freshrss.lock files. Must be writable.
+safe_define('TMP_PATH', sys_get_temp_dir());

+ 1 - 0
lib/Minz/Log.php

@@ -98,6 +98,7 @@ class Minz_Log {
 				rewind($fp);
 				ftruncate($fp, 0);
 				fwrite($fp, $content ? $content : '');
+				fwrite($fp, sprintf("[%s] [notice] --- Log rotate.\n", date('r')));
 				fflush($fp);
 				flock($fp, LOCK_UN);
 			} else {