summaryrefslogtreecommitdiffstats
path: root/php-bartlett-php-compatinfo-db-1.19.0-rpm.patch
blob: 4aca8b8c7bbd5b0f6afd031577f96da6bec7f169 (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
diff -up ./data/handleDB.php.rpm ./data/handleDB.php
--- ./data/handleDB.php.rpm	2017-07-17 13:41:26.000000000 +0200
+++ ./data/handleDB.php	2017-07-17 20:24:00.271263969 +0200
@@ -12,7 +12,8 @@
  * @since    Release 1.0.0alpha1 of PHP_CompatInfo_Db
  */
 
-require_once dirname(__DIR__) . '/vendor/autoload.php';
+require_once '/usr/share/php/Symfony3/Component/autoload.php';
+require_once dirname(__DIR__) . '/src/Bartlett/CompatInfoDb/autoload.php';
 require_once __DIR__ . '/ReferenceCollection.php';
 
 use Bartlett\CompatInfoDb\ExtensionFactory;
diff -up ./src/Bartlett/CompatInfoDb/Environment.php.rpm ./src/Bartlett/CompatInfoDb/Environment.php
--- ./src/Bartlett/CompatInfoDb/Environment.php.rpm	2017-07-17 20:24:00.271263969 +0200
+++ ./src/Bartlett/CompatInfoDb/Environment.php	2017-07-17 20:31:52.645050200 +0200
@@ -39,28 +39,13 @@ class Environment
     {
         $database = 'compatinfo.sqlite';
 
-        if (PATH_SEPARATOR == ';') {
-            // windows
-            $userHome = getenv('USERPROFILE');
+        if (($db = getenv('BARTLETT_COMPATINFO_DB')) && file_exists($db)) {
+            $tempDir = dirname($db);
+        } else if (file_exists($db = '/usr/share/php-bartlett-php-compatinfo-db/' . $database)) {
+            $tempDir = dirname($db);
         } else {
-            // unix
-            $userHome = getenv('HOME');
-        }
-        $tempDir = $userHome . '/.bartlett';
-
-        if (!file_exists($tempDir)) {
-            mkdir($tempDir);
-        }
-        $source = dirname(dirname(dirname(__DIR__))) . '/data/' . $database;
-        $dest   = $tempDir . '/' . $database;
-
-        if (!file_exists($dest)
-            || sha1_file($source) !== sha1_file($dest)
-        ) {
-            // install DB only if necessary (missing or modified)
-            copy($source, $dest);
-        }
-
+            $tempDir = dirname(dirname(dirname(__DIR__))) . '/data';
+		}
         $pdo = new PDO('sqlite:' . $tempDir . '/' . $database);
         return $pdo;
     }
diff -up ./tests/bootstrap.php.rpm ./tests/bootstrap.php
--- ./tests/bootstrap.php.rpm	2017-07-17 13:41:26.000000000 +0200
+++ ./tests/bootstrap.php	2017-07-17 20:24:00.272263975 +0200
@@ -1,6 +1,7 @@
 <?php
 
 $baseDir   = dirname(__DIR__);
-$vendorDir = $baseDir . '/vendor';
+$vendorDir = 'Bartlett/CompatInfoDb'; // tests use include_path
 
 require_once $vendorDir . '/autoload.php';
+require_once __DIR__ . '/Reference/GenericTest.php';