diff options
-rw-r--r-- | application/FileUtils.php | 8 | ||||
-rw-r--r-- | application/History.php | 5 | ||||
-rw-r--r-- | application/LinkDB.php | 1 | ||||
-rw-r--r-- | composer.json | 1 | ||||
-rw-r--r-- | tests/FileUtilsTest.php | 6 | ||||
-rw-r--r-- | tests/HistoryTest.php | 1 | ||||
-rw-r--r-- | tests/utils/ReferenceHistory.php | 1 |
7 files changed, 12 insertions, 11 deletions
diff --git a/application/FileUtils.php b/application/FileUtils.php index ba409821..30560bfc 100644 --- a/application/FileUtils.php +++ b/application/FileUtils.php | |||
@@ -1,8 +1,8 @@ | |||
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | use Shaarli\Exceptions\IOException; | 3 | namespace Shaarli; |
4 | 4 | ||
5 | require_once 'exceptions/IOException.php'; | 5 | use Shaarli\Exceptions\IOException; |
6 | 6 | ||
7 | /** | 7 | /** |
8 | * Class FileUtils | 8 | * Class FileUtils |
@@ -46,7 +46,7 @@ class FileUtils | |||
46 | 46 | ||
47 | return file_put_contents( | 47 | return file_put_contents( |
48 | $file, | 48 | $file, |
49 | self::$phpPrefix.base64_encode(gzdeflate(serialize($content))).self::$phpSuffix | 49 | self::$phpPrefix . base64_encode(gzdeflate(serialize($content))) . self::$phpSuffix |
50 | ); | 50 | ); |
51 | } | 51 | } |
52 | 52 | ||
@@ -64,7 +64,7 @@ class FileUtils | |||
64 | { | 64 | { |
65 | // Note that gzinflate is faster than gzuncompress. | 65 | // Note that gzinflate is faster than gzuncompress. |
66 | // See: http://www.php.net/manual/en/function.gzdeflate.php#96439 | 66 | // See: http://www.php.net/manual/en/function.gzdeflate.php#96439 |
67 | if (! is_readable($file)) { | 67 | if (!is_readable($file)) { |
68 | return $default; | 68 | return $default; |
69 | } | 69 | } |
70 | 70 | ||
diff --git a/application/History.php b/application/History.php index 8074a017..a5846652 100644 --- a/application/History.php +++ b/application/History.php | |||
@@ -3,7 +3,6 @@ namespace Shaarli; | |||
3 | 3 | ||
4 | use DateTime; | 4 | use DateTime; |
5 | use Exception; | 5 | use Exception; |
6 | use FileUtils; | ||
7 | 6 | ||
8 | /** | 7 | /** |
9 | * Class History | 8 | * Class History |
@@ -71,7 +70,7 @@ class History | |||
71 | * History constructor. | 70 | * History constructor. |
72 | * | 71 | * |
73 | * @param string $historyFilePath History file path. | 72 | * @param string $historyFilePath History file path. |
74 | * @param int $retentionTime History content rentention time in seconds. | 73 | * @param int $retentionTime History content retention time in seconds. |
75 | * | 74 | * |
76 | * @throws Exception if something goes wrong. | 75 | * @throws Exception if something goes wrong. |
77 | */ | 76 | */ |
@@ -146,7 +145,7 @@ class History | |||
146 | * Save a new event and write it in the history file. | 145 | * Save a new event and write it in the history file. |
147 | * | 146 | * |
148 | * @param string $status Event key, should be defined as constant. | 147 | * @param string $status Event key, should be defined as constant. |
149 | * @param mixed $id Event item identifier (e.g. link ID). | 148 | * @param mixed $id Event item identifier (e.g. link ID). |
150 | */ | 149 | */ |
151 | protected function addEvent($status, $id = null) | 150 | protected function addEvent($status, $id = null) |
152 | { | 151 | { |
diff --git a/application/LinkDB.php b/application/LinkDB.php index 87a53e2e..a5b42727 100644 --- a/application/LinkDB.php +++ b/application/LinkDB.php | |||
@@ -1,6 +1,7 @@ | |||
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | use Shaarli\Exceptions\IOException; | 3 | use Shaarli\Exceptions\IOException; |
4 | use Shaarli\FileUtils; | ||
4 | 5 | ||
5 | /** | 6 | /** |
6 | * Data storage for links. | 7 | * Data storage for links. |
diff --git a/composer.json b/composer.json index 28b0adb5..422a3a4e 100644 --- a/composer.json +++ b/composer.json | |||
@@ -16,6 +16,7 @@ | |||
16 | }, | 16 | }, |
17 | "require": { | 17 | "require": { |
18 | "php": ">=5.6", | 18 | "php": ">=5.6", |
19 | "ext-zlib": "*", | ||
19 | "shaarli/netscape-bookmark-parser": "^2.1", | 20 | "shaarli/netscape-bookmark-parser": "^2.1", |
20 | "erusev/parsedown": "^1.6", | 21 | "erusev/parsedown": "^1.6", |
21 | "slim/slim": "^3.0", | 22 | "slim/slim": "^3.0", |
diff --git a/tests/FileUtilsTest.php b/tests/FileUtilsTest.php index 9596dba9..57719175 100644 --- a/tests/FileUtilsTest.php +++ b/tests/FileUtilsTest.php | |||
@@ -1,15 +1,15 @@ | |||
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | use Shaarli\Exceptions\IOException; | 3 | namespace Shaarli; |
4 | 4 | ||
5 | require_once 'application/FileUtils.php'; | 5 | use Exception; |
6 | 6 | ||
7 | /** | 7 | /** |
8 | * Class FileUtilsTest | 8 | * Class FileUtilsTest |
9 | * | 9 | * |
10 | * Test file utility class. | 10 | * Test file utility class. |
11 | */ | 11 | */ |
12 | class FileUtilsTest extends PHPUnit_Framework_TestCase | 12 | class FileUtilsTest extends \PHPUnit\Framework\TestCase |
13 | { | 13 | { |
14 | /** | 14 | /** |
15 | * @var string Test file path. | 15 | * @var string Test file path. |
diff --git a/tests/HistoryTest.php b/tests/HistoryTest.php index 7723c461..8303e53a 100644 --- a/tests/HistoryTest.php +++ b/tests/HistoryTest.php | |||
@@ -4,7 +4,6 @@ namespace Shaarli; | |||
4 | 4 | ||
5 | use DateTime; | 5 | use DateTime; |
6 | use Exception; | 6 | use Exception; |
7 | use FileUtils; | ||
8 | 7 | ||
9 | class HistoryTest extends \PHPUnit\Framework\TestCase | 8 | class HistoryTest extends \PHPUnit\Framework\TestCase |
10 | { | 9 | { |
diff --git a/tests/utils/ReferenceHistory.php b/tests/utils/ReferenceHistory.php index f19cdf2f..e411c417 100644 --- a/tests/utils/ReferenceHistory.php +++ b/tests/utils/ReferenceHistory.php | |||
@@ -1,5 +1,6 @@ | |||
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | use Shaarli\FileUtils; | ||
3 | use Shaarli\History; | 4 | use Shaarli\History; |
4 | 5 | ||
5 | /** | 6 | /** |