@@ -1,17 +1,17 @@ |
||
1 | 1 | <?php |
2 | - defined('ROOT_PATH') || exit('Access denied'); |
|
2 | + defined('ROOT_PATH') || exit('Access denied'); |
|
3 | 3 | /** |
4 | 4 | * File upload language messages (English) |
5 | 5 | */ |
6 | 6 | $lang['fu_upload_err_ini_size'] = 'The uploaded file exceeds the upload_max_filesize directive in php.ini.'; |
7 | - $lang['fu_upload_err_form_size'] = 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.'; |
|
8 | - $lang['fu_upload_err_partial'] = 'The uploaded file was only partially uploaded.'; |
|
9 | - $lang['fu_upload_err_no_file'] = 'No file was choosed. Please select one.'; |
|
10 | - $lang['fu_upload_err_no_tmp_dir'] = 'Missing a temporary folder.'; |
|
11 | - $lang['fu_upload_err_cant_write'] = 'Failed to write file to disk.'; |
|
12 | - $lang['fu_upload_err_extension'] = 'A PHP extension stopped the file upload.'; |
|
13 | - $lang['fu_accept_file_types'] = 'Filetype not allowed'; |
|
14 | - $lang['fu_file_uploads_disabled'] = 'File uploading option is disabled in php.ini'; |
|
15 | - $lang['fu_max_file_size'] = 'The uploaded file size is too big max size is %s'; |
|
16 | - $lang['fu_overwritten_not_allowed'] = 'You don\'t allow overwriting existing file'; |
|
7 | + $lang['fu_upload_err_form_size'] = 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.'; |
|
8 | + $lang['fu_upload_err_partial'] = 'The uploaded file was only partially uploaded.'; |
|
9 | + $lang['fu_upload_err_no_file'] = 'No file was choosed. Please select one.'; |
|
10 | + $lang['fu_upload_err_no_tmp_dir'] = 'Missing a temporary folder.'; |
|
11 | + $lang['fu_upload_err_cant_write'] = 'Failed to write file to disk.'; |
|
12 | + $lang['fu_upload_err_extension'] = 'A PHP extension stopped the file upload.'; |
|
13 | + $lang['fu_accept_file_types'] = 'Filetype not allowed'; |
|
14 | + $lang['fu_file_uploads_disabled'] = 'File uploading option is disabled in php.ini'; |
|
15 | + $lang['fu_max_file_size'] = 'The uploaded file size is too big max size is %s'; |
|
16 | + $lang['fu_overwritten_not_allowed'] = 'You don\'t allow overwriting existing file'; |
|
17 | 17 |
@@ -22,7 +22,7 @@ |
||
22 | 22 | * You should have received a copy of the GNU General Public License |
23 | 23 | * along with this program; if not, write to the Free Software |
24 | 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
25 | - */ |
|
25 | + */ |
|
26 | 26 | |
27 | 27 | /** |
28 | 28 | * @file constants.php |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * You should have received a copy of the GNU General Public License |
23 | 23 | * along with this program; if not, write to the Free Software |
24 | 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
25 | - */ |
|
25 | + */ |
|
26 | 26 | |
27 | 27 | |
28 | 28 | function & class_loader($class, $dir = 'libraries', $params = null){ |
@@ -92,8 +92,8 @@ discard block |
||
92 | 92 | } |
93 | 93 | |
94 | 94 | /** |
95 | - * @test |
|
96 | - */ |
|
95 | + * @test |
|
96 | + */ |
|
97 | 97 | function get_config($key, $default = null){ |
98 | 98 | static $cfg; |
99 | 99 | if(empty($cfg)){ |
@@ -121,8 +121,8 @@ discard block |
||
121 | 121 | } |
122 | 122 | |
123 | 123 | /** |
124 | - * @test |
|
125 | - */ |
|
124 | + * @test |
|
125 | + */ |
|
126 | 126 | function is_url($url){ |
127 | 127 | return preg_match('/^(http|https|ftp):\/\/(.*)/', $url); |
128 | 128 | } |
@@ -142,8 +142,8 @@ discard block |
||
142 | 142 | |
143 | 143 | |
144 | 144 | /** |
145 | - * @test |
|
146 | - */ |
|
145 | + * @test |
|
146 | + */ |
|
147 | 147 | function attributes_to_string(array $attributes){ |
148 | 148 | $str = ' '; |
149 | 149 | //we check that the array passed as an argument is not empty. |
@@ -173,8 +173,8 @@ discard block |
||
173 | 173 | } |
174 | 174 | |
175 | 175 | /** |
176 | - * @test |
|
177 | - */ |
|
176 | + * @test |
|
177 | + */ |
|
178 | 178 | function clean_input($str){ |
179 | 179 | if(is_array($str)){ |
180 | 180 | $str = array_map('clean_input', $str); |
@@ -193,8 +193,8 @@ discard block |
||
193 | 193 | } |
194 | 194 | |
195 | 195 | /** |
196 | - * @test |
|
197 | - */ |
|
196 | + * @test |
|
197 | + */ |
|
198 | 198 | function string_hidden($str, $startCount = 0, $endCount = 0, $hiddenChar = '*'){ |
199 | 199 | //get the string length |
200 | 200 | $len = strlen($str); |
@@ -1,8 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | /** |
4 | - * Function to test private & protected method |
|
5 | - */ |
|
4 | + * Function to test private & protected method |
|
5 | + */ |
|
6 | 6 | function runPrivateOrProtectedMethod($object, $method, array $args = array()){ |
7 | 7 | $r = new ReflectionClass(get_class($object)); |
8 | 8 | $m = $r->getMethod($method); |
@@ -3,66 +3,66 @@ discard block |
||
3 | 3 | class FormValidationTest extends TestCase |
4 | 4 | { |
5 | 5 | public static function setUpBeforeClass() |
6 | - { |
|
6 | + { |
|
7 | 7 | |
8 | - } |
|
8 | + } |
|
9 | 9 | |
10 | 10 | public static function tearDownAfterClass() |
11 | - { |
|
11 | + { |
|
12 | 12 | |
13 | - } |
|
13 | + } |
|
14 | 14 | |
15 | - protected function setUp() |
|
16 | - { |
|
15 | + protected function setUp() |
|
16 | + { |
|
17 | 17 | |
18 | - } |
|
18 | + } |
|
19 | 19 | |
20 | - protected function tearDown() |
|
21 | - { |
|
20 | + protected function tearDown() |
|
21 | + { |
|
22 | 22 | |
23 | - } |
|
23 | + } |
|
24 | 24 | |
25 | 25 | |
26 | 26 | |
27 | - // tests |
|
28 | - public function testValidationDataIsEmpty() |
|
29 | - { |
|
27 | + // tests |
|
28 | + public function testValidationDataIsEmpty() |
|
29 | + { |
|
30 | 30 | $fv = new FormValidation(); |
31 | 31 | $this->assertEmpty($fv->getData()); |
32 | - } |
|
32 | + } |
|
33 | 33 | |
34 | 34 | public function testValidationDataIsNotEmpty() |
35 | - { |
|
35 | + { |
|
36 | 36 | $fv = new FormValidation(); |
37 | 37 | $fv->setData(array('name' => 'mike')); |
38 | 38 | $this->assertNotEmpty($fv->getData()); |
39 | 39 | $this->assertArrayHasKey('name', $fv->getData()); |
40 | - } |
|
40 | + } |
|
41 | 41 | |
42 | 42 | public function testCannotDoValidation() |
43 | - { |
|
43 | + { |
|
44 | 44 | $fv = new FormValidation(); |
45 | 45 | $this->assertFalse($fv->canDoValidation()); |
46 | - } |
|
46 | + } |
|
47 | 47 | |
48 | 48 | public function testSettingErrorDelimiter() |
49 | - { |
|
49 | + { |
|
50 | 50 | $fv = new FormValidation(); |
51 | 51 | $fv->setErrorDelimiter('<a>', '</b>'); |
52 | 52 | $this->assertContains('<a>', $fv->getErrorDelimiter()); |
53 | 53 | $this->assertContains('</b>', $fv->getErrorDelimiter()); |
54 | - } |
|
54 | + } |
|
55 | 55 | |
56 | 56 | public function testSettingErrorsDelimiter() |
57 | - { |
|
57 | + { |
|
58 | 58 | $fv = new FormValidation(); |
59 | 59 | $fv->setErrorsDelimiter('<foo>', '</bar>'); |
60 | 60 | $this->assertContains('<foo>', $fv->getErrorsDelimiter()); |
61 | 61 | $this->assertContains('</bar>', $fv->getErrorsDelimiter()); |
62 | - } |
|
62 | + } |
|
63 | 63 | |
64 | 64 | public function testSettingErrorMessageOverride() |
65 | - { |
|
65 | + { |
|
66 | 66 | |
67 | 67 | //field specific message for the rule |
68 | 68 | $fv = new FormValidation(); |
@@ -82,10 +82,10 @@ discard block |
||
82 | 82 | |
83 | 83 | $this->assertFalse($fv->run()); |
84 | 84 | $this->assertContains('global required message error', $fv->returnErrors()); |
85 | - } |
|
85 | + } |
|
86 | 86 | |
87 | 87 | public function testSettingCustomErrorMessage() |
88 | - { |
|
88 | + { |
|
89 | 89 | |
90 | 90 | $fv = new FormValidation(); |
91 | 91 | $fv->setData(array('foo' => '')); |
@@ -103,20 +103,20 @@ discard block |
||
103 | 103 | |
104 | 104 | $this->assertFalse($fv->run()); |
105 | 105 | $this->assertContains('custom "bar" message error', $fv->returnErrors()); |
106 | - } |
|
106 | + } |
|
107 | 107 | |
108 | 108 | public function testReturnErrorsArray() |
109 | - { |
|
109 | + { |
|
110 | 110 | $fv = new FormValidation(); |
111 | 111 | $fv->setRule('name', 'name', 'required'); |
112 | 112 | $fv->setData(array('name' => '')); |
113 | 113 | $this->assertFalse($fv->run()); |
114 | 114 | $this->assertNotEmpty($fv->returnErrors()); |
115 | - } |
|
115 | + } |
|
116 | 116 | |
117 | 117 | |
118 | 118 | public function testRequiredRule() |
119 | - { |
|
119 | + { |
|
120 | 120 | $fv = new FormValidation(); |
121 | 121 | $fv->setRule('name', 'name', 'required'); |
122 | 122 | $fv->setData(array('name' => '')); |
@@ -131,5 +131,5 @@ discard block |
||
131 | 131 | $fv->setRule('name', 'name', 'required'); |
132 | 132 | $fv->setData(array('name' => 'tony')); |
133 | 133 | $this->assertTrue($fv->run()); |
134 | - } |
|
134 | + } |
|
135 | 135 | } |
136 | 136 | \ No newline at end of file |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * You should have received a copy of the GNU General Public License |
23 | 23 | * along with this program; if not, write to the Free Software |
24 | 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
25 | - */ |
|
25 | + */ |
|
26 | 26 | |
27 | 27 | /** |
28 | 28 | * @file common.php |
@@ -438,13 +438,13 @@ discard block |
||
438 | 438 | |
439 | 439 | |
440 | 440 | /** |
441 | - * Function to stringfy PHP variable, useful in debug situation |
|
442 | - * |
|
443 | - * @param mixed $var the variable to stringfy |
|
444 | - * @codeCoverageIgnore |
|
445 | - * |
|
446 | - * @return string the stringfy value |
|
447 | - */ |
|
441 | + * Function to stringfy PHP variable, useful in debug situation |
|
442 | + * |
|
443 | + * @param mixed $var the variable to stringfy |
|
444 | + * @codeCoverageIgnore |
|
445 | + * |
|
446 | + * @return string the stringfy value |
|
447 | + */ |
|
448 | 448 | function stringfy_vars($var){ |
449 | 449 | return print_r($var, true); |
450 | 450 | } |
@@ -586,15 +586,15 @@ discard block |
||
586 | 586 | } |
587 | 587 | |
588 | 588 | /** |
589 | - * This function is very useful, it allows to recover the instance of the global controller. |
|
590 | - * Note this function always returns the address of the super instance. |
|
591 | - * For example : |
|
592 | - * $obj = & get_instance(); |
|
593 | - * |
|
594 | - * @codeCoverageIgnore |
|
595 | - * |
|
596 | - * @return object the instance of the "Controller" class |
|
597 | - */ |
|
589 | + * This function is very useful, it allows to recover the instance of the global controller. |
|
590 | + * Note this function always returns the address of the super instance. |
|
591 | + * For example : |
|
592 | + * $obj = & get_instance(); |
|
593 | + * |
|
594 | + * @codeCoverageIgnore |
|
595 | + * |
|
596 | + * @return object the instance of the "Controller" class |
|
597 | + */ |
|
598 | 598 | function & get_instance(){ |
599 | 599 | return Controller::get_instance(); |
600 | 600 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * You should have received a copy of the GNU General Public License |
23 | 23 | * along with this program; if not, write to the Free Software |
24 | 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
25 | - */ |
|
25 | + */ |
|
26 | 26 | |
27 | 27 | /** |
28 | 28 | * For application languages management |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | * Construct new Lang instance |
69 | 69 | */ |
70 | 70 | public function __construct(){ |
71 | - $this->logger =& class_loader('Log', 'classes'); |
|
72 | - $this->logger->setLogger('Library::Lang'); |
|
71 | + $this->logger =& class_loader('Log', 'classes'); |
|
72 | + $this->logger->setLogger('Library::Lang'); |
|
73 | 73 | |
74 | 74 | $this->default = get_config('default_language', 'en'); |
75 | 75 | $this->logger->debug('Setting the supported languages'); |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * You should have received a copy of the GNU General Public License |
23 | 23 | * along with this program; if not, write to the Free Software |
24 | 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
25 | - */ |
|
25 | + */ |
|
26 | 26 | |
27 | 27 | /** |
28 | 28 | * check if the interface "SessionHandlerInterface" exists (normally in PHP 5.4 this already exists) |
@@ -76,27 +76,27 @@ discard block |
||
76 | 76 | private $logger; |
77 | 77 | |
78 | 78 | /** |
79 | - * Instance of the Loader class |
|
80 | - * @var Loader |
|
81 | - */ |
|
82 | - protected $loader = null; |
|
79 | + * Instance of the Loader class |
|
80 | + * @var Loader |
|
81 | + */ |
|
82 | + protected $loader = null; |
|
83 | 83 | |
84 | 84 | public function __construct(DBSessionHandlerModel $modelInstance = null, Log $logger = null, Loader $loader = null){ |
85 | 85 | /** |
86 | - * instance of the Log class |
|
87 | - */ |
|
88 | - if(is_object($logger)){ |
|
89 | - $this->setLogger($logger); |
|
90 | - } |
|
91 | - else{ |
|
92 | - $this->logger =& class_loader('Log', 'classes'); |
|
93 | - $this->logger->setLogger('Library::DBSessionHandler'); |
|
94 | - } |
|
95 | - |
|
96 | - if(is_object($loader)){ |
|
97 | - $this->setLoader($loader); |
|
98 | - } |
|
99 | - $this->OBJ = & get_instance(); |
|
86 | + * instance of the Log class |
|
87 | + */ |
|
88 | + if(is_object($logger)){ |
|
89 | + $this->setLogger($logger); |
|
90 | + } |
|
91 | + else{ |
|
92 | + $this->logger =& class_loader('Log', 'classes'); |
|
93 | + $this->logger->setLogger('Library::DBSessionHandler'); |
|
94 | + } |
|
95 | + |
|
96 | + if(is_object($loader)){ |
|
97 | + $this->setLoader($loader); |
|
98 | + } |
|
99 | + $this->OBJ = & get_instance(); |
|
100 | 100 | |
101 | 101 | |
102 | 102 | if(is_object($modelInstance)){ |
@@ -199,9 +199,9 @@ discard block |
||
199 | 199 | $this->getLoader()->library('Browser'); |
200 | 200 | } |
201 | 201 | else{ |
202 | - Loader::functions('user_agent'); |
|
203 | - Loader::library('Browser'); |
|
204 | - } |
|
202 | + Loader::functions('user_agent'); |
|
203 | + Loader::library('Browser'); |
|
204 | + } |
|
205 | 205 | |
206 | 206 | $ip = get_ip(); |
207 | 207 | $host = @gethostbyaddr($ip) or null; |
@@ -238,9 +238,9 @@ discard block |
||
238 | 238 | $this->getLoader()->library('Browser'); |
239 | 239 | } |
240 | 240 | else{ |
241 | - Loader::functions('user_agent'); |
|
242 | - Loader::library('Browser'); |
|
243 | - } |
|
241 | + Loader::functions('user_agent'); |
|
242 | + Loader::library('Browser'); |
|
243 | + } |
|
244 | 244 | |
245 | 245 | $ip = get_ip(); |
246 | 246 | $keyValue = $instance->getKeyValue(); |
@@ -324,75 +324,75 @@ discard block |
||
324 | 324 | |
325 | 325 | |
326 | 326 | /** |
327 | - * Return the loader instance |
|
328 | - * @return object Loader the loader instance |
|
329 | - */ |
|
330 | - public function getLoader(){ |
|
331 | - return $this->loader; |
|
332 | - } |
|
333 | - |
|
334 | - /** |
|
335 | - * set the loader instance for future use |
|
336 | - * @param object Loader $loader the loader object |
|
337 | - */ |
|
338 | - public function setLoader($loader){ |
|
339 | - $this->loader = $loader; |
|
340 | - return $this; |
|
341 | - } |
|
342 | - |
|
343 | - /** |
|
344 | - * Return the model instance |
|
345 | - * @return object DBSessionHandlerModel the model instance |
|
346 | - */ |
|
347 | - public function getModelInstance(){ |
|
348 | - return $this->modelInstanceName; |
|
349 | - } |
|
350 | - |
|
351 | - /** |
|
352 | - * set the model instance for future use |
|
353 | - * @param DBSessionHandlerModel $modelInstance the model object |
|
354 | - */ |
|
355 | - public function setModelInstance(DBSessionHandlerModel $modelInstance){ |
|
356 | - $this->modelInstanceName = $modelInstance; |
|
357 | - return $this; |
|
358 | - } |
|
359 | - |
|
360 | - /** |
|
361 | - * Return the Log instance |
|
362 | - * @return Log |
|
363 | - */ |
|
364 | - public function getLogger(){ |
|
365 | - return $this->logger; |
|
366 | - } |
|
367 | - |
|
368 | - /** |
|
369 | - * Set the log instance |
|
370 | - * @param Log $logger the log object |
|
371 | - */ |
|
372 | - public function setLogger(Log $logger){ |
|
373 | - $this->logger = $logger; |
|
374 | - return $this; |
|
375 | - } |
|
376 | - |
|
377 | - /** |
|
378 | - * Set the model instance using the configuration for session |
|
379 | - */ |
|
380 | - private function setModelInstanceFromConfig(){ |
|
381 | - $modelName = get_config('session_save_path'); |
|
327 | + * Return the loader instance |
|
328 | + * @return object Loader the loader instance |
|
329 | + */ |
|
330 | + public function getLoader(){ |
|
331 | + return $this->loader; |
|
332 | + } |
|
333 | + |
|
334 | + /** |
|
335 | + * set the loader instance for future use |
|
336 | + * @param object Loader $loader the loader object |
|
337 | + */ |
|
338 | + public function setLoader($loader){ |
|
339 | + $this->loader = $loader; |
|
340 | + return $this; |
|
341 | + } |
|
342 | + |
|
343 | + /** |
|
344 | + * Return the model instance |
|
345 | + * @return object DBSessionHandlerModel the model instance |
|
346 | + */ |
|
347 | + public function getModelInstance(){ |
|
348 | + return $this->modelInstanceName; |
|
349 | + } |
|
350 | + |
|
351 | + /** |
|
352 | + * set the model instance for future use |
|
353 | + * @param DBSessionHandlerModel $modelInstance the model object |
|
354 | + */ |
|
355 | + public function setModelInstance(DBSessionHandlerModel $modelInstance){ |
|
356 | + $this->modelInstanceName = $modelInstance; |
|
357 | + return $this; |
|
358 | + } |
|
359 | + |
|
360 | + /** |
|
361 | + * Return the Log instance |
|
362 | + * @return Log |
|
363 | + */ |
|
364 | + public function getLogger(){ |
|
365 | + return $this->logger; |
|
366 | + } |
|
367 | + |
|
368 | + /** |
|
369 | + * Set the log instance |
|
370 | + * @param Log $logger the log object |
|
371 | + */ |
|
372 | + public function setLogger(Log $logger){ |
|
373 | + $this->logger = $logger; |
|
374 | + return $this; |
|
375 | + } |
|
376 | + |
|
377 | + /** |
|
378 | + * Set the model instance using the configuration for session |
|
379 | + */ |
|
380 | + private function setModelInstanceFromConfig(){ |
|
381 | + $modelName = get_config('session_save_path'); |
|
382 | 382 | $this->logger->info('The database session model: ' . $modelName); |
383 | 383 | if($this->getLoader()){ |
384 | 384 | $this->getLoader()->model($modelName, 'dbsessionhandlerinstance'); |
385 | 385 | } |
386 | 386 | //@codeCoverageIgnoreStart |
387 | 387 | else{ |
388 | - Loader::model($modelName, 'dbsessionhandlerinstance'); |
|
389 | - } |
|
390 | - if(isset($this->OBJ->dbsessionhandlerinstance) && ! $this->OBJ->dbsessionhandlerinstance instanceof DBSessionHandlerModel){ |
|
388 | + Loader::model($modelName, 'dbsessionhandlerinstance'); |
|
389 | + } |
|
390 | + if(isset($this->OBJ->dbsessionhandlerinstance) && ! $this->OBJ->dbsessionhandlerinstance instanceof DBSessionHandlerModel){ |
|
391 | 391 | show_error('To use database session handler, your class model "'.get_class($this->OBJ->dbsessionhandlerinstance).'" need extends "DBSessionHandlerModel"'); |
392 | 392 | } |
393 | 393 | //@codeCoverageIgnoreEnd |
394 | 394 | |
395 | 395 | //set model instance |
396 | 396 | $this->setModelInstance($this->OBJ->dbsessionhandlerinstance); |
397 | - } |
|
397 | + } |
|
398 | 398 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * You should have received a copy of the GNU General Public License |
23 | 23 | * along with this program; if not, write to the Free Software |
24 | 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
25 | - */ |
|
25 | + */ |
|
26 | 26 | |
27 | 27 | class ApcCache implements CacheInterface{ |
28 | 28 | |
@@ -39,15 +39,15 @@ discard block |
||
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
42 | - * instance of the Log class |
|
43 | - */ |
|
44 | - if(is_object($logger)){ |
|
45 | - $this->logger = $logger; |
|
46 | - } |
|
47 | - else{ |
|
48 | - $this->logger =& class_loader('Log', 'classes'); |
|
49 | - $this->logger->setLogger('Library::ApcCache'); |
|
50 | - } |
|
42 | + * instance of the Log class |
|
43 | + */ |
|
44 | + if(is_object($logger)){ |
|
45 | + $this->logger = $logger; |
|
46 | + } |
|
47 | + else{ |
|
48 | + $this->logger =& class_loader('Log', 'classes'); |
|
49 | + $this->logger->setLogger('Library::ApcCache'); |
|
50 | + } |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | /** |
@@ -87,13 +87,13 @@ discard block |
||
87 | 87 | $this->logger->debug('Setting cache data for key ['. $key .'], time to live [' .$ttl. '], expire at [' . date('Y-m-d H:i:s', $expire) . ']'); |
88 | 88 | $result = apc_store($key, $data, $ttl); |
89 | 89 | if($result === false){ |
90 | - $this->logger->error('Can not write cache data for the key ['. $key .'], return false'); |
|
91 | - return false; |
|
92 | - } |
|
93 | - else{ |
|
94 | - $this->logger->info('Cache data saved for the key ['. $key .']'); |
|
95 | - return true; |
|
96 | - } |
|
90 | + $this->logger->error('Can not write cache data for the key ['. $key .'], return false'); |
|
91 | + return false; |
|
92 | + } |
|
93 | + else{ |
|
94 | + $this->logger->info('Cache data saved for the key ['. $key .']'); |
|
95 | + return true; |
|
96 | + } |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | } |
113 | 113 | else{ |
114 | 114 | $this->logger->info('Found cache data for the key [' .$key. '] remove it'); |
115 | - return apc_delete($key) === true; |
|
115 | + return apc_delete($key) === true; |
|
116 | 116 | } |
117 | 117 | } |
118 | 118 | |
@@ -177,28 +177,28 @@ discard block |
||
177 | 177 | } |
178 | 178 | |
179 | 179 | /** |
180 | - * Return the Log instance |
|
181 | - * @return Log |
|
182 | - */ |
|
183 | - public function getLogger(){ |
|
184 | - return $this->logger; |
|
185 | - } |
|
180 | + * Return the Log instance |
|
181 | + * @return Log |
|
182 | + */ |
|
183 | + public function getLogger(){ |
|
184 | + return $this->logger; |
|
185 | + } |
|
186 | 186 | |
187 | - /** |
|
188 | - * Set the log instance |
|
189 | - * @param Log $logger the log object |
|
190 | - */ |
|
191 | - public function setLogger(Log $logger){ |
|
192 | - $this->logger = $logger; |
|
193 | - return $this; |
|
194 | - } |
|
187 | + /** |
|
188 | + * Set the log instance |
|
189 | + * @param Log $logger the log object |
|
190 | + */ |
|
191 | + public function setLogger(Log $logger){ |
|
192 | + $this->logger = $logger; |
|
193 | + return $this; |
|
194 | + } |
|
195 | 195 | |
196 | 196 | /** |
197 | - * Return the array of cache information |
|
198 | - * |
|
199 | - * @param string $key the cache key to get the cache information |
|
200 | - * @return boolean|array |
|
201 | - */ |
|
197 | + * Return the array of cache information |
|
198 | + * |
|
199 | + * @param string $key the cache key to get the cache information |
|
200 | + * @return boolean|array |
|
201 | + */ |
|
202 | 202 | private function _getCacheInfo($key){ |
203 | 203 | $caches = apc_cache_info('user'); |
204 | 204 | if(! empty($caches['cache_list'])){ |