summaryrefslogtreecommitdiffstats
path: root/php-bartlett-php-compatinfo-db-2.0-rpm.patch
blob: 57a29db00a16cc20b7a65c37d36390bb1a03d8bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
diff -up ./bin/compatinfo-db.rpm ./bin/compatinfo-db
--- ./bin/compatinfo-db.rpm	2020-05-10 13:26:48.000000000 +0200
+++ ./bin/compatinfo-db	2020-05-11 08:25:46.977559291 +0200
@@ -7,10 +7,7 @@ declare(strict_types=1);
 gc_disable(); // performance boost
 
 $possibleAutoloadPaths = [
-    // local dev repository
-    __DIR__ . '/../vendor/autoload.php',
-    // dependency
-    __DIR__ . '/../../../../vendor/autoload.php',
+    '/usr/share/php/Bartlett/CompatInfoDb/autoload.php',
 ];
 
 $isAutoloadFound = false;
diff -up ./src/DatabaseFactory.php.rpm ./src/DatabaseFactory.php
--- ./src/DatabaseFactory.php.rpm	2020-05-10 13:26:48.000000000 +0200
+++ ./src/DatabaseFactory.php	2020-05-11 08:25:46.977559291 +0200
@@ -35,14 +35,13 @@ class DatabaseFactory
 
     private static function getSqliteDsn() : array
     {
-        if (PATH_SEPARATOR == ';') {
-            // windows
-            $userHome = getenv('USERPROFILE');
+        if (($db = getenv('BARTLETT_COMPATINFO_DB')) && file_exists($db)) {
+            static::$tempDir = dirname($db);
+        } else if (file_exists($db = '/usr/share/php-bartlett-php-compatinfo-db/' . static::$database)) {
+            static::$tempDir = dirname($db);
         } else {
-            // unix
-            $userHome = getenv('HOME');
-        }
-        static::$tempDir = $userHome . '/.bartlett';
+            static::$tempDir = dirname(dirname(dirname(__DIR__))) . '/data';
+		}
 
         return [
             'driver' => 'pdo_sqlite',
@@ -58,19 +57,6 @@ class DatabaseFactory
     {
         $dbParams = self::getSqliteDsn();
 
-        if (!file_exists(static::$tempDir)) {
-            mkdir(static::$tempDir);
-        }
-        $source = dirname(__DIR__) . '/data/' . static::$database;
-        $dest   = static::$tempDir . '/' . static::$database;
-
-        if (!file_exists($dest)
-            || sha1_file($source) !== sha1_file($dest)
-        ) {
-            // install DB only if necessary (missing or modified)
-            copy($source, $dest);
-        }
-
         return new PDO($dbParams['url']);
     }
-}
\ Pas de fin de ligne à la fin du fichier
+}
diff -up ./src/Presentation/Console/Application.php.rpm ./src/Presentation/Console/Application.php
--- ./src/Presentation/Console/Application.php.rpm	2020-05-11 08:25:46.977559291 +0200
+++ ./src/Presentation/Console/Application.php	2020-05-11 08:27:10.705045605 +0200
@@ -38,11 +38,7 @@ class Application extends \Symfony\Compo
 
     public function __construct(ContainerInterface $container)
     {
-        try {
-            $version = \Jean85\PrettyVersions::getVersion('bartlett/php-compatinfo-db')->getPrettyVersion();
-        } catch (\OutOfBoundsException $e) {
-            $version = self::VERSION;
-        }
+        $version = self::VERSION;
         parent::__construct(self::NAME, $version);
 
         $this->container = $container;