aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--application/config/ConfigPhp.php2
-rw-r--r--application/updater/Updater.php (renamed from application/Updater.php)134
-rw-r--r--application/updater/UpdaterUtils.php39
-rw-r--r--application/updater/exception/UpdaterException.php60
-rw-r--r--composer.json4
-rw-r--r--index.php3
-rw-r--r--tests/updater/DummyUpdater.php (renamed from tests/Updater/DummyUpdater.php)9
-rw-r--r--tests/updater/UpdaterTest.php (renamed from tests/Updater/UpdaterTest.php)29
-rw-r--r--tests/utils/config/configPhp.php2
9 files changed, 154 insertions, 128 deletions
diff --git a/application/config/ConfigPhp.php b/application/config/ConfigPhp.php
index 9ed5d31f..cad34594 100644
--- a/application/config/ConfigPhp.php
+++ b/application/config/ConfigPhp.php
@@ -27,7 +27,7 @@ class ConfigPhp implements ConfigIO
27 /** 27 /**
28 * Map legacy config keys with the new ones. 28 * Map legacy config keys with the new ones.
29 * If ConfigPhp is used, getting <newkey> will actually look for <legacykey>. 29 * If ConfigPhp is used, getting <newkey> will actually look for <legacykey>.
30 * The Updater will use this array to transform keys when switching to JSON. 30 * The updater will use this array to transform keys when switching to JSON.
31 * 31 *
32 * @var array current key => legacy key. 32 * @var array current key => legacy key.
33 */ 33 */
diff --git a/application/Updater.php b/application/updater/Updater.php
index ca05ecc2..55251a30 100644
--- a/application/Updater.php
+++ b/application/updater/Updater.php
@@ -1,15 +1,24 @@
1<?php 1<?php
2 2
3namespace Shaarli\Updater;
4
5use ApplicationUtils;
6use Exception;
7use RainTPL;
8use ReflectionClass;
9use ReflectionException;
10use ReflectionMethod;
3use Shaarli\Bookmark\LinkDB; 11use Shaarli\Bookmark\LinkDB;
4use Shaarli\Bookmark\LinkFilter; 12use Shaarli\Bookmark\LinkFilter;
5use Shaarli\Config\ConfigJson; 13use Shaarli\Config\ConfigJson;
6use Shaarli\Config\ConfigPhp;
7use Shaarli\Config\ConfigManager; 14use Shaarli\Config\ConfigManager;
15use Shaarli\Config\ConfigPhp;
8use Shaarli\Exceptions\IOException; 16use Shaarli\Exceptions\IOException;
9use Shaarli\Thumbnailer; 17use Shaarli\Thumbnailer;
18use Shaarli\Updater\Exception\UpdaterException;
10 19
11/** 20/**
12 * Class Updater. 21 * Class updater.
13 * Used to update stuff when a new Shaarli's version is reached. 22 * Used to update stuff when a new Shaarli's version is reached.
14 * Update methods are ran only once, and the stored in a JSON file. 23 * Update methods are ran only once, and the stored in a JSON file.
15 */ 24 */
@@ -87,12 +96,12 @@ class Updater
87 } 96 }
88 97
89 if ($this->methods === null) { 98 if ($this->methods === null) {
90 throw new UpdaterException(t('Couldn\'t retrieve Updater class methods.')); 99 throw new UpdaterException(t('Couldn\'t retrieve updater class methods.'));
91 } 100 }
92 101
93 foreach ($this->methods as $method) { 102 foreach ($this->methods as $method) {
94 // Not an update method or already done, pass. 103 // Not an update method or already done, pass.
95 if (! startsWith($method->getName(), 'updateMethod') 104 if (!startsWith($method->getName(), 'updateMethod')
96 || in_array($method->getName(), $this->doneUpdates) 105 || in_array($method->getName(), $this->doneUpdates)
97 ) { 106 ) {
98 continue; 107 continue;
@@ -143,7 +152,7 @@ class Updater
143 } 152 }
144 } 153 }
145 $this->conf->write($this->isLoggedIn); 154 $this->conf->write($this->isLoggedIn);
146 unlink($this->conf->get('resource.data_dir').'/options.php'); 155 unlink($this->conf->get('resource.data_dir') . '/options.php');
147 } 156 }
148 157
149 return true; 158 return true;
@@ -178,10 +187,10 @@ class Updater
178 $subConfig = array('config', 'plugins'); 187 $subConfig = array('config', 'plugins');
179 foreach ($subConfig as $sub) { 188 foreach ($subConfig as $sub) {
180 foreach ($oldConfig[$sub] as $key => $value) { 189 foreach ($oldConfig[$sub] as $key => $value) {
181 if (isset($legacyMap[$sub .'.'. $key])) { 190 if (isset($legacyMap[$sub . '.' . $key])) {
182 $configKey = $legacyMap[$sub .'.'. $key]; 191 $configKey = $legacyMap[$sub . '.' . $key];
183 } else { 192 } else {
184 $configKey = $sub .'.'. $key; 193 $configKey = $sub . '.' . $key;
185 } 194 }
186 $this->conf->set($configKey, $value); 195 $this->conf->set($configKey, $value);
187 } 196 }
@@ -237,7 +246,7 @@ class Updater
237 return true; 246 return true;
238 } 247 }
239 248
240 $save = $this->conf->get('resource.data_dir') .'/datastore.'. date('YmdHis') .'.php'; 249 $save = $this->conf->get('resource.data_dir') . '/datastore.' . date('YmdHis') . '.php';
241 copy($this->conf->get('resource.datastore'), $save); 250 copy($this->conf->get('resource.datastore'), $save);
242 251
243 $links = array(); 252 $links = array();
@@ -311,7 +320,7 @@ class Updater
311 // We run the update only if this folder still contains the template files. 320 // We run the update only if this folder still contains the template files.
312 $tplDir = $this->conf->get('resource.raintpl_tpl'); 321 $tplDir = $this->conf->get('resource.raintpl_tpl');
313 $tplFile = $tplDir . '/linklist.html'; 322 $tplFile = $tplDir . '/linklist.html';
314 if (! file_exists($tplFile)) { 323 if (!file_exists($tplFile)) {
315 return true; 324 return true;
316 } 325 }
317 326
@@ -335,7 +344,7 @@ class Updater
335 */ 344 */
336 public function updateMethodMoveUserCss() 345 public function updateMethodMoveUserCss()
337 { 346 {
338 if (! is_file('inc/user.css')) { 347 if (!is_file('inc/user.css')) {
339 return true; 348 return true;
340 } 349 }
341 350
@@ -371,11 +380,11 @@ class Updater
371 */ 380 */
372 public function updateMethodPiwikUrl() 381 public function updateMethodPiwikUrl()
373 { 382 {
374 if (! $this->conf->exists('plugins.PIWIK_URL') || startsWith($this->conf->get('plugins.PIWIK_URL'), 'http')) { 383 if (!$this->conf->exists('plugins.PIWIK_URL') || startsWith($this->conf->get('plugins.PIWIK_URL'), 'http')) {
375 return true; 384 return true;
376 } 385 }
377 386
378 $this->conf->set('plugins.PIWIK_URL', 'http://'. $this->conf->get('plugins.PIWIK_URL')); 387 $this->conf->set('plugins.PIWIK_URL', 'http://' . $this->conf->get('plugins.PIWIK_URL'));
379 $this->conf->write($this->isLoggedIn); 388 $this->conf->write($this->isLoggedIn);
380 389
381 return true; 390 return true;
@@ -485,11 +494,11 @@ class Updater
485 return true; 494 return true;
486 } 495 }
487 496
488 if (! $this->conf->exists('general.download_max_size')) { 497 if (!$this->conf->exists('general.download_max_size')) {
489 $this->conf->set('general.download_max_size', 1024*1024*4); 498 $this->conf->set('general.download_max_size', 1024 * 1024 * 4);
490 } 499 }
491 500
492 if (! $this->conf->exists('general.download_timeout')) { 501 if (!$this->conf->exists('general.download_timeout')) {
493 $this->conf->set('general.download_timeout', 30); 502 $this->conf->set('general.download_timeout', 30);
494 } 503 }
495 504
@@ -542,96 +551,3 @@ class Updater
542 return true; 551 return true;
543 } 552 }
544} 553}
545
546/**
547 * Class UpdaterException.
548 */
549class UpdaterException extends Exception
550{
551 /**
552 * @var string Method where the error occurred.
553 */
554 protected $method;
555
556 /**
557 * @var Exception The parent exception.
558 */
559 protected $previous;
560
561 /**
562 * Constructor.
563 *
564 * @param string $message Force the error message if set.
565 * @param string $method Method where the error occurred.
566 * @param Exception|bool $previous Parent exception.
567 */
568 public function __construct($message = '', $method = '', $previous = false)
569 {
570 $this->method = $method;
571 $this->previous = $previous;
572 $this->message = $this->buildMessage($message);
573 }
574
575 /**
576 * Build the exception error message.
577 *
578 * @param string $message Optional given error message.
579 *
580 * @return string The built error message.
581 */
582 private function buildMessage($message)
583 {
584 $out = '';
585 if (! empty($message)) {
586 $out .= $message . PHP_EOL;
587 }
588
589 if (! empty($this->method)) {
590 $out .= t('An error occurred while running the update ') . $this->method . PHP_EOL;
591 }
592
593 if (! empty($this->previous)) {
594 $out .= ' '. $this->previous->getMessage();
595 }
596
597 return $out;
598 }
599}
600
601/**
602 * Read the updates file, and return already done updates.
603 *
604 * @param string $updatesFilepath Updates file path.
605 *
606 * @return array Already done update methods.
607 */
608function read_updates_file($updatesFilepath)
609{
610 if (! empty($updatesFilepath) && is_file($updatesFilepath)) {
611 $content = file_get_contents($updatesFilepath);
612 if (! empty($content)) {
613 return explode(';', $content);
614 }
615 }
616 return array();
617}
618
619/**
620 * Write updates file.
621 *
622 * @param string $updatesFilepath Updates file path.
623 * @param array $updates Updates array to write.
624 *
625 * @throws Exception Couldn't write version number.
626 */
627function write_updates_file($updatesFilepath, $updates)
628{
629 if (empty($updatesFilepath)) {
630 throw new Exception(t('Updates file path is not set, can\'t write updates.'));
631 }
632
633 $res = file_put_contents($updatesFilepath, implode(';', $updates));
634 if ($res === false) {
635 throw new Exception(t('Unable to write updates in '. $updatesFilepath . '.'));
636 }
637}
diff --git a/application/updater/UpdaterUtils.php b/application/updater/UpdaterUtils.php
new file mode 100644
index 00000000..34d4f422
--- /dev/null
+++ b/application/updater/UpdaterUtils.php
@@ -0,0 +1,39 @@
1<?php
2
3/**
4 * Read the updates file, and return already done updates.
5 *
6 * @param string $updatesFilepath Updates file path.
7 *
8 * @return array Already done update methods.
9 */
10function read_updates_file($updatesFilepath)
11{
12 if (! empty($updatesFilepath) && is_file($updatesFilepath)) {
13 $content = file_get_contents($updatesFilepath);
14 if (! empty($content)) {
15 return explode(';', $content);
16 }
17 }
18 return array();
19}
20
21/**
22 * Write updates file.
23 *
24 * @param string $updatesFilepath Updates file path.
25 * @param array $updates Updates array to write.
26 *
27 * @throws Exception Couldn't write version number.
28 */
29function write_updates_file($updatesFilepath, $updates)
30{
31 if (empty($updatesFilepath)) {
32 throw new Exception(t('Updates file path is not set, can\'t write updates.'));
33 }
34
35 $res = file_put_contents($updatesFilepath, implode(';', $updates));
36 if ($res === false) {
37 throw new Exception(t('Unable to write updates in '. $updatesFilepath . '.'));
38 }
39}
diff --git a/application/updater/exception/UpdaterException.php b/application/updater/exception/UpdaterException.php
new file mode 100644
index 00000000..20aceccf
--- /dev/null
+++ b/application/updater/exception/UpdaterException.php
@@ -0,0 +1,60 @@
1<?php
2
3namespace Shaarli\Updater\Exception;
4
5use Exception;
6
7/**
8 * Class UpdaterException.
9 */
10class UpdaterException extends Exception
11{
12 /**
13 * @var string Method where the error occurred.
14 */
15 protected $method;
16
17 /**
18 * @var Exception The parent exception.
19 */
20 protected $previous;
21
22 /**
23 * Constructor.
24 *
25 * @param string $message Force the error message if set.
26 * @param string $method Method where the error occurred.
27 * @param Exception|bool $previous Parent exception.
28 */
29 public function __construct($message = '', $method = '', $previous = false)
30 {
31 $this->method = $method;
32 $this->previous = $previous;
33 $this->message = $this->buildMessage($message);
34 }
35
36 /**
37 * Build the exception error message.
38 *
39 * @param string $message Optional given error message.
40 *
41 * @return string The built error message.
42 */
43 private function buildMessage($message)
44 {
45 $out = '';
46 if (!empty($message)) {
47 $out .= $message . PHP_EOL;
48 }
49
50 if (!empty($this->method)) {
51 $out .= t('An error occurred while running the update ') . $this->method . PHP_EOL;
52 }
53
54 if (!empty($this->previous)) {
55 $out .= ' ' . $this->previous->getMessage();
56 }
57
58 return $out;
59 }
60}
diff --git a/composer.json b/composer.json
index 4c14e794..af763472 100644
--- a/composer.json
+++ b/composer.json
@@ -46,7 +46,9 @@
46 "Shaarli\\Feed\\": "application/feed", 46 "Shaarli\\Feed\\": "application/feed",
47 "Shaarli\\Http\\": "application/http", 47 "Shaarli\\Http\\": "application/http",
48 "Shaarli\\Render\\": "application/render", 48 "Shaarli\\Render\\": "application/render",
49 "Shaarli\\Security\\": "application/security" 49 "Shaarli\\Security\\": "application/security",
50 "Shaarli\\Updater\\": "application/updater",
51 "Shaarli\\Updater\\Exception\\": "application/updater/exception"
50 } 52 }
51 } 53 }
52} 54}
diff --git a/index.php b/index.php
index 146b4457..ce0373e1 100644
--- a/index.php
+++ b/index.php
@@ -62,6 +62,7 @@ require_once 'application/config/ConfigPlugin.php';
62require_once 'application/feed/Cache.php'; 62require_once 'application/feed/Cache.php';
63require_once 'application/http/HttpUtils.php'; 63require_once 'application/http/HttpUtils.php';
64require_once 'application/http/UrlUtils.php'; 64require_once 'application/http/UrlUtils.php';
65require_once 'application/updater/UpdaterUtils.php';
65require_once 'application/FileUtils.php'; 66require_once 'application/FileUtils.php';
66require_once 'application/History.php'; 67require_once 'application/History.php';
67require_once 'application/NetscapeBookmarkUtils.php'; 68require_once 'application/NetscapeBookmarkUtils.php';
@@ -69,7 +70,6 @@ require_once 'application/TimeZone.php';
69require_once 'application/Utils.php'; 70require_once 'application/Utils.php';
70require_once 'application/PluginManager.php'; 71require_once 'application/PluginManager.php';
71require_once 'application/Router.php'; 72require_once 'application/Router.php';
72require_once 'application/Updater.php';
73 73
74use \Shaarli\Bookmark\Exception\LinkNotFoundException; 74use \Shaarli\Bookmark\Exception\LinkNotFoundException;
75use \Shaarli\Bookmark\LinkDB; 75use \Shaarli\Bookmark\LinkDB;
@@ -83,6 +83,7 @@ use \Shaarli\Render\ThemeUtils;
83use \Shaarli\Security\LoginManager; 83use \Shaarli\Security\LoginManager;
84use \Shaarli\Security\SessionManager; 84use \Shaarli\Security\SessionManager;
85use \Shaarli\Thumbnailer; 85use \Shaarli\Thumbnailer;
86use Shaarli\Updater\Updater;
86 87
87// Ensure the PHP version is supported 88// Ensure the PHP version is supported
88try { 89try {
diff --git a/tests/Updater/DummyUpdater.php b/tests/updater/DummyUpdater.php
index 3c74b4ff..9e866f1f 100644
--- a/tests/Updater/DummyUpdater.php
+++ b/tests/updater/DummyUpdater.php
@@ -1,12 +1,15 @@
1<?php 1<?php
2namespace Shaarli\Updater;
2 3
4use Exception;
5use ReflectionClass;
6use ReflectionMethod;
3use Shaarli\Bookmark\LinkDB; 7use Shaarli\Bookmark\LinkDB;
4 8use Shaarli\Config\ConfigManager;
5require_once 'application/Updater.php';
6 9
7/** 10/**
8 * Class DummyUpdater. 11 * Class DummyUpdater.
9 * Extends Updater to add update method designed for unit tests. 12 * Extends updater to add update method designed for unit tests.
10 */ 13 */
11class DummyUpdater extends Updater 14class DummyUpdater extends Updater
12{ 15{
diff --git a/tests/Updater/UpdaterTest.php b/tests/updater/UpdaterTest.php
index f910e054..d7df5963 100644
--- a/tests/Updater/UpdaterTest.php
+++ b/tests/updater/UpdaterTest.php
@@ -1,19 +1,24 @@
1<?php 1<?php
2namespace Shaarli\Updater;
2 3
4use DateTime;
5use Exception;
3use Shaarli\Bookmark\LinkDB; 6use Shaarli\Bookmark\LinkDB;
4use Shaarli\Config\ConfigJson; 7use Shaarli\Config\ConfigJson;
5use Shaarli\Config\ConfigManager; 8use Shaarli\Config\ConfigManager;
6use Shaarli\Config\ConfigPhp; 9use Shaarli\Config\ConfigPhp;
7use Shaarli\Thumbnailer; 10use Shaarli\Thumbnailer;
8 11
9require_once 'tests/Updater/DummyUpdater.php'; 12require_once 'application/updater/UpdaterUtils.php';
13require_once 'tests/updater/DummyUpdater.php';
14require_once 'tests/utils/ReferenceLinkDB.php';
10require_once 'inc/rain.tpl.class.php'; 15require_once 'inc/rain.tpl.class.php';
11 16
12/** 17/**
13 * Class UpdaterTest. 18 * Class UpdaterTest.
14 * Runs unit tests against the Updater class. 19 * Runs unit tests against the updater class.
15 */ 20 */
16class UpdaterTest extends PHPUnit_Framework_TestCase 21class UpdaterTest extends \PHPUnit\Framework\TestCase
17{ 22{
18 /** 23 /**
19 * @var string Path to test datastore. 24 * @var string Path to test datastore.
@@ -155,7 +160,7 @@ class UpdaterTest extends PHPUnit_Framework_TestCase
155 /** 160 /**
156 * Test Update failed. 161 * Test Update failed.
157 * 162 *
158 * @expectedException UpdaterException 163 * @expectedException \Exception
159 */ 164 */
160 public function testUpdateFailed() 165 public function testUpdateFailed()
161 { 166 {
@@ -181,17 +186,17 @@ class UpdaterTest extends PHPUnit_Framework_TestCase
181 $this->conf->setConfigFile('tests/utils/config/configPhp'); 186 $this->conf->setConfigFile('tests/utils/config/configPhp');
182 $this->conf->reset(); 187 $this->conf->reset();
183 188
184 $optionsFile = 'tests/Updater/options.php'; 189 $optionsFile = 'tests/updater/options.php';
185 $options = '<?php 190 $options = '<?php
186$GLOBALS[\'privateLinkByDefault\'] = true;'; 191$GLOBALS[\'privateLinkByDefault\'] = true;';
187 file_put_contents($optionsFile, $options); 192 file_put_contents($optionsFile, $options);
188 193
189 // tmp config file. 194 // tmp config file.
190 $this->conf->setConfigFile('tests/Updater/config'); 195 $this->conf->setConfigFile('tests/updater/config');
191 196
192 // merge configs 197 // merge configs
193 $updater = new Updater(array(), array(), $this->conf, true); 198 $updater = new Updater(array(), array(), $this->conf, true);
194 // This writes a new config file in tests/Updater/config.php 199 // This writes a new config file in tests/updater/config.php
195 $updater->updateMethodMergeDeprecatedConfigFile(); 200 $updater->updateMethodMergeDeprecatedConfigFile();
196 201
197 // make sure updated field is changed 202 // make sure updated field is changed
@@ -218,7 +223,7 @@ $GLOBALS[\'privateLinkByDefault\'] = true;';
218 */ 223 */
219 public function testRenameDashTags() 224 public function testRenameDashTags()
220 { 225 {
221 $refDB = new ReferenceLinkDB(); 226 $refDB = new \ReferenceLinkDB();
222 $refDB->write(self::$testDatastore); 227 $refDB->write(self::$testDatastore);
223 $linkDB = new LinkDB(self::$testDatastore, true, false); 228 $linkDB = new LinkDB(self::$testDatastore, true, false);
224 229
@@ -364,7 +369,7 @@ $GLOBALS[\'privateLinkByDefault\'] = true;';
364 'private' => true, 369 'private' => true,
365 ), 370 ),
366 ); 371 );
367 $refDB = new ReferenceLinkDB(); 372 $refDB = new \ReferenceLinkDB();
368 $refDB->setLinks($links); 373 $refDB->setLinks($links);
369 $refDB->write(self::$testDatastore); 374 $refDB->write(self::$testDatastore);
370 $linkDB = new LinkDB(self::$testDatastore, true, false); 375 $linkDB = new LinkDB(self::$testDatastore, true, false);
@@ -428,7 +433,7 @@ $GLOBALS[\'privateLinkByDefault\'] = true;';
428 */ 433 */
429 public function testDatastoreIdsNothingToDo() 434 public function testDatastoreIdsNothingToDo()
430 { 435 {
431 $refDB = new ReferenceLinkDB(); 436 $refDB = new \ReferenceLinkDB();
432 $refDB->write(self::$testDatastore); 437 $refDB->write(self::$testDatastore);
433 $linkDB = new LinkDB(self::$testDatastore, true, false); 438 $linkDB = new LinkDB(self::$testDatastore, true, false);
434 439
@@ -765,7 +770,7 @@ $GLOBALS[\'privateLinkByDefault\'] = true;';
765 1 => ['id' => 1] + $blank, 770 1 => ['id' => 1] + $blank,
766 2 => ['id' => 2] + $blank, 771 2 => ['id' => 2] + $blank,
767 ]; 772 ];
768 $refDB = new ReferenceLinkDB(); 773 $refDB = new \ReferenceLinkDB();
769 $refDB->setLinks($links); 774 $refDB->setLinks($links);
770 $refDB->write(self::$testDatastore); 775 $refDB->write(self::$testDatastore);
771 $linkDB = new LinkDB(self::$testDatastore, true, false); 776 $linkDB = new LinkDB(self::$testDatastore, true, false);
@@ -796,7 +801,7 @@ $GLOBALS[\'privateLinkByDefault\'] = true;';
796 1 => ['id' => 1, 'sticky' => true] + $blank, 801 1 => ['id' => 1, 'sticky' => true] + $blank,
797 2 => ['id' => 2] + $blank, 802 2 => ['id' => 2] + $blank,
798 ]; 803 ];
799 $refDB = new ReferenceLinkDB(); 804 $refDB = new \ReferenceLinkDB();
800 $refDB->setLinks($links); 805 $refDB->setLinks($links);
801 $refDB->write(self::$testDatastore); 806 $refDB->write(self::$testDatastore);
802 $linkDB = new LinkDB(self::$testDatastore, true, false); 807 $linkDB = new LinkDB(self::$testDatastore, true, false);
diff --git a/tests/utils/config/configPhp.php b/tests/utils/config/configPhp.php
index 34b11fcd..7dc81e22 100644
--- a/tests/utils/config/configPhp.php
+++ b/tests/utils/config/configPhp.php
@@ -8,7 +8,7 @@ $GLOBALS['titleLink'] = 'titleLink';
8$GLOBALS['redirector'] = 'lala'; 8$GLOBALS['redirector'] = 'lala';
9$GLOBALS['disablesessionprotection'] = false; 9$GLOBALS['disablesessionprotection'] = false;
10$GLOBALS['privateLinkByDefault'] = false; 10$GLOBALS['privateLinkByDefault'] = false;
11$GLOBALS['config']['DATADIR'] = 'tests/Updater'; 11$GLOBALS['config']['DATADIR'] = 'tests/updater';
12$GLOBALS['config']['PAGECACHE'] = 'sandbox/pagecache'; 12$GLOBALS['config']['PAGECACHE'] = 'sandbox/pagecache';
13$GLOBALS['config']['DATASTORE'] = 'data/datastore.php'; 13$GLOBALS['config']['DATASTORE'] = 'data/datastore.php';
14$GLOBALS['plugins']['WALLABAG_VERSION'] = '1'; 14$GLOBALS['plugins']['WALLABAG_VERSION'] = '1';