From d9ba1cdd44a7eec9e7f4d429087c6ba838ad473e Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Tue, 17 Jul 2018 14:13:37 +0200 Subject: [PATCH 01/75] Do not check the IP address with session protection disabled This allows the user to stay logged in if his IP changes. Fixes #1106 --- application/security/LoginManager.php | 3 +++ tests/security/LoginManagerTest.php | 14 ++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/application/security/LoginManager.php b/application/security/LoginManager.php index d6784d6..5a58926 100644 --- a/application/security/LoginManager.php +++ b/application/security/LoginManager.php @@ -58,6 +58,9 @@ class LoginManager */ public function generateStaySignedInToken($clientIpAddress) { + if ($this->configManager->get('security.session_protection_disabled') === true) { + $clientIpAddress = ''; + } $this->staySignedInToken = sha1( $this->configManager->get('credentials.hash') . $clientIpAddress diff --git a/tests/security/LoginManagerTest.php b/tests/security/LoginManagerTest.php index f26cd1e..b9ab5ec 100644 --- a/tests/security/LoginManagerTest.php +++ b/tests/security/LoginManagerTest.php @@ -259,6 +259,20 @@ class LoginManagerTest extends TestCase ); } + /** + * Generate a token depending on the user credentials with session protected disabled + */ + public function testGenerateStaySignedInTokenSessionProtectionDisabled() + { + $this->configManager->set('security.session_protection_disabled', true); + $this->loginManager->generateStaySignedInToken($this->clientIpAddress); + + $this->assertEquals( + sha1($this->passwordHash . $this->salt), + $this->loginManager->getStaySignedInToken() + ); + } + /** * Check user login - Shaarli has not yet been configured */ From bdc5152d486ca75372c271f94623b248bc127800 Mon Sep 17 00:00:00 2001 From: VirtualTam Date: Sun, 2 Dec 2018 23:24:58 +0100 Subject: [PATCH 02/75] namespacing: \Shaarli\History Signed-off-by: VirtualTam --- application/History.php | 13 ++++++++---- application/NetscapeBookmarkUtils.php | 1 + application/api/controllers/ApiController.php | 2 +- index.php | 1 + tests/HistoryTest.php | 7 +++++-- .../BookmarkImportTest.php | 1 + tests/api/controllers/history/HistoryTest.php | 20 +++++++++---------- .../api/controllers/links/DeleteLinkTest.php | 6 +++--- tests/api/controllers/links/PostLinkTest.php | 8 ++++---- tests/api/controllers/links/PutLinkTest.php | 8 ++++---- tests/api/controllers/tags/DeleteTagTest.php | 10 +++++----- tests/api/controllers/tags/PutTagTest.php | 8 ++++---- tests/utils/ReferenceHistory.php | 2 ++ 13 files changed, 50 insertions(+), 37 deletions(-) diff --git a/application/History.php b/application/History.php index 35ec016..8074a01 100644 --- a/application/History.php +++ b/application/History.php @@ -1,4 +1,9 @@ historyFilePath)) { + if (!is_file($this->historyFilePath)) { FileUtils::writeFlatDB($this->historyFilePath, []); } - if (! is_writable($this->historyFilePath)) { + if (!is_writable($this->historyFilePath)) { throw new Exception(t('History file isn\'t readable or writable')); } } @@ -191,7 +196,7 @@ class History */ protected function write() { - $comparaison = new DateTime('-'. $this->retentionTime . ' seconds'); + $comparaison = new DateTime('-' . $this->retentionTime . ' seconds'); foreach ($this->history as $key => $value) { if ($value['datetime'] < $comparaison) { unset($this->history[$key]); diff --git a/application/NetscapeBookmarkUtils.php b/application/NetscapeBookmarkUtils.php index 84dd2b2..c0c007e 100644 --- a/application/NetscapeBookmarkUtils.php +++ b/application/NetscapeBookmarkUtils.php @@ -2,6 +2,7 @@ use Psr\Log\LogLevel; use Shaarli\Config\ConfigManager; +use Shaarli\History; use Shaarli\NetscapeBookmarkParser\NetscapeBookmarkParser; use Katzgrau\KLogger\Logger; diff --git a/application/api/controllers/ApiController.php b/application/api/controllers/ApiController.php index 9edefcf..47e0e17 100644 --- a/application/api/controllers/ApiController.php +++ b/application/api/controllers/ApiController.php @@ -30,7 +30,7 @@ abstract class ApiController protected $linkDb; /** - * @var \History + * @var \Shaarli\History */ protected $history; diff --git a/index.php b/index.php index acfcc66..cc41d80 100644 --- a/index.php +++ b/index.php @@ -76,6 +76,7 @@ require_once 'application/PluginManager.php'; require_once 'application/Router.php'; require_once 'application/Updater.php'; use \Shaarli\Config\ConfigManager; +use Shaarli\History; use \Shaarli\Languages; use \Shaarli\Security\LoginManager; use \Shaarli\Security\SessionManager; diff --git a/tests/HistoryTest.php b/tests/HistoryTest.php index d3bef5a..7723c46 100644 --- a/tests/HistoryTest.php +++ b/tests/HistoryTest.php @@ -1,9 +1,12 @@ container = new Container(); $this->container['conf'] = $this->conf; $this->container['db'] = true; - $this->container['history'] = new \History(self::$testHistory); + $this->container['history'] = new \Shaarli\History(self::$testHistory); $this->controller = new History($this->container); } @@ -78,35 +78,35 @@ class HistoryTest extends \PHPUnit_Framework_TestCase $this->assertEquals($this->refHistory->count(), count($data)); - $this->assertEquals(\History::DELETED, $data[0]['event']); + $this->assertEquals(\Shaarli\History::DELETED, $data[0]['event']); $this->assertEquals( \DateTime::createFromFormat('Ymd_His', '20170303_121216')->format(\DateTime::ATOM), $data[0]['datetime'] ); $this->assertEquals(124, $data[0]['id']); - $this->assertEquals(\History::SETTINGS, $data[1]['event']); + $this->assertEquals(\Shaarli\History::SETTINGS, $data[1]['event']); $this->assertEquals( \DateTime::createFromFormat('Ymd_His', '20170302_121215')->format(\DateTime::ATOM), $data[1]['datetime'] ); $this->assertNull($data[1]['id']); - $this->assertEquals(\History::UPDATED, $data[2]['event']); + $this->assertEquals(\Shaarli\History::UPDATED, $data[2]['event']); $this->assertEquals( \DateTime::createFromFormat('Ymd_His', '20170301_121214')->format(\DateTime::ATOM), $data[2]['datetime'] ); $this->assertEquals(123, $data[2]['id']); - $this->assertEquals(\History::CREATED, $data[3]['event']); + $this->assertEquals(\Shaarli\History::CREATED, $data[3]['event']); $this->assertEquals( \DateTime::createFromFormat('Ymd_His', '20170201_121214')->format(\DateTime::ATOM), $data[3]['datetime'] ); $this->assertEquals(124, $data[3]['id']); - $this->assertEquals(\History::CREATED, $data[4]['event']); + $this->assertEquals(\Shaarli\History::CREATED, $data[4]['event']); $this->assertEquals( \DateTime::createFromFormat('Ymd_His', '20170101_121212')->format(\DateTime::ATOM), $data[4]['datetime'] @@ -131,7 +131,7 @@ class HistoryTest extends \PHPUnit_Framework_TestCase $this->assertEquals(1, count($data)); - $this->assertEquals(\History::DELETED, $data[0]['event']); + $this->assertEquals(\Shaarli\History::DELETED, $data[0]['event']); $this->assertEquals( \DateTime::createFromFormat('Ymd_His', '20170303_121216')->format(\DateTime::ATOM), $data[0]['datetime'] @@ -156,7 +156,7 @@ class HistoryTest extends \PHPUnit_Framework_TestCase $this->assertEquals(1, count($data)); - $this->assertEquals(\History::CREATED, $data[0]['event']); + $this->assertEquals(\Shaarli\History::CREATED, $data[0]['event']); $this->assertEquals( \DateTime::createFromFormat('Ymd_His', '20170101_121212')->format(\DateTime::ATOM), $data[0]['datetime'] @@ -181,7 +181,7 @@ class HistoryTest extends \PHPUnit_Framework_TestCase $this->assertEquals(1, count($data)); - $this->assertEquals(\History::DELETED, $data[0]['event']); + $this->assertEquals(\Shaarli\History::DELETED, $data[0]['event']); $this->assertEquals( \DateTime::createFromFormat('Ymd_His', '20170303_121216')->format(\DateTime::ATOM), $data[0]['datetime'] @@ -206,7 +206,7 @@ class HistoryTest extends \PHPUnit_Framework_TestCase $this->assertEquals(1, count($data)); - $this->assertEquals(\History::SETTINGS, $data[0]['event']); + $this->assertEquals(\Shaarli\History::SETTINGS, $data[0]['event']); $this->assertEquals( \DateTime::createFromFormat('Ymd_His', '20170302_121215')->format(\DateTime::ATOM), $data[0]['datetime'] diff --git a/tests/api/controllers/links/DeleteLinkTest.php b/tests/api/controllers/links/DeleteLinkTest.php index 7d79713..07371e7 100644 --- a/tests/api/controllers/links/DeleteLinkTest.php +++ b/tests/api/controllers/links/DeleteLinkTest.php @@ -37,7 +37,7 @@ class DeleteLinkTest extends \PHPUnit_Framework_TestCase protected $linkDB; /** - * @var \History instance. + * @var \Shaarli\History instance. */ protected $history; @@ -62,7 +62,7 @@ class DeleteLinkTest extends \PHPUnit_Framework_TestCase $this->linkDB = new \LinkDB(self::$testDatastore, true, false); $refHistory = new \ReferenceHistory(); $refHistory->write(self::$testHistory); - $this->history = new \History(self::$testHistory); + $this->history = new \Shaarli\History(self::$testHistory); $this->container = new Container(); $this->container['conf'] = $this->conf; $this->container['db'] = $this->linkDB; @@ -100,7 +100,7 @@ class DeleteLinkTest extends \PHPUnit_Framework_TestCase $this->assertFalse(isset($this->linkDB[$id])); $historyEntry = $this->history->getHistory()[0]; - $this->assertEquals(\History::DELETED, $historyEntry['event']); + $this->assertEquals(\Shaarli\History::DELETED, $historyEntry['event']); $this->assertTrue( (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime'] ); diff --git a/tests/api/controllers/links/PostLinkTest.php b/tests/api/controllers/links/PostLinkTest.php index 5c2b562..a73f443 100644 --- a/tests/api/controllers/links/PostLinkTest.php +++ b/tests/api/controllers/links/PostLinkTest.php @@ -40,7 +40,7 @@ class PostLinkTest extends TestCase protected $refDB = null; /** - * @var \History instance. + * @var \Shaarli\History instance. */ protected $history; @@ -70,12 +70,12 @@ class PostLinkTest extends TestCase $refHistory = new \ReferenceHistory(); $refHistory->write(self::$testHistory); - $this->history = new \History(self::$testHistory); + $this->history = new \Shaarli\History(self::$testHistory); $this->container = new Container(); $this->container['conf'] = $this->conf; $this->container['db'] = new \LinkDB(self::$testDatastore, true, false); - $this->container['history'] = new \History(self::$testHistory); + $this->container['history'] = new \Shaarli\History(self::$testHistory); $this->controller = new Links($this->container); @@ -133,7 +133,7 @@ class PostLinkTest extends TestCase $this->assertEquals('', $data['updated']); $historyEntry = $this->history->getHistory()[0]; - $this->assertEquals(\History::CREATED, $historyEntry['event']); + $this->assertEquals(\Shaarli\History::CREATED, $historyEntry['event']); $this->assertTrue( (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime'] ); diff --git a/tests/api/controllers/links/PutLinkTest.php b/tests/api/controllers/links/PutLinkTest.php index f276b4c..3bb4d43 100644 --- a/tests/api/controllers/links/PutLinkTest.php +++ b/tests/api/controllers/links/PutLinkTest.php @@ -32,7 +32,7 @@ class PutLinkTest extends \PHPUnit_Framework_TestCase protected $refDB = null; /** - * @var \History instance. + * @var \Shaarli\History instance. */ protected $history; @@ -62,12 +62,12 @@ class PutLinkTest extends \PHPUnit_Framework_TestCase $refHistory = new \ReferenceHistory(); $refHistory->write(self::$testHistory); - $this->history = new \History(self::$testHistory); + $this->history = new \Shaarli\History(self::$testHistory); $this->container = new Container(); $this->container['conf'] = $this->conf; $this->container['db'] = new \LinkDB(self::$testDatastore, true, false); - $this->container['history'] = new \History(self::$testHistory); + $this->container['history'] = new \Shaarli\History(self::$testHistory); $this->controller = new Links($this->container); @@ -119,7 +119,7 @@ class PutLinkTest extends \PHPUnit_Framework_TestCase ); $historyEntry = $this->history->getHistory()[0]; - $this->assertEquals(\History::UPDATED, $historyEntry['event']); + $this->assertEquals(\Shaarli\History::UPDATED, $historyEntry['event']); $this->assertTrue( (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime'] ); diff --git a/tests/api/controllers/tags/DeleteTagTest.php b/tests/api/controllers/tags/DeleteTagTest.php index e0787ce..a1e419c 100644 --- a/tests/api/controllers/tags/DeleteTagTest.php +++ b/tests/api/controllers/tags/DeleteTagTest.php @@ -37,7 +37,7 @@ class DeleteTagTest extends \PHPUnit_Framework_TestCase protected $linkDB; /** - * @var \History instance. + * @var \Shaarli\History instance. */ protected $history; @@ -62,7 +62,7 @@ class DeleteTagTest extends \PHPUnit_Framework_TestCase $this->linkDB = new \LinkDB(self::$testDatastore, true, false); $refHistory = new \ReferenceHistory(); $refHistory->write(self::$testHistory); - $this->history = new \History(self::$testHistory); + $this->history = new \Shaarli\History(self::$testHistory); $this->container = new Container(); $this->container['conf'] = $this->conf; $this->container['db'] = $this->linkDB; @@ -103,12 +103,12 @@ class DeleteTagTest extends \PHPUnit_Framework_TestCase // 2 links affected $historyEntry = $this->history->getHistory()[0]; - $this->assertEquals(\History::UPDATED, $historyEntry['event']); + $this->assertEquals(\Shaarli\History::UPDATED, $historyEntry['event']); $this->assertTrue( (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime'] ); $historyEntry = $this->history->getHistory()[1]; - $this->assertEquals(\History::UPDATED, $historyEntry['event']); + $this->assertEquals(\Shaarli\History::UPDATED, $historyEntry['event']); $this->assertTrue( (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime'] ); @@ -137,7 +137,7 @@ class DeleteTagTest extends \PHPUnit_Framework_TestCase $this->assertTrue($tags[strtolower($tagName)] > 0); $historyEntry = $this->history->getHistory()[0]; - $this->assertEquals(\History::UPDATED, $historyEntry['event']); + $this->assertEquals(\Shaarli\History::UPDATED, $historyEntry['event']); $this->assertTrue( (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime'] ); diff --git a/tests/api/controllers/tags/PutTagTest.php b/tests/api/controllers/tags/PutTagTest.php index 3801724..c45fa72 100644 --- a/tests/api/controllers/tags/PutTagTest.php +++ b/tests/api/controllers/tags/PutTagTest.php @@ -33,7 +33,7 @@ class PutTagTest extends \PHPUnit_Framework_TestCase protected $refDB = null; /** - * @var \History instance. + * @var \Shaarli\History instance. */ protected $history; @@ -68,7 +68,7 @@ class PutTagTest extends \PHPUnit_Framework_TestCase $refHistory = new \ReferenceHistory(); $refHistory->write(self::$testHistory); - $this->history = new \History(self::$testHistory); + $this->history = new \Shaarli\History(self::$testHistory); $this->container = new Container(); $this->container['conf'] = $this->conf; @@ -113,12 +113,12 @@ class PutTagTest extends \PHPUnit_Framework_TestCase $this->assertEquals(2, $tags[$newName]); $historyEntry = $this->history->getHistory()[0]; - $this->assertEquals(\History::UPDATED, $historyEntry['event']); + $this->assertEquals(\Shaarli\History::UPDATED, $historyEntry['event']); $this->assertTrue( (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime'] ); $historyEntry = $this->history->getHistory()[1]; - $this->assertEquals(\History::UPDATED, $historyEntry['event']); + $this->assertEquals(\Shaarli\History::UPDATED, $historyEntry['event']); $this->assertTrue( (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime'] ); diff --git a/tests/utils/ReferenceHistory.php b/tests/utils/ReferenceHistory.php index 75cbb32..f19cdf2 100644 --- a/tests/utils/ReferenceHistory.php +++ b/tests/utils/ReferenceHistory.php @@ -1,5 +1,7 @@ Date: Sun, 2 Dec 2018 23:31:40 +0100 Subject: [PATCH 03/75] namespacing: \Shaarli\Exceptions\IOException Signed-off-by: VirtualTam --- application/FileUtils.php | 2 ++ application/LinkDB.php | 3 +++ application/Updater.php | 1 + application/config/ConfigJson.php | 2 +- application/config/ConfigManager.php | 2 +- application/config/ConfigPhp.php | 2 +- application/exceptions/IOException.php | 5 ++++- composer.json | 1 + tests/FileUtilsTest.php | 8 +++++--- tests/LinkDBTest.php | 4 +++- tests/config/ConfigJsonTest.php | 4 ++-- 11 files changed, 24 insertions(+), 10 deletions(-) diff --git a/application/FileUtils.php b/application/FileUtils.php index b89ea12..ba40982 100644 --- a/application/FileUtils.php +++ b/application/FileUtils.php @@ -1,5 +1,7 @@ path = $path; $this->message = empty($message) ? t('Error accessing') : $message; - $this->message .= ' "' . $this->path .'"'; + $this->message .= ' "' . $this->path . '"'; } } diff --git a/composer.json b/composer.json index dccf83b..027203f 100644 --- a/composer.json +++ b/composer.json @@ -36,6 +36,7 @@ "Shaarli\\Api\\Exceptions\\": "application/api/exceptions", "Shaarli\\Config\\": "application/config/", "Shaarli\\Config\\Exception\\": "application/config/exception", + "Shaarli\\Exceptions\\": "application/exceptions", "Shaarli\\Security\\": "application/security" } } diff --git a/tests/FileUtilsTest.php b/tests/FileUtilsTest.php index d764e49..9596dba 100644 --- a/tests/FileUtilsTest.php +++ b/tests/FileUtilsTest.php @@ -1,5 +1,7 @@ Date: Mon, 3 Dec 2018 00:08:04 +0100 Subject: [PATCH 04/75] namespacing: \Shaarli\Feed\{Cache,CachedPage,FeedBuilder} Signed-off-by: VirtualTam --- application/{ => feed}/Cache.php | 0 application/{ => feed}/CachedPage.php | 4 ++- application/{ => feed}/FeedBuilder.php | 37 ++++++++++++++------------ composer.json | 1 + index.php | 8 +++--- plugins/pubsubhubbub/pubsubhubbub.php | 1 + tests/LinkDBTest.php | 4 +-- tests/{ => feed}/CacheTest.php | 23 ++++++++-------- tests/{ => feed}/CachedPageTest.php | 9 +++---- tests/{ => feed}/FeedBuilderTest.php | 11 +++++--- 10 files changed, 54 insertions(+), 44 deletions(-) rename application/{ => feed}/Cache.php (100%) rename application/{ => feed}/CachedPage.php (93%) rename application/{ => feed}/FeedBuilder.php (87%) rename tests/{ => feed}/CacheTest.php (68%) rename tests/{ => feed}/CachedPageTest.php (92%) rename tests/{ => feed}/FeedBuilderTest.php (97%) diff --git a/application/Cache.php b/application/feed/Cache.php similarity index 100% rename from application/Cache.php rename to application/feed/Cache.php diff --git a/application/CachedPage.php b/application/feed/CachedPage.php similarity index 93% rename from application/CachedPage.php rename to application/feed/CachedPage.php index e11cc52..1c51ac7 100644 --- a/application/CachedPage.php +++ b/application/feed/CachedPage.php @@ -1,4 +1,6 @@ cacheDir = $cacheDir; - $this->filename = $this->cacheDir.'/'.sha1($url).'.cache'; + $this->filename = $this->cacheDir . '/' . sha1($url) . '.cache'; $this->shouldBeCached = $shouldBeCached; } diff --git a/application/FeedBuilder.php b/application/feed/FeedBuilder.php similarity index 87% rename from application/FeedBuilder.php rename to application/feed/FeedBuilder.php index 73fafcb..dcfd2c8 100644 --- a/application/FeedBuilder.php +++ b/application/feed/FeedBuilder.php @@ -1,4 +1,8 @@ hideDates || $this->isLoggedIn; // Remove leading slash from REQUEST_URI. $data['self_link'] = escape(server_url($this->serverInfo)) - . escape($this->serverInfo['REQUEST_URI']); + . escape($this->serverInfo['REQUEST_URI']); $data['index_url'] = $pageaddr; $data['usepermalinks'] = $this->usePermalinks === true; $data['links'] = $linkDisplayed; @@ -142,18 +146,18 @@ class FeedBuilder */ protected function buildItem($link, $pageaddr) { - $link['guid'] = $pageaddr .'?'. $link['shorturl']; + $link['guid'] = $pageaddr . '?' . $link['shorturl']; // Check for both signs of a note: starting with ? and 7 chars long. if ($link['url'][0] === '?' && strlen($link['url']) === 7) { $link['url'] = $pageaddr . $link['url']; } if ($this->usePermalinks === true) { - $permalink = ''. t('Direct link') .''; + $permalink = '' . t('Direct link') . ''; } else { - $permalink = ''. t('Permalink') .''; + $permalink = '' . t('Permalink') . ''; } - $link['description'] = format_description($link['description'], '', false, $pageaddr); - $link['description'] .= PHP_EOL .'
— '. $permalink; + $link['description'] = format_description($link['description'], '', false, $pageaddr); + $link['description'] .= PHP_EOL . '
— ' . $permalink; $pubDate = $link['created']; $link['pub_iso_date'] = $this->getIsoDate($pubDate); @@ -164,7 +168,6 @@ class FeedBuilder $link['up_iso_date'] = $this->getIsoDate($upDate, DateTime::ATOM); } else { $link['up_iso_date'] = $this->getIsoDate($pubDate, DateTime::ATOM); - ; } // Save the more recent item. @@ -223,11 +226,11 @@ class FeedBuilder public function getTypeLanguage() { // Use the locale do define the language, if available. - if (! empty($this->locale) && preg_match('/^\w{2}[_\-]\w{2}/', $this->locale)) { - $length = ($this->feedType == self::$FEED_RSS) ? 5 : 2; + if (!empty($this->locale) && preg_match('/^\w{2}[_\-]\w{2}/', $this->locale)) { + $length = ($this->feedType === self::$FEED_RSS) ? 5 : 2; return str_replace('_', '-', substr($this->locale, 0, $length)); } - return ($this->feedType == self::$FEED_RSS) ? 'en-en' : 'en'; + return ($this->feedType === self::$FEED_RSS) ? 'en-en' : 'en'; } /** @@ -287,7 +290,7 @@ class FeedBuilder } $intNb = intval($this->userInput['nb']); - if (! is_int($intNb) || $intNb == 0) { + if (!is_int($intNb) || $intNb == 0) { return self::$DEFAULT_NB_LINKS; } diff --git a/composer.json b/composer.json index 027203f..7c9cbf3 100644 --- a/composer.json +++ b/composer.json @@ -37,6 +37,7 @@ "Shaarli\\Config\\": "application/config/", "Shaarli\\Config\\Exception\\": "application/config/exception", "Shaarli\\Exceptions\\": "application/exceptions", + "Shaarli\\Feed\\": "application/feed", "Shaarli\\Security\\": "application/security" } } diff --git a/index.php b/index.php index cc41d80..6d1ae3f 100644 --- a/index.php +++ b/index.php @@ -57,10 +57,8 @@ require_once __DIR__ . '/vendor/autoload.php'; // Shaarli library require_once 'application/ApplicationUtils.php'; -require_once 'application/Cache.php'; -require_once 'application/CachedPage.php'; require_once 'application/config/ConfigPlugin.php'; -require_once 'application/FeedBuilder.php'; +require_once 'application/feed/Cache.php'; require_once 'application/FileUtils.php'; require_once 'application/History.php'; require_once 'application/HttpUtils.php'; @@ -76,7 +74,9 @@ require_once 'application/PluginManager.php'; require_once 'application/Router.php'; require_once 'application/Updater.php'; use \Shaarli\Config\ConfigManager; -use Shaarli\History; +use \Shaarli\Feed\CachedPage; +use \Shaarli\Feed\FeedBuilder; +use \Shaarli\History; use \Shaarli\Languages; use \Shaarli\Security\LoginManager; use \Shaarli\Security\SessionManager; diff --git a/plugins/pubsubhubbub/pubsubhubbub.php b/plugins/pubsubhubbub/pubsubhubbub.php index 9f0342a..1872af8 100644 --- a/plugins/pubsubhubbub/pubsubhubbub.php +++ b/plugins/pubsubhubbub/pubsubhubbub.php @@ -11,6 +11,7 @@ use pubsubhubbub\publisher\Publisher; use Shaarli\Config\ConfigManager; +use Shaarli\Feed\FeedBuilder; /** * Plugin init function - set the hub to the default appspot one. diff --git a/tests/LinkDBTest.php b/tests/LinkDBTest.php index 9b2f35e..737a224 100644 --- a/tests/LinkDBTest.php +++ b/tests/LinkDBTest.php @@ -3,9 +3,7 @@ * Link datastore tests */ -use Shaarli\Exceptions\IOException; - -require_once 'application/Cache.php'; +require_once 'application/feed/Cache.php'; require_once 'application/FileUtils.php'; require_once 'application/LinkDB.php'; require_once 'application/Utils.php'; diff --git a/tests/CacheTest.php b/tests/feed/CacheTest.php similarity index 68% rename from tests/CacheTest.php rename to tests/feed/CacheTest.php index f60fad9..c0a9f26 100644 --- a/tests/CacheTest.php +++ b/tests/feed/CacheTest.php @@ -2,16 +2,17 @@ /** * Cache tests */ +namespace Shaarli\Feed; // required to access $_SESSION array session_start(); -require_once 'application/Cache.php'; +require_once 'application/feed/Cache.php'; /** * Unitary tests for cached pages */ -class CacheTest extends PHPUnit_Framework_TestCase +class CacheTest extends \PHPUnit\Framework\TestCase { // test cache directory protected static $testCacheDir = 'sandbox/dummycache'; @@ -25,16 +26,16 @@ class CacheTest extends PHPUnit_Framework_TestCase */ public function setUp() { - if (! is_dir(self::$testCacheDir)) { + if (!is_dir(self::$testCacheDir)) { mkdir(self::$testCacheDir); } else { - array_map('unlink', glob(self::$testCacheDir.'/*')); + array_map('unlink', glob(self::$testCacheDir . '/*')); } foreach (self::$pages as $page) { - file_put_contents(self::$testCacheDir.'/'.$page.'.cache', $page); + file_put_contents(self::$testCacheDir . '/' . $page . '.cache', $page); } - file_put_contents(self::$testCacheDir.'/intru.der', 'ShouldNotBeThere'); + file_put_contents(self::$testCacheDir . '/intru.der', 'ShouldNotBeThere'); } /** @@ -42,7 +43,7 @@ class CacheTest extends PHPUnit_Framework_TestCase */ public function tearDown() { - array_map('unlink', glob(self::$testCacheDir.'/*')); + array_map('unlink', glob(self::$testCacheDir . '/*')); rmdir(self::$testCacheDir); } @@ -53,10 +54,10 @@ class CacheTest extends PHPUnit_Framework_TestCase { purgeCachedPages(self::$testCacheDir); foreach (self::$pages as $page) { - $this->assertFileNotExists(self::$testCacheDir.'/'.$page.'.cache'); + $this->assertFileNotExists(self::$testCacheDir . '/' . $page . '.cache'); } - $this->assertFileExists(self::$testCacheDir.'/intru.der'); + $this->assertFileExists(self::$testCacheDir . '/intru.der'); } /** @@ -68,7 +69,7 @@ class CacheTest extends PHPUnit_Framework_TestCase ini_set('error_log', '/dev/null'); $this->assertEquals( 'Cannot purge sandbox/dummycache_missing: no directory', - purgeCachedPages(self::$testCacheDir.'_missing') + purgeCachedPages(self::$testCacheDir . '_missing') ); ini_set('error_log', $oldlog); } @@ -83,7 +84,7 @@ class CacheTest extends PHPUnit_Framework_TestCase invalidateCaches(self::$testCacheDir); foreach (self::$pages as $page) { - $this->assertFileNotExists(self::$testCacheDir.'/'.$page.'.cache'); + $this->assertFileNotExists(self::$testCacheDir . '/' . $page . '.cache'); } $this->assertArrayNotHasKey('tags', $_SESSION); diff --git a/tests/CachedPageTest.php b/tests/feed/CachedPageTest.php similarity index 92% rename from tests/CachedPageTest.php rename to tests/feed/CachedPageTest.php index 51565cd..0bcc144 100644 --- a/tests/CachedPageTest.php +++ b/tests/feed/CachedPageTest.php @@ -2,13 +2,12 @@ /** * PageCache tests */ - -require_once 'application/CachedPage.php'; +namespace Shaarli\Feed; /** * Unitary tests for cached pages */ -class CachedPageTest extends PHPUnit_Framework_TestCase +class CachedPageTest extends \PHPUnit\Framework\TestCase { // test cache directory protected static $testCacheDir = 'sandbox/pagecache'; @@ -20,10 +19,10 @@ class CachedPageTest extends PHPUnit_Framework_TestCase */ public static function setUpBeforeClass() { - if (! is_dir(self::$testCacheDir)) { + if (!is_dir(self::$testCacheDir)) { mkdir(self::$testCacheDir); } - self::$filename = self::$testCacheDir.'/'.sha1(self::$url).'.cache'; + self::$filename = self::$testCacheDir . '/' . sha1(self::$url) . '.cache'; } /** diff --git a/tests/FeedBuilderTest.php b/tests/feed/FeedBuilderTest.php similarity index 97% rename from tests/FeedBuilderTest.php rename to tests/feed/FeedBuilderTest.php index 4ca58e5..1fdbc60 100644 --- a/tests/FeedBuilderTest.php +++ b/tests/feed/FeedBuilderTest.php @@ -1,6 +1,11 @@ assertEquals('http://host.tld/?WDWyig', $link['url']); $this->assertRegExp('/Tue, 10 Mar 2015 11:46:51 \+\d{4}/', $link['pub_iso_date']); $pub = DateTime::createFromFormat(DateTime::RSS, $link['pub_iso_date']); - $up = DateTime::createFromFormat(DateTime::ATOM, $link['up_iso_date']); + $up = DateTime::createFromFormat(DateTime::ATOM, $link['up_iso_date']); $this->assertEquals($pub, $up); $this->assertContains('Stallman has a beard', $link['description']); $this->assertContains('Permalink', $link['description']); From 00af48d9d20af1ce51c8ad42fe354fafc9ceb8a3 Mon Sep 17 00:00:00 2001 From: VirtualTam Date: Mon, 3 Dec 2018 00:16:10 +0100 Subject: [PATCH 05/75] namespacing: \Shaarli\Http\Base64Url Signed-off-by: VirtualTam --- application/api/ApiUtils.php | 6 +++--- application/{ => http}/Base64Url.php | 2 +- composer.json | 1 + tests/api/ApiUtilsTest.php | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) rename application/{ => http}/Base64Url.php (96%) diff --git a/application/api/ApiUtils.php b/application/api/ApiUtils.php index fc5ecaf..e51b73e 100644 --- a/application/api/ApiUtils.php +++ b/application/api/ApiUtils.php @@ -1,7 +1,7 @@ Date: Mon, 3 Dec 2018 00:23:35 +0100 Subject: [PATCH 06/75] namespacing: \Shaarli\Http\Url Signed-off-by: VirtualTam --- application/HttpUtils.php | 3 + application/Url.php | 218 +------------------------------- application/http/Url.php | 217 +++++++++++++++++++++++++++++++ tests/{Url => http}/UrlTest.php | 23 ++-- 4 files changed, 234 insertions(+), 227 deletions(-) create mode 100644 application/http/Url.php rename tests/{Url => http}/UrlTest.php (88%) diff --git a/application/HttpUtils.php b/application/HttpUtils.php index 9c43816..51af5d0 100644 --- a/application/HttpUtils.php +++ b/application/HttpUtils.php @@ -1,4 +1,7 @@ cleanup(); } @@ -47,7 +47,7 @@ function cleanup_url($url) */ function get_url_scheme($url) { - $obj_url = new Url($url); + $obj_url = new \Shaarli\Http\Url($url); return $obj_url->getScheme(); } @@ -86,217 +86,3 @@ function whitelist_protocols($url, $protocols) } return $url; } - -/** - * URL representation and cleanup utilities - * - * Form - * scheme://[username:password@]host[:port][/path][?query][#fragment] - * - * Examples - * http://username:password@hostname:9090/path?arg1=value1&arg2=value2#anchor - * https://host.name.tld - * https://h2.g2/faq/?vendor=hitchhiker&item=guide&dest=galaxy#answer - * - * @see http://www.faqs.org/rfcs/rfc3986.html - */ -class Url -{ - private static $annoyingQueryParams = array( - // Facebook - 'action_object_map=', - 'action_ref_map=', - 'action_type_map=', - 'fb_', - 'fb=', - 'PHPSESSID=', - - // Scoop.it - '__scoop', - - // Google Analytics & FeedProxy - 'utm_', - - // ATInternet - 'xtor=', - - // Other - 'campaign_' - ); - - private static $annoyingFragments = array( - // ATInternet - 'xtor=RSS-', - - // Misc. - 'tk.rss_all' - ); - - /* - * URL parts represented as an array - * - * @see http://php.net/parse_url - */ - protected $parts; - - /** - * Parses a string containing a URL - * - * @param string $url a string containing a URL - */ - public function __construct($url) - { - $url = self::cleanupUnparsedUrl(trim($url)); - $this->parts = parse_url($url); - - if (!empty($url) && empty($this->parts['scheme'])) { - $this->parts['scheme'] = 'http'; - } - } - - /** - * Clean up URL before it's parsed. - * ie. handle urlencode, url prefixes, etc. - * - * @param string $url URL to clean. - * - * @return string cleaned URL. - */ - protected static function cleanupUnparsedUrl($url) - { - return self::removeFirefoxAboutReader($url); - } - - /** - * Remove Firefox Reader prefix if it's present. - * - * @param string $input url - * - * @return string cleaned url - */ - protected static function removeFirefoxAboutReader($input) - { - $firefoxPrefix = 'about://reader?url='; - if (startsWith($input, $firefoxPrefix)) { - return urldecode(ltrim($input, $firefoxPrefix)); - } - return $input; - } - - /** - * Returns a string representation of this URL - */ - public function toString() - { - return unparse_url($this->parts); - } - - /** - * Removes undesired query parameters - */ - protected function cleanupQuery() - { - if (! isset($this->parts['query'])) { - return; - } - - $queryParams = explode('&', $this->parts['query']); - - foreach (self::$annoyingQueryParams as $annoying) { - foreach ($queryParams as $param) { - if (startsWith($param, $annoying)) { - $queryParams = array_diff($queryParams, array($param)); - continue; - } - } - } - - if (count($queryParams) == 0) { - unset($this->parts['query']); - return; - } - - $this->parts['query'] = implode('&', $queryParams); - } - - /** - * Removes undesired fragments - */ - protected function cleanupFragment() - { - if (! isset($this->parts['fragment'])) { - return; - } - - foreach (self::$annoyingFragments as $annoying) { - if (startsWith($this->parts['fragment'], $annoying)) { - unset($this->parts['fragment']); - break; - } - } - } - - /** - * Removes undesired query parameters and fragments - * - * @return string the string representation of this URL after cleanup - */ - public function cleanup() - { - $this->cleanupQuery(); - $this->cleanupFragment(); - return $this->toString(); - } - - /** - * Converts an URL with an International Domain Name host to a ASCII one. - * This requires PHP-intl. If it's not available, just returns this->cleanup(). - * - * @return string converted cleaned up URL. - */ - public function idnToAscii() - { - $out = $this->cleanup(); - if (! function_exists('idn_to_ascii') || ! isset($this->parts['host'])) { - return $out; - } - $asciiHost = idn_to_ascii($this->parts['host'], 0, INTL_IDNA_VARIANT_UTS46); - return str_replace($this->parts['host'], $asciiHost, $out); - } - - /** - * Get URL scheme. - * - * @return string the URL scheme or false if none is provided. - */ - public function getScheme() - { - if (!isset($this->parts['scheme'])) { - return false; - } - return $this->parts['scheme']; - } - - /** - * Get URL host. - * - * @return string the URL host or false if none is provided. - */ - public function getHost() - { - if (empty($this->parts['host'])) { - return false; - } - return $this->parts['host']; - } - - /** - * Test if the Url is an HTTP one. - * - * @return true is HTTP, false otherwise. - */ - public function isHttp() - { - return strpos(strtolower($this->parts['scheme']), 'http') !== false; - } -} diff --git a/application/http/Url.php b/application/http/Url.php new file mode 100644 index 0000000..260231c --- /dev/null +++ b/application/http/Url.php @@ -0,0 +1,217 @@ +parts = parse_url($url); + + if (!empty($url) && empty($this->parts['scheme'])) { + $this->parts['scheme'] = 'http'; + } + } + + /** + * Clean up URL before it's parsed. + * ie. handle urlencode, url prefixes, etc. + * + * @param string $url URL to clean. + * + * @return string cleaned URL. + */ + protected static function cleanupUnparsedUrl($url) + { + return self::removeFirefoxAboutReader($url); + } + + /** + * Remove Firefox Reader prefix if it's present. + * + * @param string $input url + * + * @return string cleaned url + */ + protected static function removeFirefoxAboutReader($input) + { + $firefoxPrefix = 'about://reader?url='; + if (startsWith($input, $firefoxPrefix)) { + return urldecode(ltrim($input, $firefoxPrefix)); + } + return $input; + } + + /** + * Returns a string representation of this URL + */ + public function toString() + { + return unparse_url($this->parts); + } + + /** + * Removes undesired query parameters + */ + protected function cleanupQuery() + { + if (!isset($this->parts['query'])) { + return; + } + + $queryParams = explode('&', $this->parts['query']); + + foreach (self::$annoyingQueryParams as $annoying) { + foreach ($queryParams as $param) { + if (startsWith($param, $annoying)) { + $queryParams = array_diff($queryParams, array($param)); + continue; + } + } + } + + if (count($queryParams) == 0) { + unset($this->parts['query']); + return; + } + + $this->parts['query'] = implode('&', $queryParams); + } + + /** + * Removes undesired fragments + */ + protected function cleanupFragment() + { + if (!isset($this->parts['fragment'])) { + return; + } + + foreach (self::$annoyingFragments as $annoying) { + if (startsWith($this->parts['fragment'], $annoying)) { + unset($this->parts['fragment']); + break; + } + } + } + + /** + * Removes undesired query parameters and fragments + * + * @return string the string representation of this URL after cleanup + */ + public function cleanup() + { + $this->cleanupQuery(); + $this->cleanupFragment(); + return $this->toString(); + } + + /** + * Converts an URL with an International Domain Name host to a ASCII one. + * This requires PHP-intl. If it's not available, just returns this->cleanup(). + * + * @return string converted cleaned up URL. + */ + public function idnToAscii() + { + $out = $this->cleanup(); + if (!function_exists('idn_to_ascii') || !isset($this->parts['host'])) { + return $out; + } + $asciiHost = idn_to_ascii($this->parts['host'], 0, INTL_IDNA_VARIANT_UTS46); + return str_replace($this->parts['host'], $asciiHost, $out); + } + + /** + * Get URL scheme. + * + * @return string the URL scheme or false if none is provided. + */ + public function getScheme() + { + if (!isset($this->parts['scheme'])) { + return false; + } + return $this->parts['scheme']; + } + + /** + * Get URL host. + * + * @return string the URL host or false if none is provided. + */ + public function getHost() + { + if (empty($this->parts['host'])) { + return false; + } + return $this->parts['host']; + } + + /** + * Test if the Url is an HTTP one. + * + * @return true is HTTP, false otherwise. + */ + public function isHttp() + { + return strpos(strtolower($this->parts['scheme']), 'http') !== false; + } +} diff --git a/tests/Url/UrlTest.php b/tests/http/UrlTest.php similarity index 88% rename from tests/Url/UrlTest.php rename to tests/http/UrlTest.php index db229ce..011b416 100644 --- a/tests/Url/UrlTest.php +++ b/tests/http/UrlTest.php @@ -3,12 +3,13 @@ * Url's tests */ -require_once 'application/Url.php'; +namespace Shaarli\Http; + /** * Unitary tests for URL utilities */ -class UrlTest extends PHPUnit_Framework_TestCase +class UrlTest extends \PHPUnit\Framework\TestCase { // base URL for tests protected static $baseUrl = 'http://domain.tld:3000'; @@ -18,7 +19,7 @@ class UrlTest extends PHPUnit_Framework_TestCase */ private function assertUrlIsCleaned($query = '', $fragment = '') { - $url = new Url(self::$baseUrl.$query.$fragment); + $url = new Url(self::$baseUrl . $query . $fragment); $url->cleanup(); $this->assertEquals(self::$baseUrl, $url->toString()); } @@ -38,7 +39,7 @@ class UrlTest extends PHPUnit_Framework_TestCase public function testConstruct() { $ref = 'http://username:password@hostname:9090/path' - .'?arg1=value1&arg2=value2#anchor'; + . '?arg1=value1&arg2=value2#anchor'; $url = new Url($ref); $this->assertEquals($ref, $url->toString()); } @@ -52,7 +53,7 @@ class UrlTest extends PHPUnit_Framework_TestCase $this->assertUrlIsCleaned(); // URL with no annoying elements - $ref = self::$baseUrl.'?p1=val1&p2=1234#edit'; + $ref = self::$baseUrl . '?p1=val1&p2=1234#edit'; $url = new Url($ref); $this->assertEquals($ref, $url->cleanup()); } @@ -115,26 +116,26 @@ class UrlTest extends PHPUnit_Framework_TestCase // ditch annoying query params and fragment, keep useful params $url = new Url( self::$baseUrl - .'?fb=zomg&my=stuff&utm_medium=numnum&is=kept#tk.rss_all' + . '?fb=zomg&my=stuff&utm_medium=numnum&is=kept#tk.rss_all' ); - $this->assertEquals(self::$baseUrl.'?my=stuff&is=kept', $url->cleanup()); + $this->assertEquals(self::$baseUrl . '?my=stuff&is=kept', $url->cleanup()); // ditch annoying query params, keep useful params and fragment $url = new Url( self::$baseUrl - .'?fb=zomg&my=stuff&utm_medium=numnum&is=kept#again' + . '?fb=zomg&my=stuff&utm_medium=numnum&is=kept#again' ); $this->assertEquals( - self::$baseUrl.'?my=stuff&is=kept#again', + self::$baseUrl . '?my=stuff&is=kept#again', $url->cleanup() ); // test firefox reader url $url = new Url( - 'about://reader?url=' . urlencode(self::$baseUrl .'?my=stuff&is=kept') + 'about://reader?url=' . urlencode(self::$baseUrl . '?my=stuff&is=kept') ); - $this->assertEquals(self::$baseUrl.'?my=stuff&is=kept', $url->cleanup()); + $this->assertEquals(self::$baseUrl . '?my=stuff&is=kept', $url->cleanup()); } /** From 51753e403fa69c0ce124ede27d300477e3e799ca Mon Sep 17 00:00:00 2001 From: VirtualTam Date: Mon, 3 Dec 2018 00:34:53 +0100 Subject: [PATCH 07/75] namespacing: move HTTP utilities along \Shaarli\Http\ classes Signed-off-by: VirtualTam --- application/{ => http}/HttpUtils.php | 2 +- application/http/Url.php | 2 +- application/{Url.php => http/UrlUtils.php} | 4 ++-- index.php | 4 ++-- tests/{ => http}/HttpUtils/ClientIpIdTest.php | 6 ++++-- tests/{ => http}/HttpUtils/GetHttpUrlTest.php | 10 ++++++---- .../{ => http}/HttpUtils/GetIpAdressFromProxyTest.php | 6 ++++-- tests/{ => http}/HttpUtils/IndexUrlTest.php | 6 ++++-- tests/{ => http}/HttpUtils/IsHttpsTest.php | 5 ++++- tests/{ => http}/HttpUtils/PageUrlTest.php | 6 ++++-- tests/{ => http}/HttpUtils/ServerUrlTest.php | 6 ++++-- tests/http/UrlTest.php | 2 +- tests/{Url => http/UrlUtils}/CleanupUrlTest.php | 6 ++++-- tests/{Url => http/UrlUtils}/GetUrlSchemeTest.php | 10 ++++++---- tests/{Url => http/UrlUtils}/UnparseUrlTest.php | 8 +++++--- .../{Url => http/UrlUtils}/WhitelistProtocolsTest.php | 8 ++++---- 16 files changed, 56 insertions(+), 35 deletions(-) rename application/{ => http}/HttpUtils.php (99%) rename application/{Url.php => http/UrlUtils.php} (95%) rename tests/{ => http}/HttpUtils/ClientIpIdTest.php (89%) rename tests/{ => http}/HttpUtils/GetHttpUrlTest.php (85%) rename tests/{ => http}/HttpUtils/GetIpAdressFromProxyTest.php (91%) rename tests/{ => http}/HttpUtils/IndexUrlTest.php (92%) rename tests/{ => http}/HttpUtils/IsHttpsTest.php (89%) rename tests/{ => http}/HttpUtils/PageUrlTest.php (93%) rename tests/{ => http}/HttpUtils/ServerUrlTest.php (97%) rename tests/{Url => http/UrlUtils}/CleanupUrlTest.php (96%) rename tests/{Url => http/UrlUtils}/GetUrlSchemeTest.php (76%) rename tests/{Url => http/UrlUtils}/UnparseUrlTest.php (76%) rename tests/{Url => http/UrlUtils}/WhitelistProtocolsTest.php (91%) diff --git a/application/HttpUtils.php b/application/http/HttpUtils.php similarity index 99% rename from application/HttpUtils.php rename to application/http/HttpUtils.php index 51af5d0..2ea9195 100644 --- a/application/HttpUtils.php +++ b/application/http/HttpUtils.php @@ -41,7 +41,7 @@ function get_http_response($url, $timeout = 30, $maxBytes = 4194304, $curlWriteF $cleanUrl = $urlObj->idnToAscii(); if (!filter_var($cleanUrl, FILTER_VALIDATE_URL) || !$urlObj->isHttp()) { - return array(array(0 => 'Invalid HTTP Url'), false); + return array(array(0 => 'Invalid HTTP UrlUtils'), false); } $userAgent = diff --git a/application/http/Url.php b/application/http/Url.php index 260231c..90444a2 100644 --- a/application/http/Url.php +++ b/application/http/Url.php @@ -206,7 +206,7 @@ class Url } /** - * Test if the Url is an HTTP one. + * Test if the UrlUtils is an HTTP one. * * @return true is HTTP, false otherwise. */ diff --git a/application/Url.php b/application/http/UrlUtils.php similarity index 95% rename from application/Url.php rename to application/http/UrlUtils.php index 81f72fb..4bc84b8 100644 --- a/application/Url.php +++ b/application/http/UrlUtils.php @@ -28,7 +28,7 @@ function unparse_url($parsedUrl) /** * Removes undesired query parameters and fragments * - * @param string url Url to be cleaned + * @param string url UrlUtils to be cleaned * * @return string the string representation of this URL after cleanup */ @@ -41,7 +41,7 @@ function cleanup_url($url) /** * Get URL scheme. * - * @param string url Url for which the scheme is requested + * @param string url UrlUtils for which the scheme is requested * * @return mixed the URL scheme or false if none is provided. */ diff --git a/index.php b/index.php index 6d1ae3f..66fe30f 100644 --- a/index.php +++ b/index.php @@ -59,16 +59,16 @@ require_once __DIR__ . '/vendor/autoload.php'; require_once 'application/ApplicationUtils.php'; require_once 'application/config/ConfigPlugin.php'; require_once 'application/feed/Cache.php'; +require_once 'application/http/HttpUtils.php'; +require_once 'application/http/UrlUtils.php'; require_once 'application/FileUtils.php'; require_once 'application/History.php'; -require_once 'application/HttpUtils.php'; require_once 'application/LinkDB.php'; require_once 'application/LinkFilter.php'; require_once 'application/LinkUtils.php'; require_once 'application/NetscapeBookmarkUtils.php'; require_once 'application/PageBuilder.php'; require_once 'application/TimeZone.php'; -require_once 'application/Url.php'; require_once 'application/Utils.php'; require_once 'application/PluginManager.php'; require_once 'application/Router.php'; diff --git a/tests/HttpUtils/ClientIpIdTest.php b/tests/http/HttpUtils/ClientIpIdTest.php similarity index 89% rename from tests/HttpUtils/ClientIpIdTest.php rename to tests/http/HttpUtils/ClientIpIdTest.php index c15ac5c..982e57e 100644 --- a/tests/HttpUtils/ClientIpIdTest.php +++ b/tests/http/HttpUtils/ClientIpIdTest.php @@ -3,12 +3,14 @@ * HttpUtils' tests */ -require_once 'application/HttpUtils.php'; +namespace Shaarli\Http; + +require_once 'application/http/HttpUtils.php'; /** * Unitary tests for client_ip_id() */ -class ClientIpIdTest extends PHPUnit_Framework_TestCase +class ClientIpIdTest extends \PHPUnit\Framework\TestCase { /** * Get a remote client ID based on its IP diff --git a/tests/HttpUtils/GetHttpUrlTest.php b/tests/http/HttpUtils/GetHttpUrlTest.php similarity index 85% rename from tests/HttpUtils/GetHttpUrlTest.php rename to tests/http/HttpUtils/GetHttpUrlTest.php index ea53de5..3dc5bc9 100644 --- a/tests/HttpUtils/GetHttpUrlTest.php +++ b/tests/http/HttpUtils/GetHttpUrlTest.php @@ -3,12 +3,14 @@ * HttpUtils' tests */ -require_once 'application/HttpUtils.php'; +namespace Shaarli\Http; + +require_once 'application/http/HttpUtils.php'; /** * Unitary tests for get_http_response() */ -class GetHttpUrlTest extends PHPUnit_Framework_TestCase +class GetHttpUrlTest extends \PHPUnit\Framework\TestCase { /** * Get an invalid local URL @@ -17,12 +19,12 @@ class GetHttpUrlTest extends PHPUnit_Framework_TestCase { // Local list($headers, $content) = get_http_response('/non/existent', 1); - $this->assertEquals('Invalid HTTP Url', $headers[0]); + $this->assertEquals('Invalid HTTP UrlUtils', $headers[0]); $this->assertFalse($content); // Non HTTP list($headers, $content) = get_http_response('ftp://save.tld/mysave', 1); - $this->assertEquals('Invalid HTTP Url', $headers[0]); + $this->assertEquals('Invalid HTTP UrlUtils', $headers[0]); $this->assertFalse($content); } diff --git a/tests/HttpUtils/GetIpAdressFromProxyTest.php b/tests/http/HttpUtils/GetIpAdressFromProxyTest.php similarity index 91% rename from tests/HttpUtils/GetIpAdressFromProxyTest.php rename to tests/http/HttpUtils/GetIpAdressFromProxyTest.php index 7af5bd9..fe3a639 100644 --- a/tests/HttpUtils/GetIpAdressFromProxyTest.php +++ b/tests/http/HttpUtils/GetIpAdressFromProxyTest.php @@ -1,11 +1,13 @@ Date: Mon, 3 Dec 2018 00:46:04 +0100 Subject: [PATCH 08/75] namespacing: \Shaarli\Render\{PageBuilder,ThemeUtils} Signed-off-by: VirtualTam --- application/{ => render}/PageBuilder.php | 20 ++++++++++++++------ application/{ => render}/ThemeUtils.php | 2 +- composer.json | 1 + index.php | 4 ++-- tests/{ => render}/ThemeUtilsTest.php | 2 +- 5 files changed, 19 insertions(+), 10 deletions(-) rename application/{ => render}/PageBuilder.php (93%) rename application/{ => render}/ThemeUtils.php (96%) rename tests/{ => render}/ThemeUtilsTest.php (98%) diff --git a/application/PageBuilder.php b/application/render/PageBuilder.php similarity index 93% rename from application/PageBuilder.php rename to application/render/PageBuilder.php index 2ca9583..1df95bf 100644 --- a/application/PageBuilder.php +++ b/application/render/PageBuilder.php @@ -1,5 +1,11 @@ conf->get('credentials.salt')) ); $this->tpl->assign('index_url', index_url($_SERVER)); - $visibility = ! empty($_SESSION['visibility']) ? $_SESSION['visibility'] : ''; + $visibility = !empty($_SESSION['visibility']) ? $_SESSION['visibility'] : ''; $this->tpl->assign('visibility', $visibility); $this->tpl->assign('untaggedonly', !empty($_SESSION['untaggedonly'])); $this->tpl->assign('pagetitle', $this->conf->get('general.title', 'Shaarli')); @@ -126,7 +134,7 @@ class PageBuilder $this->tpl->assign('thumbnails_width', $this->conf->get('thumbnails.width')); $this->tpl->assign('thumbnails_height', $this->conf->get('thumbnails.height')); - if (! empty($_SESSION['warnings'])) { + if (!empty($_SESSION['warnings'])) { $this->tpl->assign('global_warnings', $_SESSION['warnings']); unset($_SESSION['warnings']); } @@ -189,16 +197,16 @@ class PageBuilder /** * Render a 404 page (uses the template : tpl/404.tpl) - * usage : $PAGE->render404('The link was deleted') + * usage: $PAGE->render404('The link was deleted') * - * @param string $message A messate to display what is not found + * @param string $message A message to display what is not found */ public function render404($message = '') { if (empty($message)) { $message = t('The page you are trying to reach does not exist or has been deleted.'); } - header($_SERVER['SERVER_PROTOCOL'] .' '. t('404 Not Found')); + header($_SERVER['SERVER_PROTOCOL'] . ' ' . t('404 Not Found')); $this->tpl->assign('error_message', $message); $this->renderPage('404'); } diff --git a/application/ThemeUtils.php b/application/render/ThemeUtils.php similarity index 96% rename from application/ThemeUtils.php rename to application/render/ThemeUtils.php index 16f2f6a..86096c6 100644 --- a/application/ThemeUtils.php +++ b/application/render/ThemeUtils.php @@ -1,6 +1,6 @@ Date: Mon, 3 Dec 2018 00:59:21 +0100 Subject: [PATCH 09/75] namespacing: \Shaarli\FileUtils Signed-off-by: VirtualTam --- application/FileUtils.php | 8 ++++---- application/History.php | 5 ++--- application/LinkDB.php | 1 + composer.json | 1 + tests/FileUtilsTest.php | 6 +++--- tests/HistoryTest.php | 1 - tests/utils/ReferenceHistory.php | 1 + 7 files changed, 12 insertions(+), 11 deletions(-) diff --git a/application/FileUtils.php b/application/FileUtils.php index ba40982..30560bf 100644 --- a/application/FileUtils.php +++ b/application/FileUtils.php @@ -1,8 +1,8 @@ =5.6", + "ext-zlib": "*", "shaarli/netscape-bookmark-parser": "^2.1", "erusev/parsedown": "^1.6", "slim/slim": "^3.0", diff --git a/tests/FileUtilsTest.php b/tests/FileUtilsTest.php index 9596dba..5771917 100644 --- a/tests/FileUtilsTest.php +++ b/tests/FileUtilsTest.php @@ -1,15 +1,15 @@ Date: Mon, 3 Dec 2018 01:10:39 +0100 Subject: [PATCH 10/75] namespacing: \Shaarli\Bookmark\LinkDB Signed-off-by: VirtualTam --- application/LinkFilter.php | 2 + application/LinkUtils.php | 2 + application/NetscapeBookmarkUtils.php | 1 + application/Updater.php | 2 + application/api/ApiMiddleware.php | 2 +- application/api/controllers/ApiController.php | 2 +- application/{ => bookmark}/LinkDB.php | 66 +++++++++++-------- application/feed/CachedPage.php | 1 + application/feed/FeedBuilder.php | 15 +++-- application/render/PageBuilder.php | 2 +- composer.json | 1 + index.php | 3 +- tests/LinkFilterTest.php | 2 + .../BookmarkExportTest.php | 2 + .../BookmarkImportTest.php | 1 + tests/Updater/DummyUpdater.php | 2 + tests/Updater/UpdaterTest.php | 2 + tests/api/controllers/info/InfoTest.php | 2 +- .../api/controllers/links/DeleteLinkTest.php | 6 +- tests/api/controllers/links/GetLinkIdTest.php | 4 +- tests/api/controllers/links/GetLinksTest.php | 6 +- tests/api/controllers/links/PostLinkTest.php | 6 +- tests/api/controllers/links/PutLinkTest.php | 6 +- tests/api/controllers/tags/DeleteTagTest.php | 8 +-- tests/api/controllers/tags/GetTagNameTest.php | 2 +- tests/api/controllers/tags/GetTagsTest.php | 4 +- tests/api/controllers/tags/PutTagTest.php | 4 +- tests/{ => bookmark}/LinkDBTest.php | 26 +++++--- tests/feed/FeedBuilderTest.php | 4 +- tests/http/UrlTest.php | 1 - tests/plugins/PluginIssoTest.php | 2 + tests/utils/ReferenceLinkDB.php | 3 + 32 files changed, 115 insertions(+), 77 deletions(-) rename application/{ => bookmark}/LinkDB.php (90%) rename tests/{ => bookmark}/LinkDBTest.php (97%) diff --git a/application/LinkFilter.php b/application/LinkFilter.php index 8f14797..91c7990 100644 --- a/application/LinkFilter.php +++ b/application/LinkFilter.php @@ -1,5 +1,7 @@ get('resource.datastore'), true, $conf->get('privacy.hide_public_links'), diff --git a/application/api/controllers/ApiController.php b/application/api/controllers/ApiController.php index 47e0e17..cab97dc 100644 --- a/application/api/controllers/ApiController.php +++ b/application/api/controllers/ApiController.php @@ -25,7 +25,7 @@ abstract class ApiController protected $conf; /** - * @var \LinkDB + * @var \Shaarli\Bookmark\LinkDB */ protected $linkDb; diff --git a/application/LinkDB.php b/application/bookmark/LinkDB.php similarity index 90% rename from application/LinkDB.php rename to application/bookmark/LinkDB.php index a5b4272..3b77422 100644 --- a/application/LinkDB.php +++ b/application/bookmark/LinkDB.php @@ -1,5 +1,13 @@ datastore = $datastore; $this->loggedIn = $isLoggedIn; $this->hidePublicLinks = $hidePublicLinks; @@ -141,7 +150,7 @@ class LinkDB implements Iterator, Countable, ArrayAccess if (!isset($value['id']) || empty($value['url'])) { die(t('Internal Error: A link should always have an id and URL.')); } - if (($offset !== null && ! is_int($offset)) || ! is_int($value['id'])) { + if (($offset !== null && !is_int($offset)) || !is_int($value['id'])) { die(t('You must specify an integer as a key.')); } if ($offset !== null && $offset !== $value['id']) { @@ -251,31 +260,31 @@ class LinkDB implements Iterator, Countable, ArrayAccess $this->links = array(); $link = array( 'id' => 1, - 'title'=> t('The personal, minimalist, super-fast, database free, bookmarking service'), - 'url'=>'https://shaarli.readthedocs.io', - 'description'=>t( + 'title' => t('The personal, minimalist, super-fast, database free, bookmarking service'), + 'url' => 'https://shaarli.readthedocs.io', + 'description' => t( 'Welcome to Shaarli! This is your first public bookmark. ' - .'To edit or delete me, you must first login. + . 'To edit or delete me, you must first login. To learn how to use Shaarli, consult the link "Documentation" at the bottom of this page. You use the community supported version of the original Shaarli project, by Sebastien Sauvage.' ), - 'private'=>0, - 'created'=> new DateTime(), - 'tags'=>'opensource software' + 'private' => 0, + 'created' => new DateTime(), + 'tags' => 'opensource software' ); $link['shorturl'] = link_small_hash($link['created'], $link['id']); $this->links[1] = $link; $link = array( 'id' => 0, - 'title'=> t('My secret stuff... - Pastebin.com'), - 'url'=>'http://sebsauvage.net/paste/?8434b27936c09649#bR7XsXhoTiLcqCpQbmOpBi3rq2zzQUC5hBI7ZT1O3x8=', - 'description'=> t('Shhhh! I\'m a private link only YOU can see. You can delete me too.'), - 'private'=>1, - 'created'=> new DateTime('1 minute ago'), - 'tags'=>'secretstuff', + 'title' => t('My secret stuff... - Pastebin.com'), + 'url' => 'http://sebsauvage.net/paste/?8434b27936c09649#bR7XsXhoTiLcqCpQbmOpBi3rq2zzQUC5hBI7ZT1O3x8=', + 'description' => t('Shhhh! I\'m a private link only YOU can see. You can delete me too.'), + 'private' => 1, + 'created' => new DateTime('1 minute ago'), + 'tags' => 'secretstuff', ); $link['shorturl'] = link_small_hash($link['created'], $link['id']); $this->links[0] = $link; @@ -301,7 +310,7 @@ You use the community supported version of the original Shaarli project, by Seba $toremove = array(); foreach ($this->links as $key => &$link) { - if (! $this->loggedIn && $link['private'] != 0) { + if (!$this->loggedIn && $link['private'] != 0) { // Transition for not upgraded databases. unset($this->links[$key]); continue; @@ -311,7 +320,7 @@ You use the community supported version of the original Shaarli project, by Seba sanitizeLink($link); // Remove private tags if the user is not logged in. - if (! $this->loggedIn) { + if (!$this->loggedIn) { $link['tags'] = preg_replace('/(^|\s+)\.[^($|\s)]+\s*/', ' ', $link['tags']); } @@ -328,10 +337,10 @@ You use the community supported version of the original Shaarli project, by Seba } // To be able to load links before running the update, and prepare the update - if (! isset($link['created'])) { + if (!isset($link['created'])) { $link['id'] = $link['linkdate']; $link['created'] = DateTime::createFromFormat(self::LINK_DATE_FORMAT, $link['linkdate']); - if (! empty($link['updated'])) { + if (!empty($link['updated'])) { $link['updated'] = DateTime::createFromFormat(self::LINK_DATE_FORMAT, $link['updated']); } $link['shorturl'] = smallHash($link['linkdate']); @@ -417,12 +426,12 @@ You use the community supported version of the original Shaarli project, by Seba /** * Filter links according to search parameters. * - * @param array $filterRequest Search request content. Supported keys: + * @param array $filterRequest Search request content. Supported keys: * - searchtags: list of tags * - searchterm: term search - * @param bool $casesensitive Optional: Perform case sensitive filter - * @param string $visibility return only all/private/public links - * @param string $untaggedonly return only untagged links + * @param bool $casesensitive Optional: Perform case sensitive filter + * @param string $visibility return only all/private/public links + * @param string $untaggedonly return only untagged links * * @return array filtered links, all links if no suitable filter was provided. */ @@ -432,6 +441,7 @@ You use the community supported version of the original Shaarli project, by Seba $visibility = 'all', $untaggedonly = false ) { + // Filter link database according to parameters. $searchtags = isset($filterRequest['searchtags']) ? escape($filterRequest['searchtags']) : ''; $searchterm = isset($filterRequest['searchterm']) ? escape($filterRequest['searchterm']) : ''; @@ -448,7 +458,7 @@ You use the community supported version of the original Shaarli project, by Seba * Returns the list tags appearing in the links with the given tags * * @param array $filteringTags tags selecting the links to consider - * @param string $visibility process only all/private/public links + * @param string $visibility process only all/private/public links * * @return array tag => linksCount */ @@ -490,7 +500,7 @@ You use the community supported version of the original Shaarli project, by Seba * Rename or delete a tag across all links. * * @param string $from Tag to rename - * @param string $to New tag. If none is provided, the from tag will be deleted + * @param string $to New tag. If none is provided, the from tag will be deleted * * @return array|bool List of altered links or false on error */ diff --git a/application/feed/CachedPage.php b/application/feed/CachedPage.php index 1c51ac7..d809bdd 100644 --- a/application/feed/CachedPage.php +++ b/application/feed/CachedPage.php @@ -1,6 +1,7 @@ container = new Container(); $this->container['conf'] = $this->conf; - $this->container['db'] = new \LinkDB(self::$testDatastore, true, false); + $this->container['db'] = new \Shaarli\Bookmark\LinkDB(self::$testDatastore, true, false); $this->container['history'] = null; $this->controller = new Info($this->container); diff --git a/tests/api/controllers/links/DeleteLinkTest.php b/tests/api/controllers/links/DeleteLinkTest.php index 07371e7..adca9a4 100644 --- a/tests/api/controllers/links/DeleteLinkTest.php +++ b/tests/api/controllers/links/DeleteLinkTest.php @@ -32,7 +32,7 @@ class DeleteLinkTest extends \PHPUnit_Framework_TestCase protected $refDB = null; /** - * @var \LinkDB instance. + * @var \Shaarli\Bookmark\LinkDB instance. */ protected $linkDB; @@ -59,7 +59,7 @@ class DeleteLinkTest extends \PHPUnit_Framework_TestCase $this->conf = new ConfigManager('tests/utils/config/configJson'); $this->refDB = new \ReferenceLinkDB(); $this->refDB->write(self::$testDatastore); - $this->linkDB = new \LinkDB(self::$testDatastore, true, false); + $this->linkDB = new \Shaarli\Bookmark\LinkDB(self::$testDatastore, true, false); $refHistory = new \ReferenceHistory(); $refHistory->write(self::$testHistory); $this->history = new \Shaarli\History(self::$testHistory); @@ -96,7 +96,7 @@ class DeleteLinkTest extends \PHPUnit_Framework_TestCase $this->assertEquals(204, $response->getStatusCode()); $this->assertEmpty((string) $response->getBody()); - $this->linkDB = new \LinkDB(self::$testDatastore, true, false); + $this->linkDB = new \Shaarli\Bookmark\LinkDB(self::$testDatastore, true, false); $this->assertFalse(isset($this->linkDB[$id])); $historyEntry = $this->history->getHistory()[0]; diff --git a/tests/api/controllers/links/GetLinkIdTest.php b/tests/api/controllers/links/GetLinkIdTest.php index 57528d5..bf58000 100644 --- a/tests/api/controllers/links/GetLinkIdTest.php +++ b/tests/api/controllers/links/GetLinkIdTest.php @@ -61,7 +61,7 @@ class GetLinkIdTest extends \PHPUnit_Framework_TestCase $this->container = new Container(); $this->container['conf'] = $this->conf; - $this->container['db'] = new \LinkDB(self::$testDatastore, true, false); + $this->container['db'] = new \Shaarli\Bookmark\LinkDB(self::$testDatastore, true, false); $this->container['history'] = null; $this->controller = new Links($this->container); @@ -108,7 +108,7 @@ class GetLinkIdTest extends \PHPUnit_Framework_TestCase $this->assertEquals('sTuff', $data['tags'][0]); $this->assertEquals(false, $data['private']); $this->assertEquals( - \DateTime::createFromFormat(\LinkDB::LINK_DATE_FORMAT, '20150310_114651')->format(\DateTime::ATOM), + \DateTime::createFromFormat(\Shaarli\Bookmark\LinkDB::LINK_DATE_FORMAT, '20150310_114651')->format(\DateTime::ATOM), $data['created'] ); $this->assertEmpty($data['updated']); diff --git a/tests/api/controllers/links/GetLinksTest.php b/tests/api/controllers/links/GetLinksTest.php index 64f0277..1008d7b 100644 --- a/tests/api/controllers/links/GetLinksTest.php +++ b/tests/api/controllers/links/GetLinksTest.php @@ -60,7 +60,7 @@ class GetLinksTest extends \PHPUnit_Framework_TestCase $this->container = new Container(); $this->container['conf'] = $this->conf; - $this->container['db'] = new \LinkDB(self::$testDatastore, true, false); + $this->container['db'] = new \Shaarli\Bookmark\LinkDB(self::$testDatastore, true, false); $this->container['history'] = null; $this->controller = new Links($this->container); @@ -114,7 +114,7 @@ class GetLinksTest extends \PHPUnit_Framework_TestCase $this->assertEquals('sTuff', $first['tags'][0]); $this->assertEquals(false, $first['private']); $this->assertEquals( - \DateTime::createFromFormat(\LinkDB::LINK_DATE_FORMAT, '20150310_114651')->format(\DateTime::ATOM), + \DateTime::createFromFormat(\Shaarli\Bookmark\LinkDB::LINK_DATE_FORMAT, '20150310_114651')->format(\DateTime::ATOM), $first['created'] ); $this->assertEmpty($first['updated']); @@ -125,7 +125,7 @@ class GetLinksTest extends \PHPUnit_Framework_TestCase // Update date $this->assertEquals( - \DateTime::createFromFormat(\LinkDB::LINK_DATE_FORMAT, '20160803_093033')->format(\DateTime::ATOM), + \DateTime::createFromFormat(\Shaarli\Bookmark\LinkDB::LINK_DATE_FORMAT, '20160803_093033')->format(\DateTime::ATOM), $link['updated'] ); } diff --git a/tests/api/controllers/links/PostLinkTest.php b/tests/api/controllers/links/PostLinkTest.php index a73f443..ade07ee 100644 --- a/tests/api/controllers/links/PostLinkTest.php +++ b/tests/api/controllers/links/PostLinkTest.php @@ -74,7 +74,7 @@ class PostLinkTest extends TestCase $this->container = new Container(); $this->container['conf'] = $this->conf; - $this->container['db'] = new \LinkDB(self::$testDatastore, true, false); + $this->container['db'] = new \Shaarli\Bookmark\LinkDB(self::$testDatastore, true, false); $this->container['history'] = new \Shaarli\History(self::$testHistory); $this->controller = new Links($this->container); @@ -210,11 +210,11 @@ class PostLinkTest extends TestCase $this->assertEquals(['gnu', 'media', 'web', '.hidden', 'hashtag'], $data['tags']); $this->assertEquals(false, $data['private']); $this->assertEquals( - \DateTime::createFromFormat(\LinkDB::LINK_DATE_FORMAT, '20130614_184135'), + \DateTime::createFromFormat(\Shaarli\Bookmark\LinkDB::LINK_DATE_FORMAT, '20130614_184135'), \DateTime::createFromFormat(\DateTime::ATOM, $data['created']) ); $this->assertEquals( - \DateTime::createFromFormat(\LinkDB::LINK_DATE_FORMAT, '20130615_184230'), + \DateTime::createFromFormat(\Shaarli\Bookmark\LinkDB::LINK_DATE_FORMAT, '20130615_184230'), \DateTime::createFromFormat(\DateTime::ATOM, $data['updated']) ); } diff --git a/tests/api/controllers/links/PutLinkTest.php b/tests/api/controllers/links/PutLinkTest.php index 3bb4d43..eb6c795 100644 --- a/tests/api/controllers/links/PutLinkTest.php +++ b/tests/api/controllers/links/PutLinkTest.php @@ -66,7 +66,7 @@ class PutLinkTest extends \PHPUnit_Framework_TestCase $this->container = new Container(); $this->container['conf'] = $this->conf; - $this->container['db'] = new \LinkDB(self::$testDatastore, true, false); + $this->container['db'] = new \Shaarli\Bookmark\LinkDB(self::$testDatastore, true, false); $this->container['history'] = new \Shaarli\History(self::$testHistory); $this->controller = new Links($this->container); @@ -198,11 +198,11 @@ class PutLinkTest extends \PHPUnit_Framework_TestCase $this->assertEquals(['gnu', 'media', 'web', '.hidden', 'hashtag'], $data['tags']); $this->assertEquals(false, $data['private']); $this->assertEquals( - \DateTime::createFromFormat(\LinkDB::LINK_DATE_FORMAT, '20130614_184135'), + \DateTime::createFromFormat(\Shaarli\Bookmark\LinkDB::LINK_DATE_FORMAT, '20130614_184135'), \DateTime::createFromFormat(\DateTime::ATOM, $data['created']) ); $this->assertEquals( - \DateTime::createFromFormat(\LinkDB::LINK_DATE_FORMAT, '20130615_184230'), + \DateTime::createFromFormat(\Shaarli\Bookmark\LinkDB::LINK_DATE_FORMAT, '20130615_184230'), \DateTime::createFromFormat(\DateTime::ATOM, $data['updated']) ); } diff --git a/tests/api/controllers/tags/DeleteTagTest.php b/tests/api/controllers/tags/DeleteTagTest.php index a1e419c..02803ba 100644 --- a/tests/api/controllers/tags/DeleteTagTest.php +++ b/tests/api/controllers/tags/DeleteTagTest.php @@ -32,7 +32,7 @@ class DeleteTagTest extends \PHPUnit_Framework_TestCase protected $refDB = null; /** - * @var \LinkDB instance. + * @var \Shaarli\Bookmark\LinkDB instance. */ protected $linkDB; @@ -59,7 +59,7 @@ class DeleteTagTest extends \PHPUnit_Framework_TestCase $this->conf = new ConfigManager('tests/utils/config/configJson'); $this->refDB = new \ReferenceLinkDB(); $this->refDB->write(self::$testDatastore); - $this->linkDB = new \LinkDB(self::$testDatastore, true, false); + $this->linkDB = new \Shaarli\Bookmark\LinkDB(self::$testDatastore, true, false); $refHistory = new \ReferenceHistory(); $refHistory->write(self::$testHistory); $this->history = new \Shaarli\History(self::$testHistory); @@ -97,7 +97,7 @@ class DeleteTagTest extends \PHPUnit_Framework_TestCase $this->assertEquals(204, $response->getStatusCode()); $this->assertEmpty((string) $response->getBody()); - $this->linkDB = new \LinkDB(self::$testDatastore, true, false); + $this->linkDB = new \Shaarli\Bookmark\LinkDB(self::$testDatastore, true, false); $tags = $this->linkDB->linksCountPerTag(); $this->assertFalse(isset($tags[$tagName])); @@ -131,7 +131,7 @@ class DeleteTagTest extends \PHPUnit_Framework_TestCase $this->assertEquals(204, $response->getStatusCode()); $this->assertEmpty((string) $response->getBody()); - $this->linkDB = new \LinkDB(self::$testDatastore, true, false); + $this->linkDB = new \Shaarli\Bookmark\LinkDB(self::$testDatastore, true, false); $tags = $this->linkDB->linksCountPerTag(); $this->assertFalse(isset($tags[$tagName])); $this->assertTrue($tags[strtolower($tagName)] > 0); diff --git a/tests/api/controllers/tags/GetTagNameTest.php b/tests/api/controllers/tags/GetTagNameTest.php index afac228..8e0fecc 100644 --- a/tests/api/controllers/tags/GetTagNameTest.php +++ b/tests/api/controllers/tags/GetTagNameTest.php @@ -59,7 +59,7 @@ class GetTagNameTest extends \PHPUnit_Framework_TestCase $this->container = new Container(); $this->container['conf'] = $this->conf; - $this->container['db'] = new \LinkDB(self::$testDatastore, true, false); + $this->container['db'] = new \Shaarli\Bookmark\LinkDB(self::$testDatastore, true, false); $this->container['history'] = null; $this->controller = new Tags($this->container); diff --git a/tests/api/controllers/tags/GetTagsTest.php b/tests/api/controllers/tags/GetTagsTest.php index 3fab31b..f071bfa 100644 --- a/tests/api/controllers/tags/GetTagsTest.php +++ b/tests/api/controllers/tags/GetTagsTest.php @@ -38,7 +38,7 @@ class GetTagsTest extends \PHPUnit_Framework_TestCase protected $container; /** - * @var \LinkDB instance. + * @var \Shaarli\Bookmark\LinkDB instance. */ protected $linkDB; @@ -63,7 +63,7 @@ class GetTagsTest extends \PHPUnit_Framework_TestCase $this->container = new Container(); $this->container['conf'] = $this->conf; - $this->linkDB = new \LinkDB(self::$testDatastore, true, false); + $this->linkDB = new \Shaarli\Bookmark\LinkDB(self::$testDatastore, true, false); $this->container['db'] = $this->linkDB; $this->container['history'] = null; diff --git a/tests/api/controllers/tags/PutTagTest.php b/tests/api/controllers/tags/PutTagTest.php index c45fa72..d8c0fec 100644 --- a/tests/api/controllers/tags/PutTagTest.php +++ b/tests/api/controllers/tags/PutTagTest.php @@ -43,7 +43,7 @@ class PutTagTest extends \PHPUnit_Framework_TestCase protected $container; /** - * @var \LinkDB instance. + * @var \Shaarli\Bookmark\LinkDB instance. */ protected $linkDB; @@ -72,7 +72,7 @@ class PutTagTest extends \PHPUnit_Framework_TestCase $this->container = new Container(); $this->container['conf'] = $this->conf; - $this->linkDB = new \LinkDB(self::$testDatastore, true, false); + $this->linkDB = new \Shaarli\Bookmark\LinkDB(self::$testDatastore, true, false); $this->container['db'] = $this->linkDB; $this->container['history'] = $this->history; diff --git a/tests/LinkDBTest.php b/tests/bookmark/LinkDBTest.php similarity index 97% rename from tests/LinkDBTest.php rename to tests/bookmark/LinkDBTest.php index 737a224..f18a315 100644 --- a/tests/LinkDBTest.php +++ b/tests/bookmark/LinkDBTest.php @@ -3,9 +3,15 @@ * Link datastore tests */ +namespace Shaarli\Bookmark; + +use DateTime; +use LinkNotFoundException; +use ReferenceLinkDB; +use ReflectionClass; +use Shaarli; + require_once 'application/feed/Cache.php'; -require_once 'application/FileUtils.php'; -require_once 'application/LinkDB.php'; require_once 'application/Utils.php'; require_once 'tests/utils/ReferenceLinkDB.php'; @@ -13,7 +19,7 @@ require_once 'tests/utils/ReferenceLinkDB.php'; /** * Unitary tests for LinkDB */ -class LinkDBTest extends PHPUnit_Framework_TestCase +class LinkDBTest extends \PHPUnit\Framework\TestCase { // datastore to test write operations protected static $testDatastore = 'sandbox/datastore.php'; @@ -73,7 +79,7 @@ class LinkDBTest extends PHPUnit_Framework_TestCase */ protected static function getMethod($name) { - $class = new ReflectionClass('LinkDB'); + $class = new ReflectionClass('Shaarli\Bookmark\LinkDB'); $method = $class->getMethod($name); $method->setAccessible(true); return $method; @@ -187,12 +193,12 @@ class LinkDBTest extends PHPUnit_Framework_TestCase $link = array( 'id' => 42, - 'title'=>'an additional link', - 'url'=>'http://dum.my', - 'description'=>'One more', - 'private'=>0, - 'created'=> DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20150518_190000'), - 'tags'=>'unit test' + 'title' => 'an additional link', + 'url' => 'http://dum.my', + 'description' => 'One more', + 'private' => 0, + 'created' => DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20150518_190000'), + 'tags' => 'unit test' ); $testDB[$link['id']] = $link; $testDB->save('tests'); diff --git a/tests/feed/FeedBuilderTest.php b/tests/feed/FeedBuilderTest.php index 1fdbc60..88d1c3e 100644 --- a/tests/feed/FeedBuilderTest.php +++ b/tests/feed/FeedBuilderTest.php @@ -3,11 +3,9 @@ namespace Shaarli\Feed; use DateTime; -use LinkDB; +use Shaarli\Bookmark\LinkDB; use ReferenceLinkDB; -require_once 'application/LinkDB.php'; - /** * FeedBuilderTest class. * diff --git a/tests/http/UrlTest.php b/tests/http/UrlTest.php index 342b78a..ae92f73 100644 --- a/tests/http/UrlTest.php +++ b/tests/http/UrlTest.php @@ -5,7 +5,6 @@ namespace Shaarli\Http; - /** * Unitary tests for URL utilities */ diff --git a/tests/plugins/PluginIssoTest.php b/tests/plugins/PluginIssoTest.php index 2c9efbc..f5fa1da 100644 --- a/tests/plugins/PluginIssoTest.php +++ b/tests/plugins/PluginIssoTest.php @@ -1,4 +1,6 @@ Date: Mon, 3 Dec 2018 01:22:45 +0100 Subject: [PATCH 11/75] namespacing: \Shaarli\Bookmark\LinkFilter Signed-off-by: VirtualTam --- application/Updater.php | 1 + application/bookmark/LinkDB.php | 26 ++++++------ application/{ => bookmark}/LinkFilter.php | 42 ++++++++----------- .../exception/LinkNotFoundException.php | 15 +++++++ composer.json | 1 + index.php | 2 +- tests/bookmark/LinkDBTest.php | 6 +-- tests/{ => bookmark}/LinkFilterTest.php | 23 ++++++---- 8 files changed, 66 insertions(+), 50 deletions(-) rename application/{ => bookmark}/LinkFilter.php (93%) create mode 100644 application/bookmark/exception/LinkNotFoundException.php rename tests/{ => bookmark}/LinkFilterTest.php (96%) diff --git a/application/Updater.php b/application/Updater.php index 043ecf6..ca05ecc 100644 --- a/application/Updater.php +++ b/application/Updater.php @@ -1,6 +1,7 @@ linksCount */ @@ -500,7 +500,7 @@ You use the community supported version of the original Shaarli project, by Seba * Rename or delete a tag across all links. * * @param string $from Tag to rename - * @param string $to New tag. If none is provided, the from tag will be deleted + * @param string $to New tag. If none is provided, the from tag will be deleted * * @return array|bool List of altered links or false on error */ diff --git a/application/LinkFilter.php b/application/bookmark/LinkFilter.php similarity index 93% rename from application/LinkFilter.php rename to application/bookmark/LinkFilter.php index 91c7990..9b96630 100644 --- a/application/LinkFilter.php +++ b/application/bookmark/LinkFilter.php @@ -1,6 +1,9 @@ links as $key => $value) { if ($value['private'] && $visibility === 'private') { $out[$key] = $value; - } elseif (! $value['private'] && $visibility === 'public') { + } elseif (!$value['private'] && $visibility === 'public') { $out[$key] = $value; } } @@ -134,7 +137,7 @@ class LinkFilter * * @return array $filtered array containing permalink data. * - * @throws LinkNotFoundException if the smallhash doesn't match any link. + * @throws \Shaarli\Bookmark\Exception\LinkNotFoundException if the smallhash doesn't match any link. */ private function filterSmallHash($smallHash) { @@ -171,7 +174,7 @@ class LinkFilter * - see https://github.com/shaarli/Shaarli/issues/75 for examples * * @param string $searchterms search query. - * @param string $visibility Optional: return only all/private/public links. + * @param string $visibility Optional: return only all/private/public links. * * @return array search results. */ @@ -209,7 +212,7 @@ class LinkFilter foreach ($this->links as $id => $link) { // ignore non private links when 'privatonly' is on. if ($visibility !== 'all') { - if (! $link['private'] && $visibility === 'private') { + if (!$link['private'] && $visibility === 'private') { continue; } elseif ($link['private'] && $visibility === 'public') { continue; @@ -252,7 +255,9 @@ class LinkFilter /** * generate a regex fragment out of a tag + * * @param string $tag to to generate regexs from. may start with '-' to negate, contain '*' as wildcard + * * @return string generated regex fragment */ private static function tag2regex($tag) @@ -336,7 +341,7 @@ class LinkFilter // check level of visibility // ignore non private links when 'privateonly' is on. if ($visibility !== 'all') { - if (! $link['private'] && $visibility === 'private') { + if (!$link['private'] && $visibility === 'private') { continue; } elseif ($link['private'] && $visibility === 'public') { continue; @@ -379,7 +384,7 @@ class LinkFilter $filtered = []; foreach ($this->links as $key => $link) { if ($visibility !== 'all') { - if (! $link['private'] && $visibility === 'private') { + if (!$link['private'] && $visibility === 'private') { continue; } elseif ($link['private'] && $visibility === 'public') { continue; @@ -408,7 +413,7 @@ class LinkFilter */ public function filterDay($day) { - if (! checkDateFormat('Ymd', $day)) { + if (!checkDateFormat('Ymd', $day)) { throw new Exception('Invalid date format'); } @@ -442,14 +447,3 @@ class LinkFilter return preg_split('/\s+/', $tagsOut, -1, PREG_SPLIT_NO_EMPTY); } } - -class LinkNotFoundException extends Exception -{ - /** - * LinkNotFoundException constructor. - */ - public function __construct() - { - $this->message = t('The link you are trying to reach does not exist or has been deleted.'); - } -} diff --git a/application/bookmark/exception/LinkNotFoundException.php b/application/bookmark/exception/LinkNotFoundException.php new file mode 100644 index 0000000..f941442 --- /dev/null +++ b/application/bookmark/exception/LinkNotFoundException.php @@ -0,0 +1,15 @@ +message = t('The link you are trying to reach does not exist or has been deleted.'); + } +} diff --git a/composer.json b/composer.json index e8dc2eb..7d0f96b 100644 --- a/composer.json +++ b/composer.json @@ -36,6 +36,7 @@ "Shaarli\\Api\\Controllers\\": "application/api/controllers", "Shaarli\\Api\\Exceptions\\": "application/api/exceptions", "Shaarli\\Bookmark\\": "application/bookmark", + "Shaarli\\Bookmark\\Exception\\": "application/bookmark/exception", "Shaarli\\Config\\": "application/config/", "Shaarli\\Config\\Exception\\": "application/config/exception", "Shaarli\\Exceptions\\": "application/exceptions", diff --git a/index.php b/index.php index b1d37a0..dbb3c6f 100644 --- a/index.php +++ b/index.php @@ -63,7 +63,6 @@ require_once 'application/http/HttpUtils.php'; require_once 'application/http/UrlUtils.php'; require_once 'application/FileUtils.php'; require_once 'application/History.php'; -require_once 'application/LinkFilter.php'; require_once 'application/LinkUtils.php'; require_once 'application/NetscapeBookmarkUtils.php'; require_once 'application/TimeZone.php'; @@ -72,6 +71,7 @@ require_once 'application/PluginManager.php'; require_once 'application/Router.php'; require_once 'application/Updater.php'; +use \Shaarli\Bookmark\Exception\LinkNotFoundException; use \Shaarli\Bookmark\LinkDB; use \Shaarli\Config\ConfigManager; use \Shaarli\Feed\CachedPage; diff --git a/tests/bookmark/LinkDBTest.php b/tests/bookmark/LinkDBTest.php index f18a315..65409e9 100644 --- a/tests/bookmark/LinkDBTest.php +++ b/tests/bookmark/LinkDBTest.php @@ -6,7 +6,7 @@ namespace Shaarli\Bookmark; use DateTime; -use LinkNotFoundException; +use Shaarli\Bookmark\Exception\LinkNotFoundException; use ReferenceLinkDB; use ReflectionClass; use Shaarli; @@ -457,7 +457,7 @@ class LinkDBTest extends \PHPUnit\Framework\TestCase /** * Test filterHash() with an invalid smallhash. * - * @expectedException LinkNotFoundException + * @expectedException \Shaarli\Bookmark\Exception\LinkNotFoundException */ public function testFilterHashInValid1() { @@ -468,7 +468,7 @@ class LinkDBTest extends \PHPUnit\Framework\TestCase /** * Test filterHash() with an empty smallhash. * - * @expectedException LinkNotFoundException + * @expectedException \Shaarli\Bookmark\Exception\LinkNotFoundException */ public function testFilterHashInValid() { diff --git a/tests/LinkFilterTest.php b/tests/bookmark/LinkFilterTest.php similarity index 96% rename from tests/LinkFilterTest.php rename to tests/bookmark/LinkFilterTest.php index db28b1c..808f812 100644 --- a/tests/LinkFilterTest.php +++ b/tests/bookmark/LinkFilterTest.php @@ -1,13 +1,14 @@ filter( LinkFilter::$FILTER_TAG, - /*$request=*/'', - /*$casesensitive=*/false, - /*$visibility=*/'all', - /*$untaggedonly=*/true + /*$request=*/ + '', + /*$casesensitive=*/ + false, + /*$visibility=*/ + 'all', + /*$untaggedonly=*/ + true ) ) ); @@ -229,7 +234,7 @@ class LinkFilterTest extends PHPUnit_Framework_TestCase /** * No link for this hash * - * @expectedException LinkNotFoundException + * @expectedException \Shaarli\Bookmark\Exception\LinkNotFoundException */ public function testFilterUnknownSmallHash() { From fe3713d2e5c91e2d07af72b39f321521d3dd470c Mon Sep 17 00:00:00 2001 From: VirtualTam Date: Mon, 3 Dec 2018 01:35:14 +0100 Subject: [PATCH 12/75] namespacing: move LinkUtils along \Shaarli\Bookmark classes Signed-off-by: VirtualTam --- application/{ => bookmark}/LinkUtils.php | 4 +- index.php | 2 +- tests/{ => bookmark}/LinkUtilsTest.php | 142 +++++------------------ tests/plugins/PluginMarkdownTest.php | 1 + tests/utils/CurlUtils.php | 94 +++++++++++++++ 5 files changed, 125 insertions(+), 118 deletions(-) rename application/{ => bookmark}/LinkUtils.php (97%) rename tests/{ => bookmark}/LinkUtilsTest.php (76%) create mode 100644 tests/utils/CurlUtils.php diff --git a/application/LinkUtils.php b/application/bookmark/LinkUtils.php similarity index 97% rename from application/LinkUtils.php rename to application/bookmark/LinkUtils.php index b5110ed..de5b61c 100644 --- a/application/LinkUtils.php +++ b/application/bookmark/LinkUtils.php @@ -7,7 +7,7 @@ use Shaarli\Bookmark\LinkDB; * * @param string $charset to extract from the downloaded page (reference) * @param string $title to extract from the downloaded page (reference) - * @param string $curlGetInfo Optionnaly overrides curl_getinfo function + * @param string $curlGetInfo Optionally overrides curl_getinfo function * * @return Closure */ @@ -198,7 +198,7 @@ function space2nbsp($text) * * @param string $description shaare's description. * @param string $redirector if a redirector is set, use it to gerenate links. - * @param bool $urlEncode Use `urlencode()` on the URL after the redirector or not. + * @param bool $urlEncode Use `urlencode()` on the URL after the redirector or not. * @param string $indexUrl URL to Shaarli's index. * @return string formatted description. diff --git a/index.php b/index.php index dbb3c6f..146b445 100644 --- a/index.php +++ b/index.php @@ -57,13 +57,13 @@ require_once __DIR__ . '/vendor/autoload.php'; // Shaarli library require_once 'application/ApplicationUtils.php'; +require_once 'application/bookmark/LinkUtils.php'; require_once 'application/config/ConfigPlugin.php'; require_once 'application/feed/Cache.php'; require_once 'application/http/HttpUtils.php'; require_once 'application/http/UrlUtils.php'; require_once 'application/FileUtils.php'; require_once 'application/History.php'; -require_once 'application/LinkUtils.php'; require_once 'application/NetscapeBookmarkUtils.php'; require_once 'application/TimeZone.php'; require_once 'application/Utils.php'; diff --git a/tests/LinkUtilsTest.php b/tests/bookmark/LinkUtilsTest.php similarity index 76% rename from tests/LinkUtilsTest.php rename to tests/bookmark/LinkUtilsTest.php index 5407159..1b8688e 100644 --- a/tests/LinkUtilsTest.php +++ b/tests/bookmark/LinkUtilsTest.php @@ -1,11 +1,15 @@ stuff'. $title .''; + $html = 'stuff' . $title . ''; $this->assertEquals($title, html_extract_title($html)); - $html = ''. $title .'blablaanother'; + $html = '' . $title . 'blablaanother'; $this->assertEquals($title, html_extract_title($html)); } @@ -34,7 +38,7 @@ class LinkUtilsTest extends PHPUnit_Framework_TestCase public function testHeadersExtractExistentCharset() { $charset = 'x-MacCroatian'; - $headers = 'text/html; charset='. $charset; + $headers = 'text/html; charset=' . $charset; $this->assertEquals(strtolower($charset), header_extract_charset($headers)); } @@ -56,7 +60,7 @@ class LinkUtilsTest extends PHPUnit_Framework_TestCase public function testHtmlExtractExistentCharset() { $charset = 'x-MacCroatian'; - $html = 'stuff2'; + $html = 'stuff2'; $this->assertEquals(strtolower($charset), html_extract_charset($html)); } @@ -84,8 +88,8 @@ class LinkUtilsTest extends PHPUnit_Framework_TestCase 'Content-Type: text/html; charset=utf-8', 'Status: 200 OK', 'end' => 'th=device-width">' - .'Refactoring · GitHub' - .'' - .'Refactoring · GitHub' - .'', 'end' => 'th=device-width">' - .'Refactoring · GitHub' - .'' - .'http://hello.there/is=someone#here otherstuff'; + . 'http://hello.there/is=someone#here otherstuff'; $processedText = text2clickable($text, ''); $this->assertEquals($expectedText, $processedText); $text = 'stuff http://hello.there/is=someone#here(please) otherstuff'; $expectedText = 'stuff ' - .'http://hello.there/is=someone#here(please) otherstuff'; + . 'http://hello.there/is=someone#here(please) otherstuff'; $processedText = text2clickable($text, ''); $this->assertEquals($expectedText, $processedText); $text = 'stuff http://hello.there/is=someone#here(please)&no otherstuff'; $expectedText = 'stuff ' - .'http://hello.there/is=someone#here(please)&no otherstuff'; + . 'http://hello.there/is=someone#here(please)&no otherstuff'; $processedText = text2clickable($text, ''); $this->assertEquals($expectedText, $processedText); } @@ -242,7 +246,7 @@ class LinkUtilsTest extends PHPUnit_Framework_TestCase { $text = 'stuff http://hello.there/is=someone#here otherstuff'; $redirector = 'http://redirector.to'; - $expectedText = 'stuff http://hello.there/is=someone#here otherstuff'; @@ -257,7 +261,7 @@ class LinkUtilsTest extends PHPUnit_Framework_TestCase { $text = 'stuff http://hello.there/?is=someone&or=something#here otherstuff'; $redirector = 'http://redirector.to'; - $expectedText = 'stuff http://hello.there/?is=someone&or=something#here otherstuff'; @@ -270,8 +274,8 @@ class LinkUtilsTest extends PHPUnit_Framework_TestCase */ public function testSpace2nbsp() { - $text = ' Are you thrilled by flags ?'. PHP_EOL .' Really?'; - $expectedText = '  Are you   thrilled  by flags   ?'. PHP_EOL .' Really?'; + $text = ' Are you thrilled by flags ?' . PHP_EOL . ' Really?'; + $expectedText = '  Are you   thrilled  by flags   ?' . PHP_EOL . ' Really?'; $processedText = space2nbsp($text); $this->assertEquals($expectedText, $processedText); } @@ -317,105 +321,13 @@ class LinkUtilsTest extends PHPUnit_Framework_TestCase * Util function to build an hashtag link. * * @param string $hashtag Hashtag name. - * @param string $index Index URL. + * @param string $index Index URL. * * @return string HTML hashtag link. */ private function getHashtagLink($hashtag, $index = '') { - $hashtagLink = '#$1'; + $hashtagLink = '#$1'; return str_replace('$1', $hashtag, $hashtagLink); } } - -// old style mock: PHPUnit doesn't allow function mock - -/** - * Returns code 200 or html content type. - * - * @param resource $ch cURL resource - * @param int $type cURL info type - * - * @return int|string 200 or 'text/html' - */ -function ut_curl_getinfo_ok($ch, $type) -{ - switch ($type) { - case CURLINFO_RESPONSE_CODE: - return 200; - case CURLINFO_CONTENT_TYPE: - return 'text/html; charset=utf-8'; - } -} - -/** - * Returns code 200 or html content type without charset. - * - * @param resource $ch cURL resource - * @param int $type cURL info type - * - * @return int|string 200 or 'text/html' - */ -function ut_curl_getinfo_no_charset($ch, $type) -{ - switch ($type) { - case CURLINFO_RESPONSE_CODE: - return 200; - case CURLINFO_CONTENT_TYPE: - return 'text/html'; - } -} - -/** - * Invalid response code. - * - * @param resource $ch cURL resource - * @param int $type cURL info type - * - * @return int|string 404 or 'text/html' - */ -function ut_curl_getinfo_rc_ko($ch, $type) -{ - switch ($type) { - case CURLINFO_RESPONSE_CODE: - return 404; - case CURLINFO_CONTENT_TYPE: - return 'text/html; charset=utf-8'; - } -} - -/** - * Invalid content type. - * - * @param resource $ch cURL resource - * @param int $type cURL info type - * - * @return int|string 200 or 'text/plain' - */ -function ut_curl_getinfo_ct_ko($ch, $type) -{ - switch ($type) { - case CURLINFO_RESPONSE_CODE: - return 200; - case CURLINFO_CONTENT_TYPE: - return 'text/plain'; - } -} - -/** - * Invalid response code and content type. - * - * @param resource $ch cURL resource - * @param int $type cURL info type - * - * @return int|string 404 or 'text/plain' - */ -function ut_curl_getinfo_rs_ct_ko($ch, $type) -{ - switch ($type) { - case CURLINFO_RESPONSE_CODE: - return 404; - case CURLINFO_CONTENT_TYPE: - return 'text/plain'; - } -} diff --git a/tests/plugins/PluginMarkdownTest.php b/tests/plugins/PluginMarkdownTest.php index 44364b0..d695186 100644 --- a/tests/plugins/PluginMarkdownTest.php +++ b/tests/plugins/PluginMarkdownTest.php @@ -5,6 +5,7 @@ use Shaarli\Config\ConfigManager; * PluginMarkdownTest.php */ +require_once 'application/bookmark/LinkUtils.php'; require_once 'application/Utils.php'; require_once 'plugins/markdown/markdown.php'; diff --git a/tests/utils/CurlUtils.php b/tests/utils/CurlUtils.php new file mode 100644 index 0000000..1cc4907 --- /dev/null +++ b/tests/utils/CurlUtils.php @@ -0,0 +1,94 @@ + Date: Mon, 3 Dec 2018 23:22:49 +0100 Subject: [PATCH 13/75] namespacing: add curl-ext to suggested dependencies Signed-off-by: VirtualTam --- composer.json | 3 ++ composer.lock | 87 ++++++++++++++++++++++++++------------------------- 2 files changed, 47 insertions(+), 43 deletions(-) diff --git a/composer.json b/composer.json index 7d0f96b..4c14e79 100644 --- a/composer.json +++ b/composer.json @@ -29,6 +29,9 @@ "phpunit/phpunit": "^5.0", "squizlabs/php_codesniffer": "2.*" }, + "suggest": { + "ext-curl": "*" + }, "autoload": { "psr-4": { "Shaarli\\": "application", diff --git a/composer.lock b/composer.lock index c43dad6..5723cff 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "3876b34296fedb365517b785af8384de", + "content-hash": "45937c29ca4a55504b0d0a60a03c42c6", "packages": [ { "name": "arthurhoaro/web-thumbnailer", @@ -195,16 +195,16 @@ }, { "name": "gettext/languages", - "version": "2.4.0", + "version": "2.5.0", "source": { "type": "git", "url": "https://github.com/mlocati/cldr-to-gettext-plural-rules.git", - "reference": "1b74377bd0c4cd87e8d72b948f5d8867e23505a5" + "reference": "78db2d17933f0765a102f368a6663f057162ddbd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mlocati/cldr-to-gettext-plural-rules/zipball/1b74377bd0c4cd87e8d72b948f5d8867e23505a5", - "reference": "1b74377bd0c4cd87e8d72b948f5d8867e23505a5", + "url": "https://api.github.com/repos/mlocati/cldr-to-gettext-plural-rules/zipball/78db2d17933f0765a102f368a6663f057162ddbd", + "reference": "78db2d17933f0765a102f368a6663f057162ddbd", "shasum": "" }, "require": { @@ -252,7 +252,7 @@ "translations", "unicode" ], - "time": "2018-06-21T15:58:36+00:00" + "time": "2018-11-13T22:06:07+00:00" }, { "name": "katzgrau/klogger", @@ -542,16 +542,16 @@ }, { "name": "psr/log", - "version": "1.0.2", + "version": "1.1.0", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" + "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "url": "https://api.github.com/repos/php-fig/log/zipball/6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd", + "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd", "shasum": "" }, "require": { @@ -585,7 +585,7 @@ "psr", "psr-3" ], - "time": "2016-10-10T12:19:37+00:00" + "time": "2018-11-20T15:27:04+00:00" }, { "name": "pubsubhubbub/publisher", @@ -2023,16 +2023,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "2.9.1", + "version": "2.9.2", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "dcbed1074f8244661eecddfc2a675430d8d33f62" + "reference": "2acf168de78487db620ab4bc524135a13cfe6745" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/dcbed1074f8244661eecddfc2a675430d8d33f62", - "reference": "dcbed1074f8244661eecddfc2a675430d8d33f62", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/2acf168de78487db620ab4bc524135a13cfe6745", + "reference": "2acf168de78487db620ab4bc524135a13cfe6745", "shasum": "" }, "require": { @@ -2097,20 +2097,20 @@ "phpcs", "standards" ], - "time": "2017-05-22T02:43:20+00:00" + "time": "2018-11-07T22:31:41+00:00" }, { "name": "symfony/console", - "version": "v3.4.17", + "version": "v3.4.19", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "3b2b415d4c48fbefca7dc742aa0a0171bfae4e0b" + "reference": "8f80fc39bbc3b7c47ee54ba7aa2653521ace94bb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/3b2b415d4c48fbefca7dc742aa0a0171bfae4e0b", - "reference": "3b2b415d4c48fbefca7dc742aa0a0171bfae4e0b", + "url": "https://api.github.com/repos/symfony/console/zipball/8f80fc39bbc3b7c47ee54ba7aa2653521ace94bb", + "reference": "8f80fc39bbc3b7c47ee54ba7aa2653521ace94bb", "shasum": "" }, "require": { @@ -2166,20 +2166,20 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2018-10-02T16:33:53+00:00" + "time": "2018-11-26T12:48:07+00:00" }, { "name": "symfony/debug", - "version": "v3.4.17", + "version": "v3.4.19", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "0a612e9dfbd2ccce03eb174365f31ecdca930ff6" + "reference": "2016b3eec2e49c127dd02d0ef44a35c53181560d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/0a612e9dfbd2ccce03eb174365f31ecdca930ff6", - "reference": "0a612e9dfbd2ccce03eb174365f31ecdca930ff6", + "url": "https://api.github.com/repos/symfony/debug/zipball/2016b3eec2e49c127dd02d0ef44a35c53181560d", + "reference": "2016b3eec2e49c127dd02d0ef44a35c53181560d", "shasum": "" }, "require": { @@ -2222,20 +2222,20 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2018-10-02T16:33:53+00:00" + "time": "2018-11-11T19:48:54+00:00" }, { "name": "symfony/finder", - "version": "v3.4.17", + "version": "v3.4.19", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "54ba444dddc5bd5708a34bd095ea67c6eb54644d" + "reference": "6cf2be5cbd0e87aa35c01f80ae0bf40b6798e442" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/54ba444dddc5bd5708a34bd095ea67c6eb54644d", - "reference": "54ba444dddc5bd5708a34bd095ea67c6eb54644d", + "url": "https://api.github.com/repos/symfony/finder/zipball/6cf2be5cbd0e87aa35c01f80ae0bf40b6798e442", + "reference": "6cf2be5cbd0e87aa35c01f80ae0bf40b6798e442", "shasum": "" }, "require": { @@ -2271,11 +2271,11 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2018-10-03T08:46:40+00:00" + "time": "2018-11-11T19:48:54+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.9.0", + "version": "v1.10.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", @@ -2333,16 +2333,16 @@ }, { "name": "symfony/polyfill-mbstring", - "version": "v1.9.0", + "version": "v1.10.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "d0cd638f4634c16d8df4508e847f14e9e43168b8" + "reference": "c79c051f5b3a46be09205c73b80b346e4153e494" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/d0cd638f4634c16d8df4508e847f14e9e43168b8", - "reference": "d0cd638f4634c16d8df4508e847f14e9e43168b8", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/c79c051f5b3a46be09205c73b80b346e4153e494", + "reference": "c79c051f5b3a46be09205c73b80b346e4153e494", "shasum": "" }, "require": { @@ -2388,20 +2388,20 @@ "portable", "shim" ], - "time": "2018-08-06T14:22:27+00:00" + "time": "2018-09-21T13:07:52+00:00" }, { "name": "symfony/yaml", - "version": "v3.4.17", + "version": "v3.4.19", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "640b6c27fed4066d64b64d5903a86043f4a4de7f" + "reference": "291e13d808bec481eab83f301f7bff3e699ef603" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/640b6c27fed4066d64b64d5903a86043f4a4de7f", - "reference": "640b6c27fed4066d64b64d5903a86043f4a4de7f", + "url": "https://api.github.com/repos/symfony/yaml/zipball/291e13d808bec481eab83f301f7bff3e699ef603", + "reference": "291e13d808bec481eab83f301f7bff3e699ef603", "shasum": "" }, "require": { @@ -2447,7 +2447,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2018-10-02T16:33:53+00:00" + "time": "2018-11-11T19:48:54+00:00" }, { "name": "theseer/fdomdocument", @@ -2548,7 +2548,8 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">=5.6" + "php": ">=5.6", + "ext-zlib": "*" }, "platform-dev": [], "platform-overrides": { From bcf056c9d92e5240e645c76a4cdc8ae159693f9a Mon Sep 17 00:00:00 2001 From: VirtualTam Date: Mon, 3 Dec 2018 23:49:20 +0100 Subject: [PATCH 14/75] namespacing: \Shaarli\Updater Signed-off-by: VirtualTam --- application/config/ConfigPhp.php | 2 +- application/{ => updater}/Updater.php | 134 ++++-------------- application/updater/UpdaterUtils.php | 39 +++++ .../updater/exception/UpdaterException.php | 60 ++++++++ composer.json | 4 +- index.php | 3 +- tests/{Updater => updater}/DummyUpdater.php | 9 +- tests/{Updater => updater}/UpdaterTest.php | 29 ++-- tests/utils/config/configPhp.php | 2 +- 9 files changed, 154 insertions(+), 128 deletions(-) rename application/{ => updater}/Updater.php (82%) create mode 100644 application/updater/UpdaterUtils.php create mode 100644 application/updater/exception/UpdaterException.php rename tests/{Updater => updater}/DummyUpdater.php (88%) rename tests/{Updater => updater}/UpdaterTest.php (97%) diff --git a/application/config/ConfigPhp.php b/application/config/ConfigPhp.php index 9ed5d31..cad3459 100644 --- a/application/config/ConfigPhp.php +++ b/application/config/ConfigPhp.php @@ -27,7 +27,7 @@ class ConfigPhp implements ConfigIO /** * Map legacy config keys with the new ones. * If ConfigPhp is used, getting will actually look for . - * The Updater will use this array to transform keys when switching to JSON. + * The updater will use this array to transform keys when switching to JSON. * * @var array current key => legacy key. */ diff --git a/application/Updater.php b/application/updater/Updater.php similarity index 82% rename from application/Updater.php rename to application/updater/Updater.php index ca05ecc..55251a3 100644 --- a/application/Updater.php +++ b/application/updater/Updater.php @@ -1,15 +1,24 @@ methods === null) { - throw new UpdaterException(t('Couldn\'t retrieve Updater class methods.')); + throw new UpdaterException(t('Couldn\'t retrieve updater class methods.')); } foreach ($this->methods as $method) { // Not an update method or already done, pass. - if (! startsWith($method->getName(), 'updateMethod') + if (!startsWith($method->getName(), 'updateMethod') || in_array($method->getName(), $this->doneUpdates) ) { continue; @@ -143,7 +152,7 @@ class Updater } } $this->conf->write($this->isLoggedIn); - unlink($this->conf->get('resource.data_dir').'/options.php'); + unlink($this->conf->get('resource.data_dir') . '/options.php'); } return true; @@ -178,10 +187,10 @@ class Updater $subConfig = array('config', 'plugins'); foreach ($subConfig as $sub) { foreach ($oldConfig[$sub] as $key => $value) { - if (isset($legacyMap[$sub .'.'. $key])) { - $configKey = $legacyMap[$sub .'.'. $key]; + if (isset($legacyMap[$sub . '.' . $key])) { + $configKey = $legacyMap[$sub . '.' . $key]; } else { - $configKey = $sub .'.'. $key; + $configKey = $sub . '.' . $key; } $this->conf->set($configKey, $value); } @@ -237,7 +246,7 @@ class Updater return true; } - $save = $this->conf->get('resource.data_dir') .'/datastore.'. date('YmdHis') .'.php'; + $save = $this->conf->get('resource.data_dir') . '/datastore.' . date('YmdHis') . '.php'; copy($this->conf->get('resource.datastore'), $save); $links = array(); @@ -311,7 +320,7 @@ class Updater // We run the update only if this folder still contains the template files. $tplDir = $this->conf->get('resource.raintpl_tpl'); $tplFile = $tplDir . '/linklist.html'; - if (! file_exists($tplFile)) { + if (!file_exists($tplFile)) { return true; } @@ -335,7 +344,7 @@ class Updater */ public function updateMethodMoveUserCss() { - if (! is_file('inc/user.css')) { + if (!is_file('inc/user.css')) { return true; } @@ -371,11 +380,11 @@ class Updater */ public function updateMethodPiwikUrl() { - if (! $this->conf->exists('plugins.PIWIK_URL') || startsWith($this->conf->get('plugins.PIWIK_URL'), 'http')) { + if (!$this->conf->exists('plugins.PIWIK_URL') || startsWith($this->conf->get('plugins.PIWIK_URL'), 'http')) { return true; } - $this->conf->set('plugins.PIWIK_URL', 'http://'. $this->conf->get('plugins.PIWIK_URL')); + $this->conf->set('plugins.PIWIK_URL', 'http://' . $this->conf->get('plugins.PIWIK_URL')); $this->conf->write($this->isLoggedIn); return true; @@ -485,11 +494,11 @@ class Updater return true; } - if (! $this->conf->exists('general.download_max_size')) { - $this->conf->set('general.download_max_size', 1024*1024*4); + if (!$this->conf->exists('general.download_max_size')) { + $this->conf->set('general.download_max_size', 1024 * 1024 * 4); } - if (! $this->conf->exists('general.download_timeout')) { + if (!$this->conf->exists('general.download_timeout')) { $this->conf->set('general.download_timeout', 30); } @@ -542,96 +551,3 @@ class Updater return true; } } - -/** - * Class UpdaterException. - */ -class UpdaterException extends Exception -{ - /** - * @var string Method where the error occurred. - */ - protected $method; - - /** - * @var Exception The parent exception. - */ - protected $previous; - - /** - * Constructor. - * - * @param string $message Force the error message if set. - * @param string $method Method where the error occurred. - * @param Exception|bool $previous Parent exception. - */ - public function __construct($message = '', $method = '', $previous = false) - { - $this->method = $method; - $this->previous = $previous; - $this->message = $this->buildMessage($message); - } - - /** - * Build the exception error message. - * - * @param string $message Optional given error message. - * - * @return string The built error message. - */ - private function buildMessage($message) - { - $out = ''; - if (! empty($message)) { - $out .= $message . PHP_EOL; - } - - if (! empty($this->method)) { - $out .= t('An error occurred while running the update ') . $this->method . PHP_EOL; - } - - if (! empty($this->previous)) { - $out .= ' '. $this->previous->getMessage(); - } - - return $out; - } -} - -/** - * Read the updates file, and return already done updates. - * - * @param string $updatesFilepath Updates file path. - * - * @return array Already done update methods. - */ -function read_updates_file($updatesFilepath) -{ - if (! empty($updatesFilepath) && is_file($updatesFilepath)) { - $content = file_get_contents($updatesFilepath); - if (! empty($content)) { - return explode(';', $content); - } - } - return array(); -} - -/** - * Write updates file. - * - * @param string $updatesFilepath Updates file path. - * @param array $updates Updates array to write. - * - * @throws Exception Couldn't write version number. - */ -function write_updates_file($updatesFilepath, $updates) -{ - if (empty($updatesFilepath)) { - throw new Exception(t('Updates file path is not set, can\'t write updates.')); - } - - $res = file_put_contents($updatesFilepath, implode(';', $updates)); - if ($res === false) { - throw new Exception(t('Unable to write updates in '. $updatesFilepath . '.')); - } -} diff --git a/application/updater/UpdaterUtils.php b/application/updater/UpdaterUtils.php new file mode 100644 index 0000000..34d4f42 --- /dev/null +++ b/application/updater/UpdaterUtils.php @@ -0,0 +1,39 @@ +method = $method; + $this->previous = $previous; + $this->message = $this->buildMessage($message); + } + + /** + * Build the exception error message. + * + * @param string $message Optional given error message. + * + * @return string The built error message. + */ + private function buildMessage($message) + { + $out = ''; + if (!empty($message)) { + $out .= $message . PHP_EOL; + } + + if (!empty($this->method)) { + $out .= t('An error occurred while running the update ') . $this->method . PHP_EOL; + } + + if (!empty($this->previous)) { + $out .= ' ' . $this->previous->getMessage(); + } + + return $out; + } +} diff --git a/composer.json b/composer.json index 4c14e79..af76347 100644 --- a/composer.json +++ b/composer.json @@ -46,7 +46,9 @@ "Shaarli\\Feed\\": "application/feed", "Shaarli\\Http\\": "application/http", "Shaarli\\Render\\": "application/render", - "Shaarli\\Security\\": "application/security" + "Shaarli\\Security\\": "application/security", + "Shaarli\\Updater\\": "application/updater", + "Shaarli\\Updater\\Exception\\": "application/updater/exception" } } } diff --git a/index.php b/index.php index 146b445..ce0373e 100644 --- a/index.php +++ b/index.php @@ -62,6 +62,7 @@ require_once 'application/config/ConfigPlugin.php'; require_once 'application/feed/Cache.php'; require_once 'application/http/HttpUtils.php'; require_once 'application/http/UrlUtils.php'; +require_once 'application/updater/UpdaterUtils.php'; require_once 'application/FileUtils.php'; require_once 'application/History.php'; require_once 'application/NetscapeBookmarkUtils.php'; @@ -69,7 +70,6 @@ require_once 'application/TimeZone.php'; require_once 'application/Utils.php'; require_once 'application/PluginManager.php'; require_once 'application/Router.php'; -require_once 'application/Updater.php'; use \Shaarli\Bookmark\Exception\LinkNotFoundException; use \Shaarli\Bookmark\LinkDB; @@ -83,6 +83,7 @@ use \Shaarli\Render\ThemeUtils; use \Shaarli\Security\LoginManager; use \Shaarli\Security\SessionManager; use \Shaarli\Thumbnailer; +use Shaarli\Updater\Updater; // Ensure the PHP version is supported try { diff --git a/tests/Updater/DummyUpdater.php b/tests/updater/DummyUpdater.php similarity index 88% rename from tests/Updater/DummyUpdater.php rename to tests/updater/DummyUpdater.php index 3c74b4f..9e866f1 100644 --- a/tests/Updater/DummyUpdater.php +++ b/tests/updater/DummyUpdater.php @@ -1,12 +1,15 @@ conf->setConfigFile('tests/utils/config/configPhp'); $this->conf->reset(); - $optionsFile = 'tests/Updater/options.php'; + $optionsFile = 'tests/updater/options.php'; $options = 'conf->setConfigFile('tests/Updater/config'); + $this->conf->setConfigFile('tests/updater/config'); // merge configs $updater = new Updater(array(), array(), $this->conf, true); - // This writes a new config file in tests/Updater/config.php + // This writes a new config file in tests/updater/config.php $updater->updateMethodMergeDeprecatedConfigFile(); // make sure updated field is changed @@ -218,7 +223,7 @@ $GLOBALS[\'privateLinkByDefault\'] = true;'; */ public function testRenameDashTags() { - $refDB = new ReferenceLinkDB(); + $refDB = new \ReferenceLinkDB(); $refDB->write(self::$testDatastore); $linkDB = new LinkDB(self::$testDatastore, true, false); @@ -364,7 +369,7 @@ $GLOBALS[\'privateLinkByDefault\'] = true;'; 'private' => true, ), ); - $refDB = new ReferenceLinkDB(); + $refDB = new \ReferenceLinkDB(); $refDB->setLinks($links); $refDB->write(self::$testDatastore); $linkDB = new LinkDB(self::$testDatastore, true, false); @@ -428,7 +433,7 @@ $GLOBALS[\'privateLinkByDefault\'] = true;'; */ public function testDatastoreIdsNothingToDo() { - $refDB = new ReferenceLinkDB(); + $refDB = new \ReferenceLinkDB(); $refDB->write(self::$testDatastore); $linkDB = new LinkDB(self::$testDatastore, true, false); @@ -765,7 +770,7 @@ $GLOBALS[\'privateLinkByDefault\'] = true;'; 1 => ['id' => 1] + $blank, 2 => ['id' => 2] + $blank, ]; - $refDB = new ReferenceLinkDB(); + $refDB = new \ReferenceLinkDB(); $refDB->setLinks($links); $refDB->write(self::$testDatastore); $linkDB = new LinkDB(self::$testDatastore, true, false); @@ -796,7 +801,7 @@ $GLOBALS[\'privateLinkByDefault\'] = true;'; 1 => ['id' => 1, 'sticky' => true] + $blank, 2 => ['id' => 2] + $blank, ]; - $refDB = new ReferenceLinkDB(); + $refDB = new \ReferenceLinkDB(); $refDB->setLinks($links); $refDB->write(self::$testDatastore); $linkDB = new LinkDB(self::$testDatastore, true, false); diff --git a/tests/utils/config/configPhp.php b/tests/utils/config/configPhp.php index 34b11fc..7dc81e2 100644 --- a/tests/utils/config/configPhp.php +++ b/tests/utils/config/configPhp.php @@ -8,7 +8,7 @@ $GLOBALS['titleLink'] = 'titleLink'; $GLOBALS['redirector'] = 'lala'; $GLOBALS['disablesessionprotection'] = false; $GLOBALS['privateLinkByDefault'] = false; -$GLOBALS['config']['DATADIR'] = 'tests/Updater'; +$GLOBALS['config']['DATADIR'] = 'tests/updater'; $GLOBALS['config']['PAGECACHE'] = 'sandbox/pagecache'; $GLOBALS['config']['DATASTORE'] = 'data/datastore.php'; $GLOBALS['plugins']['WALLABAG_VERSION'] = '1'; From 9778a1551ce708b9f421a181806412a05410f1fb Mon Sep 17 00:00:00 2001 From: VirtualTam Date: Mon, 3 Dec 2018 23:58:59 +0100 Subject: [PATCH 15/75] namespacing: \Shaarli\ApplicationUtils Signed-off-by: VirtualTam --- application/ApplicationUtils.php | 75 +++++++++++++++------------- application/render/PageBuilder.php | 2 +- application/updater/Updater.php | 2 +- index.php | 4 +- tests/ApplicationUtilsTest.php | 27 ++-------- tests/utils/FakeApplicationUtils.php | 19 +++++++ 6 files changed, 67 insertions(+), 62 deletions(-) create mode 100644 tests/utils/FakeApplicationUtils.php diff --git a/application/ApplicationUtils.php b/application/ApplicationUtils.php index a3b2dcb..7fe3cb3 100644 --- a/application/ApplicationUtils.php +++ b/application/ApplicationUtils.php @@ -1,4 +1,9 @@ get('resource.theme'), - ) as $path) { - if (! is_readable(realpath($path))) { - $errors[] = '"'.$path.'" '. t('directory is not readable'); + 'application', + 'inc', + 'plugins', + $rainTplDir, + $rainTplDir . '/' . $conf->get('resource.theme'), + ) as $path) { + if (!is_readable(realpath($path))) { + $errors[] = '"' . $path . '" ' . t('directory is not readable'); } } // Check cache and data directories are readable and writable foreach (array( - $conf->get('resource.thumbnails_cache'), - $conf->get('resource.data_dir'), - $conf->get('resource.page_cache'), - $conf->get('resource.raintpl_tmp'), - ) as $path) { - if (! is_readable(realpath($path))) { - $errors[] = '"'.$path.'" '. t('directory is not readable'); + $conf->get('resource.thumbnails_cache'), + $conf->get('resource.data_dir'), + $conf->get('resource.page_cache'), + $conf->get('resource.raintpl_tmp'), + ) as $path) { + if (!is_readable(realpath($path))) { + $errors[] = '"' . $path . '" ' . t('directory is not readable'); } - if (! is_writable(realpath($path))) { - $errors[] = '"'.$path.'" '. t('directory is not writable'); + if (!is_writable(realpath($path))) { + $errors[] = '"' . $path . '" ' . t('directory is not writable'); } } // Check configuration files are readable and writable foreach (array( - $conf->getConfigFileExt(), - $conf->get('resource.datastore'), - $conf->get('resource.ban_file'), - $conf->get('resource.log'), - $conf->get('resource.update_check'), - ) as $path) { - if (! is_file(realpath($path))) { + $conf->getConfigFileExt(), + $conf->get('resource.datastore'), + $conf->get('resource.ban_file'), + $conf->get('resource.log'), + $conf->get('resource.update_check'), + ) as $path) { + if (!is_file(realpath($path))) { # the file may not exist yet continue; } - if (! is_readable(realpath($path))) { - $errors[] = '"'.$path.'" '. t('file is not readable'); + if (!is_readable(realpath($path))) { + $errors[] = '"' . $path . '" ' . t('file is not readable'); } - if (! is_writable(realpath($path))) { - $errors[] = '"'.$path.'" '. t('file is not writable'); + if (!is_writable(realpath($path))) { + $errors[] = '"' . $path . '" ' . t('file is not writable'); } } diff --git a/application/render/PageBuilder.php b/application/render/PageBuilder.php index 9a0fe61..1c5b925 100644 --- a/application/render/PageBuilder.php +++ b/application/render/PageBuilder.php @@ -2,7 +2,7 @@ namespace Shaarli\Render; -use ApplicationUtils; +use Shaarli\ApplicationUtils; use Exception; use Shaarli\Bookmark\LinkDB; use RainTPL; diff --git a/application/updater/Updater.php b/application/updater/Updater.php index 55251a3..89f0ff7 100644 --- a/application/updater/Updater.php +++ b/application/updater/Updater.php @@ -2,7 +2,7 @@ namespace Shaarli\Updater; -use ApplicationUtils; +use Shaarli\ApplicationUtils; use Exception; use RainTPL; use ReflectionClass; diff --git a/index.php b/index.php index ce0373e..3a7dab2 100644 --- a/index.php +++ b/index.php @@ -56,7 +56,6 @@ require_once 'inc/rain.tpl.class.php'; require_once __DIR__ . '/vendor/autoload.php'; // Shaarli library -require_once 'application/ApplicationUtils.php'; require_once 'application/bookmark/LinkUtils.php'; require_once 'application/config/ConfigPlugin.php'; require_once 'application/feed/Cache.php'; @@ -71,6 +70,7 @@ require_once 'application/Utils.php'; require_once 'application/PluginManager.php'; require_once 'application/Router.php'; +use \Shaarli\ApplicationUtils; use \Shaarli\Bookmark\Exception\LinkNotFoundException; use \Shaarli\Bookmark\LinkDB; use \Shaarli\Config\ConfigManager; @@ -83,7 +83,7 @@ use \Shaarli\Render\ThemeUtils; use \Shaarli\Security\LoginManager; use \Shaarli\Security\SessionManager; use \Shaarli\Thumbnailer; -use Shaarli\Updater\Updater; +use \Shaarli\Updater\Updater; // Ensure the PHP version is supported try { diff --git a/tests/ApplicationUtilsTest.php b/tests/ApplicationUtilsTest.php index fe5f84c..82f8804 100644 --- a/tests/ApplicationUtilsTest.php +++ b/tests/ApplicationUtilsTest.php @@ -1,33 +1,14 @@ Date: Tue, 4 Dec 2018 00:02:17 +0100 Subject: [PATCH 16/75] namespacing: \Shaarli\Router Signed-off-by: VirtualTam --- application/Router.php | 43 +++++++++++---------- index.php | 3 +- plugins/addlink_toolbar/addlink_toolbar.php | 2 + plugins/demo_plugin/demo_plugin.php | 1 + plugins/isso/isso.php | 1 + plugins/markdown/markdown.php | 1 + plugins/playvideos/playvideos.php | 2 + plugins/pubsubhubbub/pubsubhubbub.php | 1 + plugins/qrcode/qrcode.php | 2 + tests/RouterTest.php | 9 +---- tests/plugins/PluginAddlinkTest.php | 2 + tests/plugins/PluginPlayvideosTest.php | 2 + tests/plugins/PluginPubsubhubbubTest.php | 1 + tests/plugins/PluginQrcodeTest.php | 2 + 14 files changed, 42 insertions(+), 30 deletions(-) diff --git a/application/Router.php b/application/Router.php index beb3165..05877ac 100644 --- a/application/Router.php +++ b/application/Router.php @@ -1,4 +1,5 @@ Date: Tue, 4 Dec 2018 00:13:42 +0100 Subject: [PATCH 17/75] namespacing: \Shaarli\Netscape\NetscapeBookmarkUtils Signed-off-by: VirtualTam --- .../{ => netscape}/NetscapeBookmarkUtils.php | 27 +++++++++++-------- composer.json | 1 + index.php | 2 +- .../BookmarkExportTest.php | 9 ++++--- .../BookmarkImportTest.php | 6 ++--- .../input/empty.htm | 0 .../input/internet_explorer_encoding.htm | 0 .../input/lowercase_doctype.htm | 0 .../input/netscape_basic.htm | 0 .../input/netscape_nested.htm | 0 .../input/no_doctype.htm | 0 .../input/same_date.htm | 0 12 files changed, 26 insertions(+), 19 deletions(-) rename application/{ => netscape}/NetscapeBookmarkUtils.php (90%) rename tests/{NetscapeBookmarkUtils => netscape}/BookmarkExportTest.php (94%) rename tests/{NetscapeBookmarkUtils => netscape}/BookmarkImportTest.php (99%) rename tests/{NetscapeBookmarkUtils => netscape}/input/empty.htm (100%) rename tests/{NetscapeBookmarkUtils => netscape}/input/internet_explorer_encoding.htm (100%) rename tests/{NetscapeBookmarkUtils => netscape}/input/lowercase_doctype.htm (100%) rename tests/{NetscapeBookmarkUtils => netscape}/input/netscape_basic.htm (100%) rename tests/{NetscapeBookmarkUtils => netscape}/input/netscape_nested.htm (100%) rename tests/{NetscapeBookmarkUtils => netscape}/input/no_doctype.htm (100%) rename tests/{NetscapeBookmarkUtils => netscape}/input/same_date.htm (100%) diff --git a/application/NetscapeBookmarkUtils.php b/application/netscape/NetscapeBookmarkUtils.php similarity index 90% rename from application/NetscapeBookmarkUtils.php rename to application/netscape/NetscapeBookmarkUtils.php index e0022fe..2bf928c 100644 --- a/application/NetscapeBookmarkUtils.php +++ b/application/netscape/NetscapeBookmarkUtils.php @@ -1,5 +1,10 @@ get('resource.data_dir'), - ! $conf->get('dev.debug') ? LogLevel::INFO : LogLevel::DEBUG, + !$conf->get('dev.debug') ? LogLevel::INFO : LogLevel::DEBUG, [ 'prefix' => 'import.', 'extension' => 'log', @@ -195,7 +200,7 @@ class NetscapeBookmarkUtils } // Add a new link - @ used for UNIX timestamps - $newLinkDate = new DateTime('@'.strval($bkm['time'])); + $newLinkDate = new DateTime('@' . strval($bkm['time'])); $newLinkDate->setTimezone(new DateTimeZone(date_default_timezone_get())); $newLink['created'] = $newLinkDate; $newLink['id'] = $linkDb->getNextId(); diff --git a/composer.json b/composer.json index af76347..c1f4731 100644 --- a/composer.json +++ b/composer.json @@ -45,6 +45,7 @@ "Shaarli\\Exceptions\\": "application/exceptions", "Shaarli\\Feed\\": "application/feed", "Shaarli\\Http\\": "application/http", + "Shaarli\\Netscape\\": "application/netscape", "Shaarli\\Render\\": "application/render", "Shaarli\\Security\\": "application/security", "Shaarli\\Updater\\": "application/updater", diff --git a/index.php b/index.php index 1dec569..bff8e8f 100644 --- a/index.php +++ b/index.php @@ -63,7 +63,6 @@ require_once 'application/http/HttpUtils.php'; require_once 'application/http/UrlUtils.php'; require_once 'application/updater/UpdaterUtils.php'; require_once 'application/FileUtils.php'; -require_once 'application/NetscapeBookmarkUtils.php'; require_once 'application/TimeZone.php'; require_once 'application/Utils.php'; require_once 'application/PluginManager.php'; @@ -76,6 +75,7 @@ use \Shaarli\Feed\CachedPage; use \Shaarli\Feed\FeedBuilder; use \Shaarli\History; use \Shaarli\Languages; +use \Shaarli\Netscape\NetscapeBookmarkUtils; use \Shaarli\Render\PageBuilder; use \Shaarli\Render\ThemeUtils; use \Shaarli\Router; diff --git a/tests/NetscapeBookmarkUtils/BookmarkExportTest.php b/tests/netscape/BookmarkExportTest.php similarity index 94% rename from tests/NetscapeBookmarkUtils/BookmarkExportTest.php rename to tests/netscape/BookmarkExportTest.php index adf854c..6de9876 100644 --- a/tests/NetscapeBookmarkUtils/BookmarkExportTest.php +++ b/tests/netscape/BookmarkExportTest.php @@ -1,13 +1,14 @@ write(self::$testDatastore); self::$linkDb = new LinkDB(self::$testDatastore, true, false); } diff --git a/tests/NetscapeBookmarkUtils/BookmarkImportTest.php b/tests/netscape/BookmarkImportTest.php similarity index 99% rename from tests/NetscapeBookmarkUtils/BookmarkImportTest.php rename to tests/netscape/BookmarkImportTest.php index 98c989b..ccafc16 100644 --- a/tests/NetscapeBookmarkUtils/BookmarkImportTest.php +++ b/tests/netscape/BookmarkImportTest.php @@ -1,7 +1,7 @@ Date: Tue, 4 Dec 2018 00:26:50 +0100 Subject: [PATCH 18/75] namespacing: \Shaarli\Plugin\PluginManager Signed-off-by: VirtualTam --- application/{ => plugin}/PluginManager.php | 39 +++++++------------ .../exception/PluginFileNotFoundException.php | 23 +++++++++++ composer.json | 2 + index.php | 2 +- plugins/archiveorg/archiveorg.php | 2 + plugins/demo_plugin/demo_plugin.php | 1 + plugins/isso/isso.php | 1 + plugins/markdown/markdown.php | 1 + plugins/piwik/piwik.php | 2 + plugins/playvideos/playvideos.php | 1 + plugins/pubsubhubbub/pubsubhubbub.php | 1 + plugins/qrcode/qrcode.php | 1 + plugins/wallabag/wallabag.php | 1 + tests/PluginManagerTest.php | 10 ++--- tests/plugins/PluginAddlinkTest.php | 9 +---- tests/plugins/PluginArchiveorgTest.php | 2 + tests/plugins/PluginIssoTest.php | 1 + tests/plugins/PluginMarkdownTest.php | 1 + tests/plugins/PluginPlayvideosTest.php | 1 + tests/plugins/PluginPubsubhubbubTest.php | 1 + tests/plugins/PluginQrcodeTest.php | 1 + tests/plugins/PluginWallabagTest.php | 3 +- 22 files changed, 65 insertions(+), 41 deletions(-) rename application/{ => plugin}/PluginManager.php (87%) create mode 100644 application/plugin/exception/PluginFileNotFoundException.php diff --git a/application/PluginManager.php b/application/plugin/PluginManager.php similarity index 87% rename from application/PluginManager.php rename to application/plugin/PluginManager.php index 1ed4db4..f7b24a8 100644 --- a/application/PluginManager.php +++ b/application/plugin/PluginManager.php @@ -1,4 +1,8 @@ errors; } } - -/** - * Class PluginFileNotFoundException - * - * Raise when plugin files can't be found. - */ -class PluginFileNotFoundException extends Exception -{ - /** - * Construct exception with plugin name. - * Generate message. - * - * @param string $pluginName name of the plugin not found - */ - public function __construct($pluginName) - { - $this->message = sprintf(t('Plugin "%s" files not found.'), $pluginName); - } -} diff --git a/application/plugin/exception/PluginFileNotFoundException.php b/application/plugin/exception/PluginFileNotFoundException.php new file mode 100644 index 0000000..e5386f0 --- /dev/null +++ b/application/plugin/exception/PluginFileNotFoundException.php @@ -0,0 +1,23 @@ +message = sprintf(t('Plugin "%s" files not found.'), $pluginName); + } +} diff --git a/composer.json b/composer.json index c1f4731..a2df466 100644 --- a/composer.json +++ b/composer.json @@ -46,6 +46,8 @@ "Shaarli\\Feed\\": "application/feed", "Shaarli\\Http\\": "application/http", "Shaarli\\Netscape\\": "application/netscape", + "Shaarli\\Plugin\\": "application/plugin", + "Shaarli\\Plugin\\Exception\\": "application/plugin/exception", "Shaarli\\Render\\": "application/render", "Shaarli\\Security\\": "application/security", "Shaarli\\Updater\\": "application/updater", diff --git a/index.php b/index.php index bff8e8f..633ab89 100644 --- a/index.php +++ b/index.php @@ -65,7 +65,6 @@ require_once 'application/updater/UpdaterUtils.php'; require_once 'application/FileUtils.php'; require_once 'application/TimeZone.php'; require_once 'application/Utils.php'; -require_once 'application/PluginManager.php'; use \Shaarli\ApplicationUtils; use \Shaarli\Bookmark\Exception\LinkNotFoundException; @@ -76,6 +75,7 @@ use \Shaarli\Feed\FeedBuilder; use \Shaarli\History; use \Shaarli\Languages; use \Shaarli\Netscape\NetscapeBookmarkUtils; +use \Shaarli\Plugin\PluginManager; use \Shaarli\Render\PageBuilder; use \Shaarli\Render\ThemeUtils; use \Shaarli\Router; diff --git a/plugins/archiveorg/archiveorg.php b/plugins/archiveorg/archiveorg.php index 5dcea5a..0ee1c73 100644 --- a/plugins/archiveorg/archiveorg.php +++ b/plugins/archiveorg/archiveorg.php @@ -5,6 +5,8 @@ * Add an icon in the link list for archive.org. */ +use Shaarli\Plugin\PluginManager; + /** * Add archive.org icon to link_plugin when rendering linklist. * diff --git a/plugins/demo_plugin/demo_plugin.php b/plugins/demo_plugin/demo_plugin.php index 94ce38f..95ea7fe 100644 --- a/plugins/demo_plugin/demo_plugin.php +++ b/plugins/demo_plugin/demo_plugin.php @@ -15,6 +15,7 @@ */ use Shaarli\Config\ConfigManager; +use Shaarli\Plugin\PluginManager; use Shaarli\Router; /** diff --git a/plugins/isso/isso.php b/plugins/isso/isso.php index 9bdd590..dab75dd 100644 --- a/plugins/isso/isso.php +++ b/plugins/isso/isso.php @@ -5,6 +5,7 @@ */ use Shaarli\Config\ConfigManager; +use Shaarli\Plugin\PluginManager; use Shaarli\Router; /** diff --git a/plugins/markdown/markdown.php b/plugins/markdown/markdown.php index 9928a48..628970d 100644 --- a/plugins/markdown/markdown.php +++ b/plugins/markdown/markdown.php @@ -7,6 +7,7 @@ */ use Shaarli\Config\ConfigManager; +use Shaarli\Plugin\PluginManager; use Shaarli\Router; /* diff --git a/plugins/piwik/piwik.php b/plugins/piwik/piwik.php index ca00c2b..17b1aec 100644 --- a/plugins/piwik/piwik.php +++ b/plugins/piwik/piwik.php @@ -4,6 +4,8 @@ * Adds tracking code on each page. */ +use Shaarli\Plugin\PluginManager; + /** * Initialization function. * It will be called when the plugin is loaded. diff --git a/plugins/playvideos/playvideos.php b/plugins/playvideos/playvideos.php index bb5b9e9..0341ed5 100644 --- a/plugins/playvideos/playvideos.php +++ b/plugins/playvideos/playvideos.php @@ -6,6 +6,7 @@ * Note: this plugin adds jQuery. */ +use Shaarli\Plugin\PluginManager; use Shaarli\Router; /** diff --git a/plugins/pubsubhubbub/pubsubhubbub.php b/plugins/pubsubhubbub/pubsubhubbub.php index a7bd34c..2878c05 100644 --- a/plugins/pubsubhubbub/pubsubhubbub.php +++ b/plugins/pubsubhubbub/pubsubhubbub.php @@ -12,6 +12,7 @@ use pubsubhubbub\publisher\Publisher; use Shaarli\Config\ConfigManager; use Shaarli\Feed\FeedBuilder; +use Shaarli\Plugin\PluginManager; use Shaarli\Router; /** diff --git a/plugins/qrcode/qrcode.php b/plugins/qrcode/qrcode.php index 21908ce..34eef8b 100644 --- a/plugins/qrcode/qrcode.php +++ b/plugins/qrcode/qrcode.php @@ -5,6 +5,7 @@ * Display a QRCode icon in link list. */ +use Shaarli\Plugin\PluginManager; use Shaarli\Router; /** diff --git a/plugins/wallabag/wallabag.php b/plugins/wallabag/wallabag.php index a6476c7..5ba1611 100644 --- a/plugins/wallabag/wallabag.php +++ b/plugins/wallabag/wallabag.php @@ -6,6 +6,7 @@ require_once 'WallabagInstance.php'; use Shaarli\Config\ConfigManager; +use Shaarli\Plugin\PluginManager; /** * Init function, return an error if the server is not set. diff --git a/tests/PluginManagerTest.php b/tests/PluginManagerTest.php index 01de959..71761ac 100644 --- a/tests/PluginManagerTest.php +++ b/tests/PluginManagerTest.php @@ -1,16 +1,12 @@ Date: Tue, 4 Dec 2018 23:17:23 +0100 Subject: [PATCH 19/75] namespacing: add plugin tests to \Shaarli\Plugin\[...] Signed-off-by: VirtualTam --- composer.json | 1 + plugins/wallabag/WallabagInstance.php | 1 + plugins/wallabag/wallabag.php | 5 ++--- tests/plugins/PluginAddlinkTest.php | 1 + tests/plugins/PluginArchiveorgTest.php | 3 ++- tests/plugins/PluginIssoTest.php | 4 +++- tests/plugins/PluginMarkdownTest.php | 4 +++- tests/plugins/PluginPlayvideosTest.php | 4 ++-- tests/plugins/PluginPubsubhubbubTest.php | 5 +++-- tests/plugins/PluginQrcodeTest.php | 5 +++-- tests/plugins/PluginWallabagTest.php | 6 ++---- tests/plugins/WallabagInstanceTest.php | 5 +++-- 12 files changed, 26 insertions(+), 18 deletions(-) diff --git a/composer.json b/composer.json index a2df466..8a98cfb 100644 --- a/composer.json +++ b/composer.json @@ -48,6 +48,7 @@ "Shaarli\\Netscape\\": "application/netscape", "Shaarli\\Plugin\\": "application/plugin", "Shaarli\\Plugin\\Exception\\": "application/plugin/exception", + "Shaarli\\Plugin\\Wallabag\\": "plugins/wallabag", "Shaarli\\Render\\": "application/render", "Shaarli\\Security\\": "application/security", "Shaarli\\Updater\\": "application/updater", diff --git a/plugins/wallabag/WallabagInstance.php b/plugins/wallabag/WallabagInstance.php index eb8ab61..f4a0a92 100644 --- a/plugins/wallabag/WallabagInstance.php +++ b/plugins/wallabag/WallabagInstance.php @@ -1,4 +1,5 @@ Date: Tue, 4 Dec 2018 23:49:29 +0100 Subject: [PATCH 20/75] composer: add and document optional PHP extensions Signed-off-by: VirtualTam --- composer.json | 7 +++++- composer.lock | 66 ++++++++++++++++++++++++++------------------------- 2 files changed, 40 insertions(+), 33 deletions(-) diff --git a/composer.json b/composer.json index 8a98cfb..a52b5f7 100644 --- a/composer.json +++ b/composer.json @@ -16,6 +16,7 @@ }, "require": { "php": ">=5.6", + "ext-json": "*", "ext-zlib": "*", "shaarli/netscape-bookmark-parser": "^2.1", "erusev/parsedown": "^1.6", @@ -30,7 +31,11 @@ "squizlabs/php_codesniffer": "2.*" }, "suggest": { - "ext-curl": "*" + "ext-curl": "Allows fetching web pages and thumbnails in a more robust way", + "ext-gd": "Required for thumbnail generation", + "ext-gettext": "Enables faster translation system in gettext mode", + "ext-intl": "Provides localized text sorting", + "ext-mbstring": "Provides multibyte (Unicode) string support" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index 5723cff..53fb217 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "45937c29ca4a55504b0d0a60a03c42c6", + "content-hash": "f8965821c946c2a1271c3f8c7e8c6eea", "packages": [ { "name": "arthurhoaro/web-thumbnailer", @@ -133,16 +133,16 @@ }, { "name": "gettext/gettext", - "version": "v4.6.1", + "version": "v4.6.2", "source": { "type": "git", "url": "https://github.com/oscarotero/Gettext.git", - "reference": "854ff5f5aaf92d2af7080ba8fc15718b27b5c89a" + "reference": "93176b272d61fb58a9767be71c50d19149cb1e48" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/oscarotero/Gettext/zipball/854ff5f5aaf92d2af7080ba8fc15718b27b5c89a", - "reference": "854ff5f5aaf92d2af7080ba8fc15718b27b5c89a", + "url": "https://api.github.com/repos/oscarotero/Gettext/zipball/93176b272d61fb58a9767be71c50d19149cb1e48", + "reference": "93176b272d61fb58a9767be71c50d19149cb1e48", "shasum": "" }, "require": { @@ -191,7 +191,7 @@ "po", "translation" ], - "time": "2018-08-27T15:40:19+00:00" + "time": "2019-01-12T18:40:56+00:00" }, { "name": "gettext/languages", @@ -2101,16 +2101,16 @@ }, { "name": "symfony/console", - "version": "v3.4.19", + "version": "v3.4.21", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "8f80fc39bbc3b7c47ee54ba7aa2653521ace94bb" + "reference": "a700b874d3692bc8342199adfb6d3b99f62cc61a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/8f80fc39bbc3b7c47ee54ba7aa2653521ace94bb", - "reference": "8f80fc39bbc3b7c47ee54ba7aa2653521ace94bb", + "url": "https://api.github.com/repos/symfony/console/zipball/a700b874d3692bc8342199adfb6d3b99f62cc61a", + "reference": "a700b874d3692bc8342199adfb6d3b99f62cc61a", "shasum": "" }, "require": { @@ -2166,20 +2166,20 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2018-11-26T12:48:07+00:00" + "time": "2019-01-04T04:42:43+00:00" }, { "name": "symfony/debug", - "version": "v3.4.19", + "version": "v3.4.21", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "2016b3eec2e49c127dd02d0ef44a35c53181560d" + "reference": "26d7f23b9bd0b93bee5583e4d6ca5cb1ab31b186" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/2016b3eec2e49c127dd02d0ef44a35c53181560d", - "reference": "2016b3eec2e49c127dd02d0ef44a35c53181560d", + "url": "https://api.github.com/repos/symfony/debug/zipball/26d7f23b9bd0b93bee5583e4d6ca5cb1ab31b186", + "reference": "26d7f23b9bd0b93bee5583e4d6ca5cb1ab31b186", "shasum": "" }, "require": { @@ -2222,20 +2222,20 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2018-11-11T19:48:54+00:00" + "time": "2019-01-01T13:45:19+00:00" }, { "name": "symfony/finder", - "version": "v3.4.19", + "version": "v3.4.21", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "6cf2be5cbd0e87aa35c01f80ae0bf40b6798e442" + "reference": "3f2a2ab6315dd7682d4c16dcae1e7b95c8b8555e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/6cf2be5cbd0e87aa35c01f80ae0bf40b6798e442", - "reference": "6cf2be5cbd0e87aa35c01f80ae0bf40b6798e442", + "url": "https://api.github.com/repos/symfony/finder/zipball/3f2a2ab6315dd7682d4c16dcae1e7b95c8b8555e", + "reference": "3f2a2ab6315dd7682d4c16dcae1e7b95c8b8555e", "shasum": "" }, "require": { @@ -2271,7 +2271,7 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2018-11-11T19:48:54+00:00" + "time": "2019-01-01T13:45:19+00:00" }, { "name": "symfony/polyfill-ctype", @@ -2392,16 +2392,16 @@ }, { "name": "symfony/yaml", - "version": "v3.4.19", + "version": "v3.4.21", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "291e13d808bec481eab83f301f7bff3e699ef603" + "reference": "554a59a1ccbaac238a89b19c8e551a556fd0e2ea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/291e13d808bec481eab83f301f7bff3e699ef603", - "reference": "291e13d808bec481eab83f301f7bff3e699ef603", + "url": "https://api.github.com/repos/symfony/yaml/zipball/554a59a1ccbaac238a89b19c8e551a556fd0e2ea", + "reference": "554a59a1ccbaac238a89b19c8e551a556fd0e2ea", "shasum": "" }, "require": { @@ -2447,7 +2447,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2018-11-11T19:48:54+00:00" + "time": "2019-01-01T13:45:19+00:00" }, { "name": "theseer/fdomdocument", @@ -2491,20 +2491,21 @@ }, { "name": "webmozart/assert", - "version": "1.3.0", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/webmozart/assert.git", - "reference": "0df1908962e7a3071564e857d86874dad1ef204a" + "reference": "83e253c8e0be5b0257b881e1827274667c5c17a9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/0df1908962e7a3071564e857d86874dad1ef204a", - "reference": "0df1908962e7a3071564e857d86874dad1ef204a", + "url": "https://api.github.com/repos/webmozart/assert/zipball/83e253c8e0be5b0257b881e1827274667c5c17a9", + "reference": "83e253c8e0be5b0257b881e1827274667c5c17a9", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0" + "php": "^5.3.3 || ^7.0", + "symfony/polyfill-ctype": "^1.8" }, "require-dev": { "phpunit/phpunit": "^4.6", @@ -2537,7 +2538,7 @@ "check", "validate" ], - "time": "2018-01-29T19:49:41+00:00" + "time": "2018-12-25T11:19:39+00:00" } ], "aliases": [], @@ -2549,6 +2550,7 @@ "prefer-lowest": false, "platform": { "php": ">=5.6", + "ext-json": "*", "ext-zlib": "*" }, "platform-dev": [], From a43e7842e44068584302ec1d6349155b571d9c96 Mon Sep 17 00:00:00 2001 From: VirtualTam Date: Sat, 12 Jan 2019 23:19:15 +0100 Subject: [PATCH 21/75] API: update test regexes to comply with PCRE2 Signed-off-by: VirtualTam --- tests/api/controllers/links/PostLinkTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/api/controllers/links/PostLinkTest.php b/tests/api/controllers/links/PostLinkTest.php index ade07ee..24e591d 100644 --- a/tests/api/controllers/links/PostLinkTest.php +++ b/tests/api/controllers/links/PostLinkTest.php @@ -121,7 +121,7 @@ class PostLinkTest extends TestCase $data = json_decode((string) $response->getBody(), true); $this->assertEquals(self::NB_FIELDS_LINK, count($data)); $this->assertEquals(43, $data['id']); - $this->assertRegExp('/[\w-_]{6}/', $data['shorturl']); + $this->assertRegExp('/[\w_-]{6}/', $data['shorturl']); $this->assertEquals('http://domain.tld/?' . $data['shorturl'], $data['url']); $this->assertEquals('?' . $data['shorturl'], $data['title']); $this->assertEquals('', $data['description']); @@ -166,7 +166,7 @@ class PostLinkTest extends TestCase $data = json_decode((string) $response->getBody(), true); $this->assertEquals(self::NB_FIELDS_LINK, count($data)); $this->assertEquals(43, $data['id']); - $this->assertRegExp('/[\w-_]{6}/', $data['shorturl']); + $this->assertRegExp('/[\w_-]{6}/', $data['shorturl']); $this->assertEquals('http://' . $link['url'], $data['url']); $this->assertEquals($link['title'], $data['title']); $this->assertEquals($link['description'], $data['description']); From dea72c711ff740b3b829d238fcf85648465143a0 Mon Sep 17 00:00:00 2001 From: VirtualTam Date: Sat, 12 Jan 2019 23:55:38 +0100 Subject: [PATCH 22/75] Optimize and cleanup imports Signed-off-by: VirtualTam --- application/Languages.php | 1 - application/Thumbnailer.php | 2 +- application/api/ApiMiddleware.php | 3 +- application/api/ApiUtils.php | 2 +- application/api/controllers/ApiController.php | 7 +++-- .../{History.php => HistoryController.php} | 2 +- application/api/controllers/Tags.php | 1 - .../exceptions/ApiLinkNotFoundException.php | 2 -- .../exceptions/ApiTagNotFoundException.php | 2 -- application/bookmark/LinkDB.php | 1 - application/feed/FeedBuilder.php | 1 - .../netscape/NetscapeBookmarkUtils.php | 2 +- application/render/PageBuilder.php | 4 +-- application/updater/Updater.php | 2 +- tests/LanguagesTest.php | 2 +- tests/TimeZoneTest.php | 2 +- tests/UtilsTest.php | 2 +- tests/api/ApiMiddlewareTest.php | 3 +- tests/api/ApiUtilsTest.php | 2 +- tests/api/controllers/history/HistoryTest.php | 28 +++++++++---------- tests/api/controllers/info/InfoTest.php | 3 +- .../api/controllers/links/DeleteLinkTest.php | 18 ++++++------ tests/api/controllers/links/GetLinkIdTest.php | 3 +- tests/api/controllers/links/GetLinksTest.php | 10 +++---- tests/api/controllers/links/PostLinkTest.php | 9 +++--- tests/api/controllers/links/PutLinkTest.php | 11 ++++---- tests/api/controllers/tags/DeleteTagTest.php | 22 ++++++++------- tests/api/controllers/tags/GetTagNameTest.php | 6 ++-- tests/api/controllers/tags/GetTagsTest.php | 8 +++--- tests/api/controllers/tags/PutTagTest.php | 17 +++++------ tests/bookmark/LinkDBTest.php | 1 - tests/config/ConfigJsonTest.php | 2 +- tests/config/ConfigManagerTest.php | 2 +- tests/config/ConfigPhpTest.php | 2 +- tests/config/ConfigPluginTest.php | 2 +- tests/feed/FeedBuilderTest.php | 2 +- tests/languages/fr/LanguagesFrTest.php | 2 +- tests/plugins/WallabagInstanceTest.php | 2 -- tests/render/ThemeUtilsTest.php | 2 +- tests/security/LoginManagerTest.php | 3 +- tests/security/SessionManagerTest.php | 4 +-- 41 files changed, 98 insertions(+), 104 deletions(-) rename application/api/controllers/{History.php => HistoryController.php} (97%) diff --git a/application/Languages.php b/application/Languages.php index b9c5d0e..5cda802 100644 --- a/application/Languages.php +++ b/application/Languages.php @@ -3,7 +3,6 @@ namespace Shaarli; use Gettext\GettextTranslator; -use Gettext\Merge; use Gettext\Translations; use Gettext\Translator; use Gettext\TranslatorInterface; diff --git a/application/Thumbnailer.php b/application/Thumbnailer.php index 37ed97a..a23f98e 100644 --- a/application/Thumbnailer.php +++ b/application/Thumbnailer.php @@ -3,9 +3,9 @@ namespace Shaarli; use Shaarli\Config\ConfigManager; +use WebThumbnailer\Application\ConfigManager as WTConfigManager; use WebThumbnailer\Exception\WebThumbnailerException; use WebThumbnailer\WebThumbnailer; -use WebThumbnailer\Application\ConfigManager as WTConfigManager; /** * Class Thumbnailer diff --git a/application/api/ApiMiddleware.php b/application/api/ApiMiddleware.php index a2101f2..5ffb8c6 100644 --- a/application/api/ApiMiddleware.php +++ b/application/api/ApiMiddleware.php @@ -1,9 +1,8 @@ container = new Container(); $this->container['conf'] = $this->conf; $this->container['db'] = true; - $this->container['history'] = new \Shaarli\History(self::$testHistory); + $this->container['history'] = new History(self::$testHistory); - $this->controller = new History($this->container); + $this->controller = new HistoryController($this->container); } /** @@ -78,35 +78,35 @@ class HistoryTest extends \PHPUnit_Framework_TestCase $this->assertEquals($this->refHistory->count(), count($data)); - $this->assertEquals(\Shaarli\History::DELETED, $data[0]['event']); + $this->assertEquals(History::DELETED, $data[0]['event']); $this->assertEquals( \DateTime::createFromFormat('Ymd_His', '20170303_121216')->format(\DateTime::ATOM), $data[0]['datetime'] ); $this->assertEquals(124, $data[0]['id']); - $this->assertEquals(\Shaarli\History::SETTINGS, $data[1]['event']); + $this->assertEquals(History::SETTINGS, $data[1]['event']); $this->assertEquals( \DateTime::createFromFormat('Ymd_His', '20170302_121215')->format(\DateTime::ATOM), $data[1]['datetime'] ); $this->assertNull($data[1]['id']); - $this->assertEquals(\Shaarli\History::UPDATED, $data[2]['event']); + $this->assertEquals(History::UPDATED, $data[2]['event']); $this->assertEquals( \DateTime::createFromFormat('Ymd_His', '20170301_121214')->format(\DateTime::ATOM), $data[2]['datetime'] ); $this->assertEquals(123, $data[2]['id']); - $this->assertEquals(\Shaarli\History::CREATED, $data[3]['event']); + $this->assertEquals(History::CREATED, $data[3]['event']); $this->assertEquals( \DateTime::createFromFormat('Ymd_His', '20170201_121214')->format(\DateTime::ATOM), $data[3]['datetime'] ); $this->assertEquals(124, $data[3]['id']); - $this->assertEquals(\Shaarli\History::CREATED, $data[4]['event']); + $this->assertEquals(History::CREATED, $data[4]['event']); $this->assertEquals( \DateTime::createFromFormat('Ymd_His', '20170101_121212')->format(\DateTime::ATOM), $data[4]['datetime'] @@ -131,7 +131,7 @@ class HistoryTest extends \PHPUnit_Framework_TestCase $this->assertEquals(1, count($data)); - $this->assertEquals(\Shaarli\History::DELETED, $data[0]['event']); + $this->assertEquals(History::DELETED, $data[0]['event']); $this->assertEquals( \DateTime::createFromFormat('Ymd_His', '20170303_121216')->format(\DateTime::ATOM), $data[0]['datetime'] @@ -156,7 +156,7 @@ class HistoryTest extends \PHPUnit_Framework_TestCase $this->assertEquals(1, count($data)); - $this->assertEquals(\Shaarli\History::CREATED, $data[0]['event']); + $this->assertEquals(History::CREATED, $data[0]['event']); $this->assertEquals( \DateTime::createFromFormat('Ymd_His', '20170101_121212')->format(\DateTime::ATOM), $data[0]['datetime'] @@ -181,7 +181,7 @@ class HistoryTest extends \PHPUnit_Framework_TestCase $this->assertEquals(1, count($data)); - $this->assertEquals(\Shaarli\History::DELETED, $data[0]['event']); + $this->assertEquals(History::DELETED, $data[0]['event']); $this->assertEquals( \DateTime::createFromFormat('Ymd_His', '20170303_121216')->format(\DateTime::ATOM), $data[0]['datetime'] @@ -206,7 +206,7 @@ class HistoryTest extends \PHPUnit_Framework_TestCase $this->assertEquals(1, count($data)); - $this->assertEquals(\Shaarli\History::SETTINGS, $data[0]['event']); + $this->assertEquals(History::SETTINGS, $data[0]['event']); $this->assertEquals( \DateTime::createFromFormat('Ymd_His', '20170302_121215')->format(\DateTime::ATOM), $data[0]['datetime'] diff --git a/tests/api/controllers/info/InfoTest.php b/tests/api/controllers/info/InfoTest.php index 44a9382..e70d371 100644 --- a/tests/api/controllers/info/InfoTest.php +++ b/tests/api/controllers/info/InfoTest.php @@ -2,7 +2,6 @@ namespace Shaarli\Api\Controllers; use Shaarli\Config\ConfigManager; - use Slim\Container; use Slim\Http\Environment; use Slim\Http\Request; @@ -15,7 +14,7 @@ use Slim\Http\Response; * * @package Api\Controllers */ -class InfoTest extends \PHPUnit_Framework_TestCase +class InfoTest extends \PHPUnit\Framework\TestCase { /** * @var string datastore to test write operations diff --git a/tests/api/controllers/links/DeleteLinkTest.php b/tests/api/controllers/links/DeleteLinkTest.php index adca9a4..90193e2 100644 --- a/tests/api/controllers/links/DeleteLinkTest.php +++ b/tests/api/controllers/links/DeleteLinkTest.php @@ -3,13 +3,15 @@ namespace Shaarli\Api\Controllers; +use Shaarli\Bookmark\LinkDB; use Shaarli\Config\ConfigManager; +use Shaarli\History; use Slim\Container; use Slim\Http\Environment; use Slim\Http\Request; use Slim\Http\Response; -class DeleteLinkTest extends \PHPUnit_Framework_TestCase +class DeleteLinkTest extends \PHPUnit\Framework\TestCase { /** * @var string datastore to test write operations @@ -32,12 +34,12 @@ class DeleteLinkTest extends \PHPUnit_Framework_TestCase protected $refDB = null; /** - * @var \Shaarli\Bookmark\LinkDB instance. + * @var LinkDB instance. */ protected $linkDB; /** - * @var \Shaarli\History instance. + * @var HistoryController instance. */ protected $history; @@ -59,10 +61,10 @@ class DeleteLinkTest extends \PHPUnit_Framework_TestCase $this->conf = new ConfigManager('tests/utils/config/configJson'); $this->refDB = new \ReferenceLinkDB(); $this->refDB->write(self::$testDatastore); - $this->linkDB = new \Shaarli\Bookmark\LinkDB(self::$testDatastore, true, false); + $this->linkDB = new LinkDB(self::$testDatastore, true, false); $refHistory = new \ReferenceHistory(); $refHistory->write(self::$testHistory); - $this->history = new \Shaarli\History(self::$testHistory); + $this->history = new History(self::$testHistory); $this->container = new Container(); $this->container['conf'] = $this->conf; $this->container['db'] = $this->linkDB; @@ -96,11 +98,11 @@ class DeleteLinkTest extends \PHPUnit_Framework_TestCase $this->assertEquals(204, $response->getStatusCode()); $this->assertEmpty((string) $response->getBody()); - $this->linkDB = new \Shaarli\Bookmark\LinkDB(self::$testDatastore, true, false); + $this->linkDB = new LinkDB(self::$testDatastore, true, false); $this->assertFalse(isset($this->linkDB[$id])); $historyEntry = $this->history->getHistory()[0]; - $this->assertEquals(\Shaarli\History::DELETED, $historyEntry['event']); + $this->assertEquals(History::DELETED, $historyEntry['event']); $this->assertTrue( (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime'] ); @@ -110,7 +112,7 @@ class DeleteLinkTest extends \PHPUnit_Framework_TestCase /** * Test DELETE link endpoint: reach not existing ID. * - * @expectedException Shaarli\Api\Exceptions\ApiLinkNotFoundException + * @expectedException \Shaarli\Api\Exceptions\ApiLinkNotFoundException */ public function testDeleteLink404() { diff --git a/tests/api/controllers/links/GetLinkIdTest.php b/tests/api/controllers/links/GetLinkIdTest.php index bf58000..cb9b7f6 100644 --- a/tests/api/controllers/links/GetLinkIdTest.php +++ b/tests/api/controllers/links/GetLinkIdTest.php @@ -3,7 +3,6 @@ namespace Shaarli\Api\Controllers; use Shaarli\Config\ConfigManager; - use Slim\Container; use Slim\Http\Environment; use Slim\Http\Request; @@ -18,7 +17,7 @@ use Slim\Http\Response; * * @package Shaarli\Api\Controllers */ -class GetLinkIdTest extends \PHPUnit_Framework_TestCase +class GetLinkIdTest extends \PHPUnit\Framework\TestCase { /** * @var string datastore to test write operations diff --git a/tests/api/controllers/links/GetLinksTest.php b/tests/api/controllers/links/GetLinksTest.php index 1008d7b..711a315 100644 --- a/tests/api/controllers/links/GetLinksTest.php +++ b/tests/api/controllers/links/GetLinksTest.php @@ -1,8 +1,8 @@ container = new Container(); $this->container['conf'] = $this->conf; - $this->container['db'] = new \Shaarli\Bookmark\LinkDB(self::$testDatastore, true, false); + $this->container['db'] = new LinkDB(self::$testDatastore, true, false); $this->container['history'] = null; $this->controller = new Links($this->container); @@ -114,7 +114,7 @@ class GetLinksTest extends \PHPUnit_Framework_TestCase $this->assertEquals('sTuff', $first['tags'][0]); $this->assertEquals(false, $first['private']); $this->assertEquals( - \DateTime::createFromFormat(\Shaarli\Bookmark\LinkDB::LINK_DATE_FORMAT, '20150310_114651')->format(\DateTime::ATOM), + \DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20150310_114651')->format(\DateTime::ATOM), $first['created'] ); $this->assertEmpty($first['updated']); @@ -125,7 +125,7 @@ class GetLinksTest extends \PHPUnit_Framework_TestCase // Update date $this->assertEquals( - \DateTime::createFromFormat(\Shaarli\Bookmark\LinkDB::LINK_DATE_FORMAT, '20160803_093033')->format(\DateTime::ATOM), + \DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20160803_093033')->format(\DateTime::ATOM), $link['updated'] ); } diff --git a/tests/api/controllers/links/PostLinkTest.php b/tests/api/controllers/links/PostLinkTest.php index 24e591d..d683a98 100644 --- a/tests/api/controllers/links/PostLinkTest.php +++ b/tests/api/controllers/links/PostLinkTest.php @@ -4,6 +4,7 @@ namespace Shaarli\Api\Controllers; use PHPUnit\Framework\TestCase; use Shaarli\Config\ConfigManager; +use Shaarli\History; use Slim\Container; use Slim\Http\Environment; use Slim\Http\Request; @@ -40,7 +41,7 @@ class PostLinkTest extends TestCase protected $refDB = null; /** - * @var \Shaarli\History instance. + * @var HistoryController instance. */ protected $history; @@ -70,12 +71,12 @@ class PostLinkTest extends TestCase $refHistory = new \ReferenceHistory(); $refHistory->write(self::$testHistory); - $this->history = new \Shaarli\History(self::$testHistory); + $this->history = new History(self::$testHistory); $this->container = new Container(); $this->container['conf'] = $this->conf; $this->container['db'] = new \Shaarli\Bookmark\LinkDB(self::$testDatastore, true, false); - $this->container['history'] = new \Shaarli\History(self::$testHistory); + $this->container['history'] = new History(self::$testHistory); $this->controller = new Links($this->container); @@ -133,7 +134,7 @@ class PostLinkTest extends TestCase $this->assertEquals('', $data['updated']); $historyEntry = $this->history->getHistory()[0]; - $this->assertEquals(\Shaarli\History::CREATED, $historyEntry['event']); + $this->assertEquals(History::CREATED, $historyEntry['event']); $this->assertTrue( (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime'] ); diff --git a/tests/api/controllers/links/PutLinkTest.php b/tests/api/controllers/links/PutLinkTest.php index eb6c795..cd815b6 100644 --- a/tests/api/controllers/links/PutLinkTest.php +++ b/tests/api/controllers/links/PutLinkTest.php @@ -4,12 +4,13 @@ namespace Shaarli\Api\Controllers; use Shaarli\Config\ConfigManager; +use Shaarli\History; use Slim\Container; use Slim\Http\Environment; use Slim\Http\Request; use Slim\Http\Response; -class PutLinkTest extends \PHPUnit_Framework_TestCase +class PutLinkTest extends \PHPUnit\Framework\TestCase { /** * @var string datastore to test write operations @@ -32,7 +33,7 @@ class PutLinkTest extends \PHPUnit_Framework_TestCase protected $refDB = null; /** - * @var \Shaarli\History instance. + * @var HistoryController instance. */ protected $history; @@ -62,12 +63,12 @@ class PutLinkTest extends \PHPUnit_Framework_TestCase $refHistory = new \ReferenceHistory(); $refHistory->write(self::$testHistory); - $this->history = new \Shaarli\History(self::$testHistory); + $this->history = new History(self::$testHistory); $this->container = new Container(); $this->container['conf'] = $this->conf; $this->container['db'] = new \Shaarli\Bookmark\LinkDB(self::$testDatastore, true, false); - $this->container['history'] = new \Shaarli\History(self::$testHistory); + $this->container['history'] = new History(self::$testHistory); $this->controller = new Links($this->container); @@ -119,7 +120,7 @@ class PutLinkTest extends \PHPUnit_Framework_TestCase ); $historyEntry = $this->history->getHistory()[0]; - $this->assertEquals(\Shaarli\History::UPDATED, $historyEntry['event']); + $this->assertEquals(History::UPDATED, $historyEntry['event']); $this->assertTrue( (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime'] ); diff --git a/tests/api/controllers/tags/DeleteTagTest.php b/tests/api/controllers/tags/DeleteTagTest.php index 02803ba..84e1d56 100644 --- a/tests/api/controllers/tags/DeleteTagTest.php +++ b/tests/api/controllers/tags/DeleteTagTest.php @@ -3,13 +3,15 @@ namespace Shaarli\Api\Controllers; +use Shaarli\Bookmark\LinkDB; use Shaarli\Config\ConfigManager; +use Shaarli\History; use Slim\Container; use Slim\Http\Environment; use Slim\Http\Request; use Slim\Http\Response; -class DeleteTagTest extends \PHPUnit_Framework_TestCase +class DeleteTagTest extends \PHPUnit\Framework\TestCase { /** * @var string datastore to test write operations @@ -32,12 +34,12 @@ class DeleteTagTest extends \PHPUnit_Framework_TestCase protected $refDB = null; /** - * @var \Shaarli\Bookmark\LinkDB instance. + * @var LinkDB instance. */ protected $linkDB; /** - * @var \Shaarli\History instance. + * @var HistoryController instance. */ protected $history; @@ -59,10 +61,10 @@ class DeleteTagTest extends \PHPUnit_Framework_TestCase $this->conf = new ConfigManager('tests/utils/config/configJson'); $this->refDB = new \ReferenceLinkDB(); $this->refDB->write(self::$testDatastore); - $this->linkDB = new \Shaarli\Bookmark\LinkDB(self::$testDatastore, true, false); + $this->linkDB = new LinkDB(self::$testDatastore, true, false); $refHistory = new \ReferenceHistory(); $refHistory->write(self::$testHistory); - $this->history = new \Shaarli\History(self::$testHistory); + $this->history = new History(self::$testHistory); $this->container = new Container(); $this->container['conf'] = $this->conf; $this->container['db'] = $this->linkDB; @@ -97,18 +99,18 @@ class DeleteTagTest extends \PHPUnit_Framework_TestCase $this->assertEquals(204, $response->getStatusCode()); $this->assertEmpty((string) $response->getBody()); - $this->linkDB = new \Shaarli\Bookmark\LinkDB(self::$testDatastore, true, false); + $this->linkDB = new LinkDB(self::$testDatastore, true, false); $tags = $this->linkDB->linksCountPerTag(); $this->assertFalse(isset($tags[$tagName])); // 2 links affected $historyEntry = $this->history->getHistory()[0]; - $this->assertEquals(\Shaarli\History::UPDATED, $historyEntry['event']); + $this->assertEquals(History::UPDATED, $historyEntry['event']); $this->assertTrue( (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime'] ); $historyEntry = $this->history->getHistory()[1]; - $this->assertEquals(\Shaarli\History::UPDATED, $historyEntry['event']); + $this->assertEquals(History::UPDATED, $historyEntry['event']); $this->assertTrue( (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime'] ); @@ -131,13 +133,13 @@ class DeleteTagTest extends \PHPUnit_Framework_TestCase $this->assertEquals(204, $response->getStatusCode()); $this->assertEmpty((string) $response->getBody()); - $this->linkDB = new \Shaarli\Bookmark\LinkDB(self::$testDatastore, true, false); + $this->linkDB = new LinkDB(self::$testDatastore, true, false); $tags = $this->linkDB->linksCountPerTag(); $this->assertFalse(isset($tags[$tagName])); $this->assertTrue($tags[strtolower($tagName)] > 0); $historyEntry = $this->history->getHistory()[0]; - $this->assertEquals(\Shaarli\History::UPDATED, $historyEntry['event']); + $this->assertEquals(History::UPDATED, $historyEntry['event']); $this->assertTrue( (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime'] ); diff --git a/tests/api/controllers/tags/GetTagNameTest.php b/tests/api/controllers/tags/GetTagNameTest.php index 8e0fecc..a2525c1 100644 --- a/tests/api/controllers/tags/GetTagNameTest.php +++ b/tests/api/controllers/tags/GetTagNameTest.php @@ -2,8 +2,8 @@ namespace Shaarli\Api\Controllers; +use Shaarli\Bookmark\LinkDB; use Shaarli\Config\ConfigManager; - use Slim\Container; use Slim\Http\Environment; use Slim\Http\Request; @@ -16,7 +16,7 @@ use Slim\Http\Response; * * @package Shaarli\Api\Controllers */ -class GetTagNameTest extends \PHPUnit_Framework_TestCase +class GetTagNameTest extends \PHPUnit\Framework\TestCase { /** * @var string datastore to test write operations @@ -59,7 +59,7 @@ class GetTagNameTest extends \PHPUnit_Framework_TestCase $this->container = new Container(); $this->container['conf'] = $this->conf; - $this->container['db'] = new \Shaarli\Bookmark\LinkDB(self::$testDatastore, true, false); + $this->container['db'] = new LinkDB(self::$testDatastore, true, false); $this->container['history'] = null; $this->controller = new Tags($this->container); diff --git a/tests/api/controllers/tags/GetTagsTest.php b/tests/api/controllers/tags/GetTagsTest.php index f071bfa..98628c9 100644 --- a/tests/api/controllers/tags/GetTagsTest.php +++ b/tests/api/controllers/tags/GetTagsTest.php @@ -1,8 +1,8 @@ container = new Container(); $this->container['conf'] = $this->conf; - $this->linkDB = new \Shaarli\Bookmark\LinkDB(self::$testDatastore, true, false); + $this->linkDB = new LinkDB(self::$testDatastore, true, false); $this->container['db'] = $this->linkDB; $this->container['history'] = null; diff --git a/tests/api/controllers/tags/PutTagTest.php b/tests/api/controllers/tags/PutTagTest.php index d8c0fec..86106fc 100644 --- a/tests/api/controllers/tags/PutTagTest.php +++ b/tests/api/controllers/tags/PutTagTest.php @@ -1,16 +1,17 @@ write(self::$testHistory); - $this->history = new \Shaarli\History(self::$testHistory); + $this->history = new History(self::$testHistory); $this->container = new Container(); $this->container['conf'] = $this->conf; - $this->linkDB = new \Shaarli\Bookmark\LinkDB(self::$testDatastore, true, false); + $this->linkDB = new LinkDB(self::$testDatastore, true, false); $this->container['db'] = $this->linkDB; $this->container['history'] = $this->history; @@ -113,12 +114,12 @@ class PutTagTest extends \PHPUnit_Framework_TestCase $this->assertEquals(2, $tags[$newName]); $historyEntry = $this->history->getHistory()[0]; - $this->assertEquals(\Shaarli\History::UPDATED, $historyEntry['event']); + $this->assertEquals(History::UPDATED, $historyEntry['event']); $this->assertTrue( (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime'] ); $historyEntry = $this->history->getHistory()[1]; - $this->assertEquals(\Shaarli\History::UPDATED, $historyEntry['event']); + $this->assertEquals(History::UPDATED, $historyEntry['event']); $this->assertTrue( (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime'] ); diff --git a/tests/bookmark/LinkDBTest.php b/tests/bookmark/LinkDBTest.php index 65409e9..ff5c0b9 100644 --- a/tests/bookmark/LinkDBTest.php +++ b/tests/bookmark/LinkDBTest.php @@ -6,7 +6,6 @@ namespace Shaarli\Bookmark; use DateTime; -use Shaarli\Bookmark\Exception\LinkNotFoundException; use ReferenceLinkDB; use ReflectionClass; use Shaarli; diff --git a/tests/config/ConfigJsonTest.php b/tests/config/ConfigJsonTest.php index 99c1ea5..95ad060 100644 --- a/tests/config/ConfigJsonTest.php +++ b/tests/config/ConfigJsonTest.php @@ -4,7 +4,7 @@ namespace Shaarli\Config; /** * Class ConfigJsonTest */ -class ConfigJsonTest extends \PHPUnit_Framework_TestCase +class ConfigJsonTest extends \PHPUnit\Framework\TestCase { /** * @var ConfigJson diff --git a/tests/config/ConfigManagerTest.php b/tests/config/ConfigManagerTest.php index 4a4e94a..33830bc 100644 --- a/tests/config/ConfigManagerTest.php +++ b/tests/config/ConfigManagerTest.php @@ -7,7 +7,7 @@ namespace Shaarli\Config; * Note: it only test the manager with ConfigJson, * ConfigPhp is only a workaround to handle the transition to JSON type. */ -class ConfigManagerTest extends \PHPUnit_Framework_TestCase +class ConfigManagerTest extends \PHPUnit\Framework\TestCase { /** * @var ConfigManager diff --git a/tests/config/ConfigPhpTest.php b/tests/config/ConfigPhpTest.php index be23eea..67d878c 100644 --- a/tests/config/ConfigPhpTest.php +++ b/tests/config/ConfigPhpTest.php @@ -4,7 +4,7 @@ namespace Shaarli\Config; /** * Class ConfigPhpTest */ -class ConfigPhpTest extends \PHPUnit_Framework_TestCase +class ConfigPhpTest extends \PHPUnit\Framework\TestCase { /** * @var ConfigPhp diff --git a/tests/config/ConfigPluginTest.php b/tests/config/ConfigPluginTest.php index deb02c9..d7a70e6 100644 --- a/tests/config/ConfigPluginTest.php +++ b/tests/config/ConfigPluginTest.php @@ -8,7 +8,7 @@ require_once 'application/config/ConfigPlugin.php'; /** * Unitary tests for Shaarli config related functions */ -class ConfigPluginTest extends \PHPUnit_Framework_TestCase +class ConfigPluginTest extends \PHPUnit\Framework\TestCase { /** * Test save_plugin_config with valid data. diff --git a/tests/feed/FeedBuilderTest.php b/tests/feed/FeedBuilderTest.php index 88d1c3e..b496cb4 100644 --- a/tests/feed/FeedBuilderTest.php +++ b/tests/feed/FeedBuilderTest.php @@ -3,8 +3,8 @@ namespace Shaarli\Feed; use DateTime; -use Shaarli\Bookmark\LinkDB; use ReferenceLinkDB; +use Shaarli\Bookmark\LinkDB; /** * FeedBuilderTest class. diff --git a/tests/languages/fr/LanguagesFrTest.php b/tests/languages/fr/LanguagesFrTest.php index 38347de..b8b7ca3 100644 --- a/tests/languages/fr/LanguagesFrTest.php +++ b/tests/languages/fr/LanguagesFrTest.php @@ -12,7 +12,7 @@ use Shaarli\Config\ConfigManager; * * @package Shaarli */ -class LanguagesFrTest extends \PHPUnit_Framework_TestCase +class LanguagesFrTest extends \PHPUnit\Framework\TestCase { /** * @var string Config file path (without extension). diff --git a/tests/plugins/WallabagInstanceTest.php b/tests/plugins/WallabagInstanceTest.php index bcc0160..a3cd907 100644 --- a/tests/plugins/WallabagInstanceTest.php +++ b/tests/plugins/WallabagInstanceTest.php @@ -1,8 +1,6 @@ Date: Fri, 18 Jan 2019 21:35:11 +0100 Subject: [PATCH 23/75] composer: enforce PHP security advisories This adds roave/security-advisories to prevent installing PHP packages with known vulnerabilities with Composer. See: - https://github.com/FriendsOfPHP/security-advisories - https://github.com/Roave/SecurityAdvisories Signed-off-by: VirtualTam --- composer.json | 1 + composer.lock | 219 ++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 213 insertions(+), 7 deletions(-) diff --git a/composer.json b/composer.json index a52b5f7..c23b825 100644 --- a/composer.json +++ b/composer.json @@ -26,6 +26,7 @@ "gettext/gettext": "^4.4" }, "require-dev": { + "roave/security-advisories": "dev-master", "phpunit/phpcov": "*", "phpunit/phpunit": "^5.0", "squizlabs/php_codesniffer": "2.*" diff --git a/composer.lock b/composer.lock index 53fb217..5cbcbc4 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "f8965821c946c2a1271c3f8c7e8c6eea", + "content-hash": "432005c9db3e890f42fde27036d2a70f", "packages": [ { "name": "arthurhoaro/web-thumbnailer", @@ -689,16 +689,16 @@ }, { "name": "slim/slim", - "version": "3.11.0", + "version": "3.12.0", "source": { "type": "git", "url": "https://github.com/slimphp/Slim.git", - "reference": "d378e70431e78ee92ee32ddde61ecc72edf5dc0a" + "reference": "f4947cc900b6e51cbfda58b9f1247bca2f76f9f0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/slimphp/Slim/zipball/d378e70431e78ee92ee32ddde61ecc72edf5dc0a", - "reference": "d378e70431e78ee92ee32ddde61ecc72edf5dc0a", + "url": "https://api.github.com/repos/slimphp/Slim/zipball/f4947cc900b6e51cbfda58b9f1247bca2f76f9f0", + "reference": "f4947cc900b6e51cbfda58b9f1247bca2f76f9f0", "shasum": "" }, "require": { @@ -756,7 +756,7 @@ "micro", "router" ], - "time": "2018-09-16T10:54:21+00:00" + "time": "2019-01-15T13:21:25+00:00" } ], "packages-dev": [ @@ -1469,6 +1469,210 @@ ], "time": "2017-06-30T09:13:00+00:00" }, + { + "name": "roave/security-advisories", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/Roave/SecurityAdvisories.git", + "reference": "d155baccb43ba2542941fbcba258b85ce7786419" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/d155baccb43ba2542941fbcba258b85ce7786419", + "reference": "d155baccb43ba2542941fbcba258b85ce7786419", + "shasum": "" + }, + "conflict": { + "3f/pygmentize": "<1.2", + "adodb/adodb-php": "<5.20.12", + "alterphp/easyadmin-extension-bundle": ">=1.2,<1.2.11|>=1.3,<1.3.1", + "amphp/artax": "<1.0.6|>=2,<2.0.6", + "amphp/http": "<1.0.1", + "api-platform/core": ">=2.2,<2.2.10|>=2.3,<2.3.6", + "asymmetricrypt/asymmetricrypt": ">=0,<9.9.99", + "aws/aws-sdk-php": ">=3,<3.2.1", + "brightlocal/phpwhois": "<=4.2.5", + "bugsnag/bugsnag-laravel": ">=2,<2.0.2", + "cakephp/cakephp": ">=1.3,<1.3.18|>=2,<2.4.99|>=2.5,<2.5.99|>=2.6,<2.6.12|>=2.7,<2.7.6|>=3,<3.0.15|>=3.1,<3.1.4|>=3.4,<3.4.14|>=3.5,<3.5.17|>=3.6,<3.6.4", + "cart2quote/module-quotation": ">=4.1.6,<=4.4.5|>=5,<5.4.4", + "cartalyst/sentry": "<=2.1.6", + "codeigniter/framework": "<=3.0.6", + "composer/composer": "<=1.0.0-alpha11", + "contao-components/mediaelement": ">=2.14.2,<2.21.1", + "contao/core": ">=2,<3.5.35", + "contao/core-bundle": ">=4,<4.4.18|>=4.5,<4.5.8", + "contao/listing-bundle": ">=4,<4.4.8", + "contao/newsletter-bundle": ">=4,<4.1", + "david-garcia/phpwhois": "<=4.3.1", + "doctrine/annotations": ">=1,<1.2.7", + "doctrine/cache": ">=1,<1.3.2|>=1.4,<1.4.2", + "doctrine/common": ">=2,<2.4.3|>=2.5,<2.5.1", + "doctrine/dbal": ">=2,<2.0.8|>=2.1,<2.1.2", + "doctrine/doctrine-bundle": "<1.5.2", + "doctrine/doctrine-module": "<=0.7.1", + "doctrine/mongodb-odm": ">=1,<1.0.2", + "doctrine/mongodb-odm-bundle": ">=2,<3.0.1", + "doctrine/orm": ">=2,<2.4.8|>=2.5,<2.5.1", + "dompdf/dompdf": ">=0.6,<0.6.2", + "drupal/core": ">=7,<7.60|>=8,<8.5.8|>=8.6,<8.6.2", + "drupal/drupal": ">=7,<7.60|>=8,<8.5.8|>=8.6,<8.6.2", + "erusev/parsedown": "<1.7", + "ezsystems/ezpublish-kernel": ">=5.3,<5.3.12.1|>=5.4,<5.4.13.1|>=6,<6.7.9.1|>=6.8,<6.13.5.1|>=7,<7.2.4.1|>=7.3,<7.3.2.1", + "ezsystems/ezpublish-legacy": ">=5.3,<5.3.12.6|>=5.4,<5.4.12.3|>=2011,<2017.12.4.3|>=2018.6,<2018.6.1.4|>=2018.9,<2018.9.1.3", + "ezsystems/repository-forms": ">=2.3,<2.3.2.1", + "ezyang/htmlpurifier": "<4.1.1", + "firebase/php-jwt": "<2", + "fooman/tcpdf": "<6.2.22", + "fossar/tcpdf-parser": "<6.2.22", + "friendsofsymfony/rest-bundle": ">=1.2,<1.2.2", + "friendsofsymfony/user-bundle": ">=1.2,<1.3.5", + "fuel/core": "<1.8.1", + "gree/jose": "<=2.2", + "gregwar/rst": "<1.0.3", + "guzzlehttp/guzzle": ">=6,<6.2.1|>=4.0.0-rc2,<4.2.4|>=5,<5.3.1", + "illuminate/auth": ">=4,<4.0.99|>=4.1,<=4.1.31|>=4.2,<=4.2.22|>=5,<=5.0.35|>=5.1,<=5.1.46|>=5.2,<=5.2.45|>=5.3,<=5.3.31|>=5.4,<=5.4.36|>=5.5,<5.5.10", + "illuminate/cookie": ">=4,<=4.0.11|>=4.1,<=4.1.31|>=4.2,<=4.2.22|>=5,<=5.0.35|>=5.1,<=5.1.46|>=5.2,<=5.2.45|>=5.3,<=5.3.31|>=5.4,<=5.4.36|>=5.5,<5.5.42|>=5.6,<5.6.30", + "illuminate/database": ">=4,<4.0.99|>=4.1,<4.1.29", + "illuminate/encryption": ">=4,<=4.0.11|>=4.1,<=4.1.31|>=4.2,<=4.2.22|>=5,<=5.0.35|>=5.1,<=5.1.46|>=5.2,<=5.2.45|>=5.3,<=5.3.31|>=5.4,<=5.4.36|>=5.5,<5.5.40|>=5.6,<5.6.15", + "ivankristianto/phpwhois": "<=4.3", + "james-heinrich/getid3": "<1.9.9", + "joomla/session": "<1.3.1", + "jsmitty12/phpwhois": "<5.1", + "kazist/phpwhois": "<=4.2.6", + "kreait/firebase-php": ">=3.2,<3.8.1", + "la-haute-societe/tcpdf": "<6.2.22", + "laravel/framework": ">=4,<4.0.99|>=4.1,<=4.1.31|>=4.2,<=4.2.22|>=5,<=5.0.35|>=5.1,<=5.1.46|>=5.2,<=5.2.45|>=5.3,<=5.3.31|>=5.4,<=5.4.36|>=5.5,<5.5.42|>=5.6,<5.6.30", + "laravel/socialite": ">=1,<1.0.99|>=2,<2.0.10", + "league/commonmark": ">=0.15.6,<0.18.1", + "magento/magento1ce": "<1.9.4", + "magento/magento1ee": ">=1.9,<1.14.4", + "magento/product-community-edition": ">=2,<2.2.7", + "monolog/monolog": ">=1.8,<1.12", + "namshi/jose": "<2.2", + "onelogin/php-saml": "<2.10.4", + "openid/php-openid": "<2.3", + "oro/crm": ">=1.7,<1.7.4", + "oro/platform": ">=1.7,<1.7.4", + "padraic/humbug_get_contents": "<1.1.2", + "pagarme/pagarme-php": ">=0,<3", + "paragonie/random_compat": "<2", + "paypal/merchant-sdk-php": "<3.12", + "pear/archive_tar": "<1.4.4", + "phpmailer/phpmailer": ">=5,<5.2.27|>=6,<6.0.6", + "phpoffice/phpexcel": "<=1.8.1", + "phpoffice/phpspreadsheet": "<=1.5", + "phpunit/phpunit": ">=4.8.19,<4.8.28|>=5.0.10,<5.6.3", + "phpwhois/phpwhois": "<=4.2.5", + "phpxmlrpc/extras": "<0.6.1", + "propel/propel": ">=2.0.0-alpha1,<=2.0.0-alpha7", + "propel/propel1": ">=1,<=1.7.1", + "pusher/pusher-php-server": "<2.2.1", + "robrichards/xmlseclibs": ">=1,<3.0.2", + "sabre/dav": ">=1.6,<1.6.99|>=1.7,<1.7.11|>=1.8,<1.8.9", + "sensiolabs/connect": "<4.2.3", + "serluck/phpwhois": "<=4.2.6", + "shopware/shopware": "<5.3.7", + "silverstripe/cms": ">=3,<=3.0.11|>=3.1,<3.1.11", + "silverstripe/forum": "<=0.6.1|>=0.7,<=0.7.3", + "silverstripe/framework": ">=3,<3.3", + "silverstripe/userforms": "<3", + "simple-updates/phpwhois": "<=1", + "simplesamlphp/saml2": "<1.10.6|>=2,<2.3.8|>=3,<3.1.4", + "simplesamlphp/simplesamlphp": "<1.16.3", + "simplesamlphp/simplesamlphp-module-infocard": "<1.0.1", + "slim/slim": "<2.6", + "smarty/smarty": "<3.1.33", + "socalnick/scn-social-auth": "<1.15.2", + "spoonity/tcpdf": "<6.2.22", + "squizlabs/php_codesniffer": ">=1,<2.8.1|>=3,<3.0.1", + "stormpath/sdk": ">=0,<9.9.99", + "swiftmailer/swiftmailer": ">=4,<5.4.5", + "sylius/admin-bundle": ">=1,<1.0.17|>=1.1,<1.1.9|>=1.2,<1.2.2", + "sylius/sylius": ">=1,<1.0.17|>=1.1,<1.1.9|>=1.2,<1.2.2", + "symfony/dependency-injection": ">=2,<2.0.17", + "symfony/form": ">=2.3,<2.3.35|>=2.4,<2.6.12|>=2.7,<2.7.50|>=2.8,<2.8.49|>=3,<3.4.20|>=4,<4.0.15|>=4.1,<4.1.9|>=4.2,<4.2.1", + "symfony/framework-bundle": ">=2,<2.3.18|>=2.4,<2.4.8|>=2.5,<2.5.2", + "symfony/http-foundation": ">=2,<2.7.49|>=2.8,<2.8.44|>=3,<3.3.18|>=3.4,<3.4.14|>=4,<4.0.14|>=4.1,<4.1.3", + "symfony/http-kernel": ">=2,<2.3.29|>=2.4,<2.5.12|>=2.6,<2.6.8", + "symfony/intl": ">=2.7,<2.7.38|>=2.8,<2.8.31|>=3,<3.2.14|>=3.3,<3.3.13", + "symfony/polyfill": ">=1,<1.10", + "symfony/polyfill-php55": ">=1,<1.10", + "symfony/routing": ">=2,<2.0.19", + "symfony/security": ">=2,<2.7.50|>=2.8,<2.8.49|>=3,<3.4.19|>=4,<4.0.15|>=4.1,<4.1.9|>=4.2,<4.2.1", + "symfony/security-bundle": ">=2,<2.7.48|>=2.8,<2.8.41|>=3,<3.3.17|>=3.4,<3.4.11|>=4,<4.0.11", + "symfony/security-core": ">=2.4,<2.6.13|>=2.7,<2.7.9|>=2.7.30,<2.7.32|>=2.8,<2.8.37|>=3,<3.3.17|>=3.4,<3.4.7|>=4,<4.0.7", + "symfony/security-csrf": ">=2.4,<2.7.48|>=2.8,<2.8.41|>=3,<3.3.17|>=3.4,<3.4.11|>=4,<4.0.11", + "symfony/security-guard": ">=2.8,<2.8.41|>=3,<3.3.17|>=3.4,<3.4.11|>=4,<4.0.11", + "symfony/security-http": ">=2.3,<2.3.41|>=2.4,<2.7.50|>=2.8,<2.8.49|>=3,<3.4.20|>=4,<4.0.15|>=4.1,<4.1.9|>=4.2,<4.2.1", + "symfony/serializer": ">=2,<2.0.11", + "symfony/symfony": ">=2,<2.7.50|>=2.8,<2.8.49|>=3,<3.4.20|>=4,<4.0.15|>=4.1,<4.1.9|>=4.2,<4.2.1", + "symfony/translation": ">=2,<2.0.17", + "symfony/validator": ">=2,<2.0.24|>=2.1,<2.1.12|>=2.2,<2.2.5|>=2.3,<2.3.3", + "symfony/web-profiler-bundle": ">=2,<2.3.19|>=2.4,<2.4.9|>=2.5,<2.5.4", + "symfony/yaml": ">=2,<2.0.22|>=2.1,<2.1.7", + "tecnickcom/tcpdf": "<6.2.22", + "thelia/backoffice-default-template": ">=2.1,<2.1.2", + "thelia/thelia": ">=2.1.0-beta1,<2.1.3|>=2.1,<2.1.2", + "theonedemon/phpwhois": "<=4.2.5", + "titon/framework": ">=0,<9.9.99", + "truckersmp/phpwhois": "<=4.3.1", + "twig/twig": "<1.20", + "typo3/cms": ">=6.2,<6.2.30|>=7,<7.6.32|>=8,<8.7.21|>=9,<9.5.2", + "typo3/cms-core": ">=8,<8.7.21|>=9,<9.5.2", + "typo3/flow": ">=1,<1.0.4|>=1.1,<1.1.1|>=2,<2.0.1|>=2.3,<2.3.16|>=3,<3.0.10|>=3.1,<3.1.7|>=3.2,<3.2.7|>=3.3,<3.3.5", + "typo3/neos": ">=1.1,<1.1.3|>=1.2,<1.2.13|>=2,<2.0.4", + "ua-parser/uap-php": "<3.8", + "wallabag/tcpdf": "<6.2.22", + "willdurand/js-translation-bundle": "<2.1.1", + "yiisoft/yii": ">=1.1.14,<1.1.15", + "yiisoft/yii2": "<2.0.15", + "yiisoft/yii2-bootstrap": "<2.0.4", + "yiisoft/yii2-dev": "<2.0.15", + "yiisoft/yii2-elasticsearch": "<2.0.5", + "yiisoft/yii2-gii": "<2.0.4", + "yiisoft/yii2-jui": "<2.0.4", + "yiisoft/yii2-redis": "<2.0.8", + "zendframework/zend-cache": ">=2.4,<2.4.8|>=2.5,<2.5.3", + "zendframework/zend-captcha": ">=2,<2.4.9|>=2.5,<2.5.2", + "zendframework/zend-crypt": ">=2,<2.4.9|>=2.5,<2.5.2", + "zendframework/zend-db": ">=2,<2.0.99|>=2.1,<2.1.99|>=2.2,<2.2.10|>=2.3,<2.3.5", + "zendframework/zend-diactoros": ">=1,<1.8.4", + "zendframework/zend-feed": ">=1,<2.10.3", + "zendframework/zend-form": ">=2,<2.2.7|>=2.3,<2.3.1", + "zendframework/zend-http": ">=1,<2.8.1", + "zendframework/zend-json": ">=2.1,<2.1.6|>=2.2,<2.2.6", + "zendframework/zend-ldap": ">=2,<2.0.99|>=2.1,<2.1.99|>=2.2,<2.2.8|>=2.3,<2.3.3", + "zendframework/zend-mail": ">=2,<2.4.11|>=2.5,<2.7.2", + "zendframework/zend-navigation": ">=2,<2.2.7|>=2.3,<2.3.1", + "zendframework/zend-session": ">=2,<2.0.99|>=2.1,<2.1.99|>=2.2,<2.2.9|>=2.3,<2.3.4", + "zendframework/zend-validator": ">=2.3,<2.3.6", + "zendframework/zend-view": ">=2,<2.2.7|>=2.3,<2.3.1", + "zendframework/zend-xmlrpc": ">=2.1,<2.1.6|>=2.2,<2.2.6", + "zendframework/zendframework": "<2.5.1", + "zendframework/zendframework1": "<1.12.20", + "zendframework/zendopenid": ">=2,<2.0.2", + "zendframework/zendxml": ">=1,<1.0.1", + "zetacomponents/mail": "<1.8.2", + "zf-commons/zfc-user": "<1.2.2", + "zfcampus/zf-apigility-doctrine": ">=1,<1.0.3", + "zfr/zfr-oauth2-server-module": "<0.1.2" + }, + "type": "metapackage", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "role": "maintainer" + } + ], + "description": "Prevents installation of composer packages with known security vulnerabilities: no API, simply require it", + "time": "2019-01-15T19:39:37+00:00" + }, { "name": "sebastian/code-unit-reverse-lookup", "version": "1.0.1", @@ -2544,7 +2748,8 @@ "aliases": [], "minimum-stability": "stable", "stability-flags": { - "pubsubhubbub/publisher": 20 + "pubsubhubbub/publisher": 20, + "roave/security-advisories": 20 }, "prefer-stable": false, "prefer-lowest": false, From 1c53591a43cfea0c7c7ca0ed4cd223cef842eaf3 Mon Sep 17 00:00:00 2001 From: VirtualTam Date: Fri, 18 Jan 2019 22:24:58 +0100 Subject: [PATCH 24/75] doc: add phpDocumentor configuration See: - https://phpdoc.org/ - https://docs.phpdoc.org/references/configuration.html - https://github.com/phpDocumentor/phpDocumentor2 Signed-off-by: VirtualTam --- .gitignore | 2 ++ phpdoc.dist.xml | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 phpdoc.dist.xml diff --git a/.gitignore b/.gitignore index 414ff6d..ce2ebe2 100644 --- a/.gitignore +++ b/.gitignore @@ -25,12 +25,14 @@ coverage doxygen sandbox phpmd.html +phpdoc.xml # User plugin configuration plugins/*/config.php # HTML documentation doc/html/ +doc/phpdoc/ # 3rd party themes tpl/* diff --git a/phpdoc.dist.xml b/phpdoc.dist.xml new file mode 100644 index 0000000..3878550 --- /dev/null +++ b/phpdoc.dist.xml @@ -0,0 +1,21 @@ + + + <![CDATA[Shaarli API Reference]]> + + utf8 + + FIXME + TODO + WIP + + doc/phpdoc + + + doc/phpdoc + + + index.php + application + plugins + + From 7be2a2d5f4078ba97b3281f2b5c33ae9bd337be5 Mon Sep 17 00:00:00 2001 From: VirtualTam Date: Fri, 18 Jan 2019 22:36:13 +0100 Subject: [PATCH 25/75] doc: add Make target to run phpDocumentor with Docker This target provides a convenient way for running phpDocumentor without cluttering the system's configuration with PHP extensions, nor the Composer dependencies. See: - https://hub.docker.com/r/phpdoc/phpdoc/dockerfile - https://github.com/phpDocumentor/phpDocumentor2#via-docker An alternative is to download the PHAR and run it locally: - https://docs.phpdoc.org/getting-started/installing.html#phar Signed-off-by: VirtualTam --- Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile b/Makefile index b758d1f..b13d056 100644 --- a/Makefile +++ b/Makefile @@ -151,6 +151,10 @@ doxygen: clean @rm -rf doxygen @doxygen Doxyfile +### generate phpDocumentor documentation +phpdoc: clean + @docker run --rm -v $(PWD):/data -u `id -u`:`id -g` phpdoc/phpdoc + ### generate HTML documentation from Markdown pages with MkDocs htmldoc: python3 -m venv venv/ From 9eb6055abb2643a9d666b0355cd6d6d67ee4e0ba Mon Sep 17 00:00:00 2001 From: VirtualTam Date: Fri, 18 Jan 2019 22:44:21 +0100 Subject: [PATCH 26/75] doc: remove Doxygen configuration Signed-off-by: VirtualTam --- .gitignore | 1 - Doxyfile | 2377 ---------------------------------------------------- Makefile | 5 - 3 files changed, 2383 deletions(-) delete mode 100644 Doxyfile diff --git a/.gitignore b/.gitignore index ce2ebe2..6208e79 100644 --- a/.gitignore +++ b/.gitignore @@ -22,7 +22,6 @@ inc/languages/*/LC_MESSAGES/shaarli.mo # Development and test resources coverage -doxygen sandbox phpmd.html phpdoc.xml diff --git a/Doxyfile b/Doxyfile deleted file mode 100644 index a7f6e04..0000000 --- a/Doxyfile +++ /dev/null @@ -1,2377 +0,0 @@ -# Doxyfile 1.8.9.1 - -# This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project. -# -# All text after a double hash (##) is considered a comment and is placed in -# front of the TAG it is preceding. -# -# All text after a single hash (#) is considered a comment and will be ignored. -# The format is: -# TAG = value [value, ...] -# For lists, items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (\" \"). - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- - -# This tag specifies the encoding used for all characters in the config file -# that follow. The default is UTF-8 which is also the encoding used for all text -# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv -# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv -# for the list of possible encodings. -# The default value is: UTF-8. - -DOXYFILE_ENCODING = UTF-8 - -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by -# double-quotes, unless you are using Doxywizard) that should identify the -# project for which the documentation is generated. This name is used in the -# title of most generated pages and in a few other places. -# The default value is: My Project. - -PROJECT_NAME = Shaarli - -# The PROJECT_NUMBER tag can be used to enter a project or revision number. This -# could be handy for archiving the generated documentation or if some version -# control system is used. - -PROJECT_NUMBER = - -# Using the PROJECT_BRIEF tag one can provide an optional one line description -# for a project that appears at the top of each page and should give viewer a -# quick idea about the purpose of the project. Keep the description short. - -PROJECT_BRIEF = "The personal, minimalist, super-fast, no-database delicious clone" - -# With the PROJECT_LOGO tag one can specify a logo or an icon that is included -# in the documentation. The maximum height of the logo should not exceed 55 -# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy -# the logo to the output directory. - -PROJECT_LOGO = doc/md/images/logo.png - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path -# into which the generated documentation will be written. If a relative path is -# entered, it will be relative to the location where doxygen was started. If -# left blank the current directory will be used. - -OUTPUT_DIRECTORY = . - -# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- -# directories (in 2 levels) under the output directory of each output format and -# will distribute the generated files over these directories. Enabling this -# option can be useful when feeding doxygen a huge amount of source files, where -# putting all generated files in the same directory would otherwise causes -# performance problems for the file system. -# The default value is: NO. - -CREATE_SUBDIRS = NO - -# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII -# characters to appear in the names of generated files. If set to NO, non-ASCII -# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode -# U+3044. -# The default value is: NO. - -ALLOW_UNICODE_NAMES = NO - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, -# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), -# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, -# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), -# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, -# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, -# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, -# Ukrainian and Vietnamese. -# The default value is: English. - -OUTPUT_LANGUAGE = English - -# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member -# descriptions after the members that are listed in the file and class -# documentation (similar to Javadoc). Set to NO to disable this. -# The default value is: YES. - -BRIEF_MEMBER_DESC = YES - -# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief -# description of a member or function before the detailed description -# -# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. -# The default value is: YES. - -REPEAT_BRIEF = YES - -# This tag implements a quasi-intelligent brief description abbreviator that is -# used to form the text in various listings. Each string in this list, if found -# as the leading text of the brief description, will be stripped from the text -# and the result, after processing the whole list, is used as the annotated -# text. Otherwise, the brief description is used as-is. If left blank, the -# following values are used ($name is automatically replaced with the name of -# the entity):The $name class, The $name widget, The $name file, is, provides, -# specifies, contains, represents, a, an and the. - -ABBREVIATE_BRIEF = "The $name class" \ - "The $name widget" \ - "The $name file" \ - is \ - provides \ - specifies \ - contains \ - represents \ - a \ - an \ - the - -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# doxygen will generate a detailed section even if there is only a brief -# description. -# The default value is: NO. - -ALWAYS_DETAILED_SEC = NO - -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all -# inherited members of a class in the documentation of that class as if those -# members were ordinary class members. Constructors, destructors and assignment -# operators of the base classes will not be shown. -# The default value is: NO. - -INLINE_INHERITED_MEMB = NO - -# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path -# before files name in the file list and in the header files. If set to NO the -# shortest path that makes the file name unique will be used -# The default value is: YES. - -FULL_PATH_NAMES = YES - -# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. -# Stripping is only done if one of the specified strings matches the left-hand -# part of the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the path to -# strip. -# -# Note that you can specify absolute paths here, but also relative paths, which -# will be relative from the directory where doxygen is started. -# This tag requires that the tag FULL_PATH_NAMES is set to YES. - -STRIP_FROM_PATH = - -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the -# path mentioned in the documentation of a class, which tells the reader which -# header file to include in order to use a class. If left blank only the name of -# the header file containing the class definition is used. Otherwise one should -# specify the list of include paths that are normally passed to the compiler -# using the -I flag. - -STRIP_FROM_INC_PATH = - -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but -# less readable) file names. This can be useful is your file systems doesn't -# support long names like on DOS, Mac, or CD-ROM. -# The default value is: NO. - -SHORT_NAMES = NO - -# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the -# first line (until the first dot) of a Javadoc-style comment as the brief -# description. If set to NO, the Javadoc-style will behave just like regular Qt- -# style comments (thus requiring an explicit @brief command for a brief -# description.) -# The default value is: NO. - -JAVADOC_AUTOBRIEF = NO - -# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first -# line (until the first dot) of a Qt-style comment as the brief description. If -# set to NO, the Qt-style will behave just like regular Qt-style comments (thus -# requiring an explicit \brief command for a brief description.) -# The default value is: NO. - -QT_AUTOBRIEF = NO - -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a -# multi-line C++ special comment block (i.e. a block of //! or /// comments) as -# a brief description. This used to be the default behavior. The new default is -# to treat a multi-line C++ comment block as a detailed description. Set this -# tag to YES if you prefer the old behavior instead. -# -# Note that setting this tag to YES also means that rational rose comments are -# not recognized any more. -# The default value is: NO. - -MULTILINE_CPP_IS_BRIEF = NO - -# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the -# documentation from any documented member that it re-implements. -# The default value is: YES. - -INHERIT_DOCS = YES - -# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new -# page for each member. If set to NO, the documentation of a member will be part -# of the file/class/namespace that contains it. -# The default value is: NO. - -SEPARATE_MEMBER_PAGES = NO - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen -# uses this value to replace tabs by spaces in code fragments. -# Minimum value: 1, maximum value: 16, default value: 4. - -TAB_SIZE = 4 - -# This tag can be used to specify a number of aliases that act as commands in -# the documentation. An alias has the form: -# name=value -# For example adding -# "sideeffect=@par Side Effects:\n" -# will allow you to put the command \sideeffect (or @sideeffect) in the -# documentation, which will result in a user-defined paragraph with heading -# "Side Effects:". You can put \n's in the value part of an alias to insert -# newlines. - -ALIASES = - -# This tag can be used to specify a number of word-keyword mappings (TCL only). -# A mapping has the form "name=value". For example adding "class=itcl::class" -# will allow you to use the command class in the itcl::class meaning. - -TCL_SUBST = - -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources -# only. Doxygen will then generate output that is more tailored for C. For -# instance, some of the names that are used will be different. The list of all -# members will be omitted, etc. -# The default value is: NO. - -OPTIMIZE_OUTPUT_FOR_C = YES - -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or -# Python sources only. Doxygen will then generate output that is more tailored -# for that language. For instance, namespaces will be presented as packages, -# qualified scopes will look different, etc. -# The default value is: NO. - -OPTIMIZE_OUTPUT_JAVA = NO - -# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran -# sources. Doxygen will then generate output that is tailored for Fortran. -# The default value is: NO. - -OPTIMIZE_FOR_FORTRAN = NO - -# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL -# sources. Doxygen will then generate output that is tailored for VHDL. -# The default value is: NO. - -OPTIMIZE_OUTPUT_VHDL = NO - -# Doxygen selects the parser to use depending on the extension of the files it -# parses. With this tag you can assign which parser to use for a given -# extension. Doxygen has a built-in mapping, but you can override or extend it -# using this tag. The format is ext=language, where ext is a file extension, and -# language is one of the parsers supported by doxygen: IDL, Java, Javascript, -# C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran: -# FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran: -# Fortran. In the later case the parser tries to guess whether the code is fixed -# or free formatted code, this is the default for Fortran type files), VHDL. For -# instance to make doxygen treat .inc files as Fortran files (default is PHP), -# and .f files as C (default is Fortran), use: inc=Fortran f=C. -# -# Note: For files without extension you can use no_extension as a placeholder. -# -# Note that for custom extensions you also need to set FILE_PATTERNS otherwise -# the files are not read by doxygen. - -EXTENSION_MAPPING = - -# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments -# according to the Markdown format, which allows for more readable -# documentation. See http://daringfireball.net/projects/markdown/ for details. -# The output of markdown processing is further processed by doxygen, so you can -# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in -# case of backward compatibilities issues. -# The default value is: YES. - -MARKDOWN_SUPPORT = YES - -# When enabled doxygen tries to link words that correspond to documented -# classes, or namespaces to their corresponding documentation. Such a link can -# be prevented in individual cases by putting a % sign in front of the word or -# globally by setting AUTOLINK_SUPPORT to NO. -# The default value is: YES. - -AUTOLINK_SUPPORT = YES - -# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want -# to include (a tag file for) the STL sources as input, then you should set this -# tag to YES in order to let doxygen match functions declarations and -# definitions whose arguments contain STL classes (e.g. func(std::string); -# versus func(std::string) {}). This also make the inheritance and collaboration -# diagrams that involve STL classes more complete and accurate. -# The default value is: NO. - -BUILTIN_STL_SUPPORT = NO - -# If you use Microsoft's C++/CLI language, you should set this option to YES to -# enable parsing support. -# The default value is: NO. - -CPP_CLI_SUPPORT = NO - -# Set the SIP_SUPPORT tag to YES if your project consists of sip (see: -# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen -# will parse them like normal C++ but will assume all classes use public instead -# of private inheritance when no explicit protection keyword is present. -# The default value is: NO. - -SIP_SUPPORT = NO - -# For Microsoft's IDL there are propget and propput attributes to indicate -# getter and setter methods for a property. Setting this option to YES will make -# doxygen to replace the get and set methods by a property in the documentation. -# This will only work if the methods are indeed getting or setting a simple -# type. If this is not the case, or you want to show the methods anyway, you -# should set this option to NO. -# The default value is: YES. - -IDL_PROPERTY_SUPPORT = YES - -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default -# all members of a group must be documented explicitly. -# The default value is: NO. - -DISTRIBUTE_GROUP_DOC = NO - -# Set the SUBGROUPING tag to YES to allow class member groups of the same type -# (for instance a group of public functions) to be put as a subgroup of that -# type (e.g. under the Public Functions section). Set it to NO to prevent -# subgrouping. Alternatively, this can be done per class using the -# \nosubgrouping command. -# The default value is: YES. - -SUBGROUPING = YES - -# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions -# are shown inside the group in which they are included (e.g. using \ingroup) -# instead of on a separate page (for HTML and Man pages) or section (for LaTeX -# and RTF). -# -# Note that this feature does not work in combination with -# SEPARATE_MEMBER_PAGES. -# The default value is: NO. - -INLINE_GROUPED_CLASSES = NO - -# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions -# with only public data fields or simple typedef fields will be shown inline in -# the documentation of the scope in which they are defined (i.e. file, -# namespace, or group documentation), provided this scope is documented. If set -# to NO, structs, classes, and unions are shown on a separate page (for HTML and -# Man pages) or section (for LaTeX and RTF). -# The default value is: NO. - -INLINE_SIMPLE_STRUCTS = NO - -# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or -# enum is documented as struct, union, or enum with the name of the typedef. So -# typedef struct TypeS {} TypeT, will appear in the documentation as a struct -# with name TypeT. When disabled the typedef will appear as a member of a file, -# namespace, or class. And the struct will be named TypeS. This can typically be -# useful for C code in case the coding convention dictates that all compound -# types are typedef'ed and only the typedef is referenced, never the tag name. -# The default value is: NO. - -TYPEDEF_HIDES_STRUCT = NO - -# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This -# cache is used to resolve symbols given their name and scope. Since this can be -# an expensive process and often the same symbol appears multiple times in the -# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small -# doxygen will become slower. If the cache is too large, memory is wasted. The -# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range -# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 -# symbols. At the end of a run doxygen will report the cache usage and suggest -# the optimal cache size from a speed point of view. -# Minimum value: 0, maximum value: 9, default value: 0. - -LOOKUP_CACHE_SIZE = 0 - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- - -# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in -# documentation are documented, even if no documentation was available. Private -# class members and static file members will be hidden unless the -# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. -# Note: This will also disable the warnings about undocumented members that are -# normally produced when WARNINGS is set to YES. -# The default value is: NO. - -EXTRACT_ALL = YES - -# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will -# be included in the documentation. -# The default value is: NO. - -EXTRACT_PRIVATE = YES - -# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal -# scope will be included in the documentation. -# The default value is: NO. - -EXTRACT_PACKAGE = YES - -# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be -# included in the documentation. -# The default value is: NO. - -EXTRACT_STATIC = YES - -# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined -# locally in source files will be included in the documentation. If set to NO, -# only classes defined in header files are included. Does not have any effect -# for Java sources. -# The default value is: YES. - -EXTRACT_LOCAL_CLASSES = YES - -# This flag is only useful for Objective-C code. If set to YES, local methods, -# which are defined in the implementation section but not in the interface are -# included in the documentation. If set to NO, only methods in the interface are -# included. -# The default value is: NO. - -EXTRACT_LOCAL_METHODS = YES - -# If this flag is set to YES, the members of anonymous namespaces will be -# extracted and appear in the documentation as a namespace called -# 'anonymous_namespace{file}', where file will be replaced with the base name of -# the file that contains the anonymous namespace. By default anonymous namespace -# are hidden. -# The default value is: NO. - -EXTRACT_ANON_NSPACES = YES - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all -# undocumented members inside documented classes or files. If set to NO these -# members will be included in the various overviews, but no documentation -# section is generated. This option has no effect if EXTRACT_ALL is enabled. -# The default value is: NO. - -HIDE_UNDOC_MEMBERS = NO - -# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. If set -# to NO, these classes will be included in the various overviews. This option -# has no effect if EXTRACT_ALL is enabled. -# The default value is: NO. - -HIDE_UNDOC_CLASSES = NO - -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend -# (class|struct|union) declarations. If set to NO, these declarations will be -# included in the documentation. -# The default value is: NO. - -HIDE_FRIEND_COMPOUNDS = NO - -# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any -# documentation blocks found inside the body of a function. If set to NO, these -# blocks will be appended to the function's detailed documentation block. -# The default value is: NO. - -HIDE_IN_BODY_DOCS = NO - -# The INTERNAL_DOCS tag determines if documentation that is typed after a -# \internal command is included. If the tag is set to NO then the documentation -# will be excluded. Set it to YES to include the internal documentation. -# The default value is: NO. - -INTERNAL_DOCS = NO - -# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file -# names in lower-case letters. If set to YES, upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. -# The default value is: system dependent. - -CASE_SENSE_NAMES = NO - -# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with -# their full class and namespace scopes in the documentation. If set to YES, the -# scope will be hidden. -# The default value is: NO. - -HIDE_SCOPE_NAMES = YES - -# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will -# append additional text to a page's title, such as Class Reference. If set to -# YES the compound reference will be hidden. -# The default value is: NO. - -HIDE_COMPOUND_REFERENCE= NO - -# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of -# the files that are included by a file in the documentation of that file. -# The default value is: YES. - -SHOW_INCLUDE_FILES = YES - -# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each -# grouped member an include statement to the documentation, telling the reader -# which file to include in order to use the member. -# The default value is: NO. - -SHOW_GROUPED_MEMB_INC = NO - -# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include -# files with double quotes in the documentation rather than with sharp brackets. -# The default value is: NO. - -FORCE_LOCAL_INCLUDES = NO - -# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the -# documentation for inline members. -# The default value is: YES. - -INLINE_INFO = YES - -# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the -# (detailed) documentation of file and class members alphabetically by member -# name. If set to NO, the members will appear in declaration order. -# The default value is: YES. - -SORT_MEMBER_DOCS = YES - -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief -# descriptions of file, namespace and class members alphabetically by member -# name. If set to NO, the members will appear in declaration order. Note that -# this will also influence the order of the classes in the class list. -# The default value is: NO. - -SORT_BRIEF_DOCS = NO - -# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the -# (brief and detailed) documentation of class members so that constructors and -# destructors are listed first. If set to NO the constructors will appear in the -# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. -# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief -# member documentation. -# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting -# detailed member documentation. -# The default value is: NO. - -SORT_MEMBERS_CTORS_1ST = NO - -# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy -# of group names into alphabetical order. If set to NO the group names will -# appear in their defined order. -# The default value is: NO. - -SORT_GROUP_NAMES = NO - -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by -# fully-qualified names, including namespaces. If set to NO, the class list will -# be sorted only by class name, not including the namespace part. -# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the alphabetical -# list. -# The default value is: NO. - -SORT_BY_SCOPE_NAME = NO - -# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper -# type resolution of all parameters of a function it will reject a match between -# the prototype and the implementation of a member function even if there is -# only one candidate or it is obvious which candidate to choose by doing a -# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still -# accept a match between prototype and implementation in such cases. -# The default value is: NO. - -STRICT_PROTO_MATCHING = NO - -# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo -# list. This list is created by putting \todo commands in the documentation. -# The default value is: YES. - -GENERATE_TODOLIST = YES - -# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test -# list. This list is created by putting \test commands in the documentation. -# The default value is: YES. - -GENERATE_TESTLIST = YES - -# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug -# list. This list is created by putting \bug commands in the documentation. -# The default value is: YES. - -GENERATE_BUGLIST = YES - -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO) -# the deprecated list. This list is created by putting \deprecated commands in -# the documentation. -# The default value is: YES. - -GENERATE_DEPRECATEDLIST= YES - -# The ENABLED_SECTIONS tag can be used to enable conditional documentation -# sections, marked by \if ... \endif and \cond -# ... \endcond blocks. - -ENABLED_SECTIONS = - -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the -# initial value of a variable or macro / define can have for it to appear in the -# documentation. If the initializer consists of more lines than specified here -# it will be hidden. Use a value of 0 to hide initializers completely. The -# appearance of the value of individual variables and macros / defines can be -# controlled using \showinitializer or \hideinitializer command in the -# documentation regardless of this setting. -# Minimum value: 0, maximum value: 10000, default value: 30. - -MAX_INITIALIZER_LINES = 30 - -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at -# the bottom of the documentation of classes and structs. If set to YES, the -# list will mention the files that were used to generate the documentation. -# The default value is: YES. - -SHOW_USED_FILES = YES - -# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This -# will remove the Files entry from the Quick Index and from the Folder Tree View -# (if specified). -# The default value is: YES. - -SHOW_FILES = YES - -# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces -# page. This will remove the Namespaces entry from the Quick Index and from the -# Folder Tree View (if specified). -# The default value is: YES. - -SHOW_NAMESPACES = NO - -# The FILE_VERSION_FILTER tag can be used to specify a program or script that -# doxygen should invoke to get the current version for each file (typically from -# the version control system). Doxygen will invoke the program by executing (via -# popen()) the command command input-file, where command is the value of the -# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided -# by doxygen. Whatever the program writes to standard output is used as the file -# version. For an example see the documentation. - -FILE_VERSION_FILTER = - -# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed -# by doxygen. The layout file controls the global structure of the generated -# output files in an output format independent way. To create the layout file -# that represents doxygen's defaults, run doxygen with the -l option. You can -# optionally specify a file name after the option, if omitted DoxygenLayout.xml -# will be used as the name of the layout file. -# -# Note that if you run doxygen from a directory containing a file called -# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE -# tag is left empty. - -LAYOUT_FILE = - -# The CITE_BIB_FILES tag can be used to specify one or more bib files containing -# the reference definitions. This must be a list of .bib files. The .bib -# extension is automatically appended if omitted. This requires the bibtex tool -# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info. -# For LaTeX the style of the bibliography can be controlled using -# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the -# search path. See also \cite for info how to create references. - -CITE_BIB_FILES = - -#--------------------------------------------------------------------------- -# Configuration options related to warning and progress messages -#--------------------------------------------------------------------------- - -# The QUIET tag can be used to turn on/off the messages that are generated to -# standard output by doxygen. If QUIET is set to YES this implies that the -# messages are off. -# The default value is: NO. - -QUIET = NO - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES -# this implies that the warnings are on. -# -# Tip: Turn warnings on while writing the documentation. -# The default value is: YES. - -WARNINGS = YES - -# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate -# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag -# will automatically be disabled. -# The default value is: YES. - -WARN_IF_UNDOCUMENTED = YES - -# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some parameters -# in a documented function, or documenting parameters that don't exist or using -# markup commands wrongly. -# The default value is: YES. - -WARN_IF_DOC_ERROR = YES - -# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that -# are documented, but have no documentation for their parameters or return -# value. If set to NO, doxygen will only warn about wrong or incomplete -# parameter documentation, but not about the absence of documentation. -# The default value is: NO. - -WARN_NO_PARAMDOC = NO - -# The WARN_FORMAT tag determines the format of the warning messages that doxygen -# can produce. The string should contain the $file, $line, and $text tags, which -# will be replaced by the file and line number from which the warning originated -# and the warning text. Optionally the format may contain $version, which will -# be replaced by the version of the file (if it could be obtained via -# FILE_VERSION_FILTER) -# The default value is: $file:$line: $text. - -WARN_FORMAT = "$file:$line: $text" - -# The WARN_LOGFILE tag can be used to specify a file to which warning and error -# messages should be written. If left blank the output is written to standard -# error (stderr). - -WARN_LOGFILE = - -#--------------------------------------------------------------------------- -# Configuration options related to the input files -#--------------------------------------------------------------------------- - -# The INPUT tag is used to specify the files and/or directories that contain -# documented source files. You may enter file names like myfile.cpp or -# directories like /usr/src/myproject. Separate the files or directories with -# spaces. -# Note: If this tag is empty the current directory is searched. - -INPUT = . - -# This tag can be used to specify the character encoding of the source files -# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses -# libiconv (or the iconv built into libc) for the transcoding. See the libiconv -# documentation (see: http://www.gnu.org/software/libiconv) for the list of -# possible encodings. -# The default value is: UTF-8. - -INPUT_ENCODING = UTF-8 - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and -# *.h) to filter out the source-files in the directories. If left blank the -# following patterns are tested:*.c, *.cc, *.cxx, *.cpp, *.c++, *.java, *.ii, -# *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp, -# *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown, -# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf, -# *.qsf, *.as and *.js. - -FILE_PATTERNS = *.php - -# The RECURSIVE tag can be used to specify whether or not subdirectories should -# be searched for input files as well. -# The default value is: NO. - -RECURSIVE = YES - -# The EXCLUDE tag can be used to specify files and/or directories that should be -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. -# -# Note that relative paths are relative to the directory from which doxygen is -# run. - -EXCLUDE = vendor \ - data \ - tpl \ - inc \ - doc \ - tmp - -# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or -# directories that are symbolic links (a Unix file system feature) are excluded -# from the input. -# The default value is: NO. - -EXCLUDE_SYMLINKS = YES - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. -# -# Note that the wildcards are matched against the file with absolute path, so to -# exclude all test directories for example use the pattern */test/* - -EXCLUDE_PATTERNS = - -# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names -# (namespaces, classes, functions, etc.) that should be excluded from the -# output. The symbol name can be a fully qualified name, a word, or if the -# wildcard * is used, a substring. Examples: ANamespace, AClass, -# AClass::ANamespace, ANamespace::*Test -# -# Note that the wildcards are matched against the file with absolute path, so to -# exclude all test directories use the pattern */test/* - -EXCLUDE_SYMBOLS = - -# The EXAMPLE_PATH tag can be used to specify one or more files or directories -# that contain example code fragments that are included (see the \include -# command). - -EXAMPLE_PATH = - -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and -# *.h) to filter out the source-files in the directories. If left blank all -# files are included. - -EXAMPLE_PATTERNS = * - -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude commands -# irrespective of the value of the RECURSIVE tag. -# The default value is: NO. - -EXAMPLE_RECURSIVE = NO - -# The IMAGE_PATH tag can be used to specify one or more files or directories -# that contain images that are to be included in the documentation (see the -# \image command). - -IMAGE_PATH = - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command: -# -# -# -# where is the value of the INPUT_FILTER tag, and is the -# name of an input file. Doxygen will then use the output that the filter -# program writes to standard output. If FILTER_PATTERNS is specified, this tag -# will be ignored. -# -# Note that the filter must not add or remove lines; it is applied before the -# code is scanned, but not when the output code is generated. If lines are added -# or removed, the anchors will not be placed correctly. - -INPUT_FILTER = - -# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. The filters are a list of the form: pattern=filter -# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how -# filters are used. If the FILTER_PATTERNS tag is empty or if none of the -# patterns match the file name, INPUT_FILTER is applied. - -FILTER_PATTERNS = - -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will also be used to filter the input files that are used for -# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). -# The default value is: NO. - -FILTER_SOURCE_FILES = NO - -# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file -# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and -# it is also possible to disable source filtering for a specific pattern using -# *.ext= (so without naming a filter). -# This tag requires that the tag FILTER_SOURCE_FILES is set to YES. - -FILTER_SOURCE_PATTERNS = - -# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that -# is part of the input, its contents will be placed on the main page -# (index.html). This can be useful if you have a project on for instance GitHub -# and want to reuse the introduction page also for the doxygen output. - -USE_MDFILE_AS_MAINPAGE = - -#--------------------------------------------------------------------------- -# Configuration options related to source browsing -#--------------------------------------------------------------------------- - -# If the SOURCE_BROWSER tag is set to YES then a list of source files will be -# generated. Documented entities will be cross-referenced with these sources. -# -# Note: To get rid of all source code in the generated output, make sure that -# also VERBATIM_HEADERS is set to NO. -# The default value is: NO. - -SOURCE_BROWSER = YES - -# Setting the INLINE_SOURCES tag to YES will include the body of functions, -# classes and enums directly into the documentation. -# The default value is: NO. - -INLINE_SOURCES = NO - -# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any -# special comment blocks from generated source code fragments. Normal C, C++ and -# Fortran comments will always remain visible. -# The default value is: YES. - -STRIP_CODE_COMMENTS = YES - -# If the REFERENCED_BY_RELATION tag is set to YES then for each documented -# function all documented functions referencing it will be listed. -# The default value is: NO. - -REFERENCED_BY_RELATION = NO - -# If the REFERENCES_RELATION tag is set to YES then for each documented function -# all documented entities called/used by that function will be listed. -# The default value is: NO. - -REFERENCES_RELATION = NO - -# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set -# to YES then the hyperlinks from functions in REFERENCES_RELATION and -# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will -# link to the documentation. -# The default value is: YES. - -REFERENCES_LINK_SOURCE = YES - -# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the -# source code will show a tooltip with additional information such as prototype, -# brief description and links to the definition and documentation. Since this -# will make the HTML file larger and loading of large files a bit slower, you -# can opt to disable this feature. -# The default value is: YES. -# This tag requires that the tag SOURCE_BROWSER is set to YES. - -SOURCE_TOOLTIPS = YES - -# If the USE_HTAGS tag is set to YES then the references to source code will -# point to the HTML generated by the htags(1) tool instead of doxygen built-in -# source browser. The htags tool is part of GNU's global source tagging system -# (see http://www.gnu.org/software/global/global.html). You will need version -# 4.8.6 or higher. -# -# To use it do the following: -# - Install the latest version of global -# - Enable SOURCE_BROWSER and USE_HTAGS in the config file -# - Make sure the INPUT points to the root of the source tree -# - Run doxygen as normal -# -# Doxygen will invoke htags (and that will in turn invoke gtags), so these -# tools must be available from the command line (i.e. in the search path). -# -# The result: instead of the source browser generated by doxygen, the links to -# source code will now point to the output of htags. -# The default value is: NO. -# This tag requires that the tag SOURCE_BROWSER is set to YES. - -USE_HTAGS = NO - -# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a -# verbatim copy of the header file for each class for which an include is -# specified. Set to NO to disable this. -# See also: Section \class. -# The default value is: YES. - -VERBATIM_HEADERS = YES - -#--------------------------------------------------------------------------- -# Configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all -# compounds will be generated. Enable this if the project contains a lot of -# classes, structs, unions or interfaces. -# The default value is: YES. - -ALPHABETICAL_INDEX = YES - -# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in -# which the alphabetical index list will be split. -# Minimum value: 1, maximum value: 20, default value: 5. -# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. - -COLS_IN_ALPHA_INDEX = 5 - -# In case all classes in a project start with a common prefix, all classes will -# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag -# can be used to specify a prefix (or a list of prefixes) that should be ignored -# while generating the index headers. -# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. - -IGNORE_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output -# The default value is: YES. - -GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a -# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of -# it. -# The default directory is: html. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_OUTPUT = doxygen - -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each -# generated HTML page (for example: .htm, .php, .asp). -# The default value is: .html. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_FILE_EXTENSION = .html - -# The HTML_HEADER tag can be used to specify a user-defined HTML header file for -# each generated HTML page. If the tag is left blank doxygen will generate a -# standard header. -# -# To get valid HTML the header file that includes any scripts and style sheets -# that doxygen needs, which is dependent on the configuration options used (e.g. -# the setting GENERATE_TREEVIEW). It is highly recommended to start with a -# default header using -# doxygen -w html new_header.html new_footer.html new_stylesheet.css -# YourConfigFile -# and then modify the file new_header.html. See also section "Doxygen usage" -# for information on how to generate the default header that doxygen normally -# uses. -# Note: The header is subject to change so you typically have to regenerate the -# default header when upgrading to a newer version of doxygen. For a description -# of the possible markers and block names see the documentation. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_HEADER = - -# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each -# generated HTML page. If the tag is left blank doxygen will generate a standard -# footer. See HTML_HEADER for more information on how to generate a default -# footer and what special commands can be used inside the footer. See also -# section "Doxygen usage" for information on how to generate the default footer -# that doxygen normally uses. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_FOOTER = - -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style -# sheet that is used by each HTML page. It can be used to fine-tune the look of -# the HTML output. If left blank doxygen will generate a default style sheet. -# See also section "Doxygen usage" for information on how to generate the style -# sheet that doxygen normally uses. -# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as -# it is more robust and this tag (HTML_STYLESHEET) will in the future become -# obsolete. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_STYLESHEET = - -# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined -# cascading style sheets that are included after the standard style sheets -# created by doxygen. Using this option one can overrule certain style aspects. -# This is preferred over using HTML_STYLESHEET since it does not replace the -# standard style sheet and is therefore more robust against future updates. -# Doxygen will copy the style sheet files to the output directory. -# Note: The order of the extra style sheet files is of importance (e.g. the last -# style sheet in the list overrules the setting of the previous ones in the -# list). For an example see the documentation. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_EXTRA_STYLESHEET = - -# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or -# other source files which should be copied to the HTML output directory. Note -# that these files will be copied to the base HTML output directory. Use the -# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these -# files. In the HTML_STYLESHEET file, use the file name only. Also note that the -# files will be copied as-is; there are no commands or markers available. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_EXTRA_FILES = - -# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen -# will adjust the colors in the style sheet and background images according to -# this color. Hue is specified as an angle on a colorwheel, see -# http://en.wikipedia.org/wiki/Hue for more information. For instance the value -# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 -# purple, and 360 is red again. -# Minimum value: 0, maximum value: 359, default value: 220. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_COLORSTYLE_HUE = 220 - -# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors -# in the HTML output. For a value of 0 the output will use grayscales only. A -# value of 255 will produce the most vivid colors. -# Minimum value: 0, maximum value: 255, default value: 100. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_COLORSTYLE_SAT = 100 - -# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the -# luminance component of the colors in the HTML output. Values below 100 -# gradually make the output lighter, whereas values above 100 make the output -# darker. The value divided by 100 is the actual gamma applied, so 80 represents -# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not -# change the gamma. -# Minimum value: 40, maximum value: 240, default value: 80. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_COLORSTYLE_GAMMA = 80 - -# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML -# page will contain the date and time when the page was generated. Setting this -# to NO can help when comparing the output of multiple runs. -# The default value is: YES. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_TIMESTAMP = YES - -# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML -# documentation will contain sections that can be hidden and shown after the -# page has loaded. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_DYNAMIC_SECTIONS = NO - -# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries -# shown in the various tree structured indices initially; the user can expand -# and collapse entries dynamically later on. Doxygen will expand the tree to -# such a level that at most the specified number of entries are visible (unless -# a fully collapsed tree already exceeds this amount). So setting the number of -# entries 1 will produce a full collapsed tree by default. 0 is a special value -# representing an infinite number of entries and will result in a full expanded -# tree by default. -# Minimum value: 0, maximum value: 9999, default value: 100. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_INDEX_NUM_ENTRIES = 100 - -# If the GENERATE_DOCSET tag is set to YES, additional index files will be -# generated that can be used as input for Apple's Xcode 3 integrated development -# environment (see: http://developer.apple.com/tools/xcode/), introduced with -# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a -# Makefile in the HTML output directory. Running make will produce the docset in -# that directory and running make install will install the docset in -# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at -# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html -# for more information. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_DOCSET = NO - -# This tag determines the name of the docset feed. A documentation feed provides -# an umbrella under which multiple documentation sets from a single provider -# (such as a company or product suite) can be grouped. -# The default value is: Doxygen generated docs. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_FEEDNAME = "Doxygen generated docs" - -# This tag specifies a string that should uniquely identify the documentation -# set bundle. This should be a reverse domain-name style string, e.g. -# com.mycompany.MyDocSet. Doxygen will append .docset to the name. -# The default value is: org.doxygen.Project. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_BUNDLE_ID = org.doxygen.Project - -# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify -# the documentation publisher. This should be a reverse domain-name style -# string, e.g. com.mycompany.MyDocSet.documentation. -# The default value is: org.doxygen.Publisher. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_PUBLISHER_ID = org.doxygen.Publisher - -# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. -# The default value is: Publisher. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_PUBLISHER_NAME = Publisher - -# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three -# additional HTML index files: index.hhp, index.hhc, and index.hhk. The -# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop -# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on -# Windows. -# -# The HTML Help Workshop contains a compiler that can convert all HTML output -# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML -# files are now used as the Windows 98 help format, and will replace the old -# Windows help format (.hlp) on all Windows platforms in the future. Compressed -# HTML files also contain an index, a table of contents, and you can search for -# words in the documentation. The HTML workshop also contains a viewer for -# compressed HTML files. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_HTMLHELP = NO - -# The CHM_FILE tag can be used to specify the file name of the resulting .chm -# file. You can add a path in front of the file if the result should not be -# written to the html output directory. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -CHM_FILE = - -# The HHC_LOCATION tag can be used to specify the location (absolute path -# including file name) of the HTML help compiler (hhc.exe). If non-empty, -# doxygen will try to run the HTML help compiler on the generated index.hhp. -# The file has to be specified with full path. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -HHC_LOCATION = - -# The GENERATE_CHI flag controls if a separate .chi index file is generated -# (YES) or that it should be included in the master .chm file (NO). -# The default value is: NO. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -GENERATE_CHI = NO - -# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc) -# and project file content. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -CHM_INDEX_ENCODING = - -# The BINARY_TOC flag controls whether a binary table of contents is generated -# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it -# enables the Previous and Next buttons. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -BINARY_TOC = NO - -# The TOC_EXPAND flag can be set to YES to add extra items for group members to -# the table of contents of the HTML help documentation and to the tree view. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -TOC_EXPAND = NO - -# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and -# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that -# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help -# (.qch) of the generated HTML documentation. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_QHP = NO - -# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify -# the file name of the resulting .qch file. The path specified is relative to -# the HTML output folder. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QCH_FILE = - -# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help -# Project output. For more information please see Qt Help Project / Namespace -# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace). -# The default value is: org.doxygen.Project. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_NAMESPACE = org.doxygen.Project - -# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt -# Help Project output. For more information please see Qt Help Project / Virtual -# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual- -# folders). -# The default value is: doc. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_VIRTUAL_FOLDER = doc - -# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom -# filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- -# filters). -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_CUST_FILTER_NAME = - -# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the -# custom filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- -# filters). -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_CUST_FILTER_ATTRS = - -# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this -# project's filter section matches. Qt Help Project / Filter Attributes (see: -# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes). -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_SECT_FILTER_ATTRS = - -# The QHG_LOCATION tag can be used to specify the location of Qt's -# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the -# generated .qhp file. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHG_LOCATION = - -# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be -# generated, together with the HTML files, they form an Eclipse help plugin. To -# install this plugin and make it available under the help contents menu in -# Eclipse, the contents of the directory containing the HTML and XML files needs -# to be copied into the plugins directory of eclipse. The name of the directory -# within the plugins directory should be the same as the ECLIPSE_DOC_ID value. -# After copying Eclipse needs to be restarted before the help appears. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_ECLIPSEHELP = NO - -# A unique identifier for the Eclipse help plugin. When installing the plugin -# the directory name containing the HTML and XML files should also have this -# name. Each documentation set should have its own identifier. -# The default value is: org.doxygen.Project. -# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. - -ECLIPSE_DOC_ID = org.doxygen.Project - -# If you want full control over the layout of the generated HTML pages it might -# be necessary to disable the index and replace it with your own. The -# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top -# of each HTML page. A value of NO enables the index and the value YES disables -# it. Since the tabs in the index contain the same information as the navigation -# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -DISABLE_INDEX = NO - -# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index -# structure should be generated to display hierarchical information. If the tag -# value is set to YES, a side panel will be generated containing a tree-like -# index structure (just like the one that is generated for HTML Help). For this -# to work a browser that supports JavaScript, DHTML, CSS and frames is required -# (i.e. any modern browser). Windows users are probably better off using the -# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can -# further fine-tune the look of the index. As an example, the default style -# sheet generated by doxygen has an example that shows how to put an image at -# the root of the tree instead of the PROJECT_NAME. Since the tree basically has -# the same information as the tab index, you could consider setting -# DISABLE_INDEX to YES when enabling this option. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_TREEVIEW = YES - -# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that -# doxygen will group on one line in the generated HTML documentation. -# -# Note that a value of 0 will completely suppress the enum values from appearing -# in the overview section. -# Minimum value: 0, maximum value: 20, default value: 4. -# This tag requires that the tag GENERATE_HTML is set to YES. - -ENUM_VALUES_PER_LINE = 4 - -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used -# to set the initial width (in pixels) of the frame in which the tree is shown. -# Minimum value: 0, maximum value: 1500, default value: 250. -# This tag requires that the tag GENERATE_HTML is set to YES. - -TREEVIEW_WIDTH = 250 - -# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to -# external symbols imported via tag files in a separate window. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -EXT_LINKS_IN_WINDOW = NO - -# Use this tag to change the font size of LaTeX formulas included as images in -# the HTML documentation. When you change the font size after a successful -# doxygen run you need to manually remove any form_*.png images from the HTML -# output directory to force them to be regenerated. -# Minimum value: 8, maximum value: 50, default value: 10. -# This tag requires that the tag GENERATE_HTML is set to YES. - -FORMULA_FONTSIZE = 10 - -# Use the FORMULA_TRANPARENT tag to determine whether or not the images -# generated for formulas are transparent PNGs. Transparent PNGs are not -# supported properly for IE 6.0, but are supported on all modern browsers. -# -# Note that when changing this option you need to delete any form_*.png files in -# the HTML output directory before the changes have effect. -# The default value is: YES. -# This tag requires that the tag GENERATE_HTML is set to YES. - -FORMULA_TRANSPARENT = YES - -# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see -# http://www.mathjax.org) which uses client side Javascript for the rendering -# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX -# installed or if you want to formulas look prettier in the HTML output. When -# enabled you may also need to install MathJax separately and configure the path -# to it using the MATHJAX_RELPATH option. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -USE_MATHJAX = NO - -# When MathJax is enabled you can set the default output format to be used for -# the MathJax output. See the MathJax site (see: -# http://docs.mathjax.org/en/latest/output.html) for more details. -# Possible values are: HTML-CSS (which is slower, but has the best -# compatibility), NativeMML (i.e. MathML) and SVG. -# The default value is: HTML-CSS. -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_FORMAT = HTML-CSS - -# When MathJax is enabled you need to specify the location relative to the HTML -# output directory using the MATHJAX_RELPATH option. The destination directory -# should contain the MathJax.js script. For instance, if the mathjax directory -# is located at the same level as the HTML output directory, then -# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax -# Content Delivery Network so you can quickly see the result without installing -# MathJax. However, it is strongly recommended to install a local copy of -# MathJax from http://www.mathjax.org before deployment. -# The default value is: http://cdn.mathjax.org/mathjax/latest. -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest - -# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax -# extension names that should be enabled during MathJax rendering. For example -# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_EXTENSIONS = - -# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces -# of code that will be used on startup of the MathJax code. See the MathJax site -# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an -# example see the documentation. -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_CODEFILE = - -# When the SEARCHENGINE tag is enabled doxygen will generate a search box for -# the HTML output. The underlying search engine uses javascript and DHTML and -# should work on any modern browser. Note that when using HTML help -# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) -# there is already a search function so this one should typically be disabled. -# For large projects the javascript based search engine can be slow, then -# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to -# search using the keyboard; to jump to the search box use + S -# (what the is depends on the OS and browser, but it is typically -# , /