Ejegg has submitted this change and it was merged.

Change subject: CRM-17641 backport Civi class in order to support other 
backports
......................................................................


CRM-17641 backport Civi class in order to support other backports

This class supports the reduction of the infamous utf names query (Bug: T116724 
) but does nothing of itself.

It is of interest from the point of view of deployment because
1) I had to run the deployment script we have been working on to update 
composer - which we have as a checked in library and
2) The deployment script had to have an upstream file backported before it 
would include the Civi.php file which was not in it's
original whitelist. However, this doesn't make me feel better about using a 
blacklist (a list of files to delete rather than a list of
files to keep/copy as I'd rather miss a file & have something break than miss a 
file & deploy an insecure file never intended to go
on a prod site

It's worth noting that I agreed with Tim that this backport would go into the 
next 4.6 release (but we will drag our heels on the utf names one a big).

Bug: T116724

Change-Id: I7c8c4c5d556b7a1bf820b744f9c0dda4359ab6c8
---
A Civi.php
M composer.json
M vendor/autoload.php
M vendor/composer/ClassLoader.php
A vendor/composer/LICENSE
M vendor/composer/autoload_namespaces.php
M vendor/composer/autoload_real.php
M vendor/composer/installed.json
8 files changed, 278 insertions(+), 191 deletions(-)

Approvals:
  Awight: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/Civi.php b/Civi.php
new file mode 100644
index 0000000..86a1532
--- /dev/null
+++ b/Civi.php
@@ -0,0 +1,64 @@
+<?php
+
+/**
+ * Class Civi
+ *
+ * The "Civi" class provides a facade for accessing major subsystems,
+ * such as the service-container and settings manager. It serves as a
+ * bridge which allows procedural code to access important objects.
+ *
+ * General principles:
+ *  - Each function provides access to a major subsystem.
+ *  - Each function performs a simple lookup.
+ *  - Each function returns an interface.
+ *  - Whenever possible, interfaces should be well-known (e.g. based
+ *    on a standard or well-regarded provider).
+ */
+class Civi {
+
+  /**
+   * A central location for static variable storage.
+   *
+   * @code
+   * `Civi::$statics[__CLASS__]['foo'] = 'bar';
+   * @endcode
+   */
+  public static $statics = array();
+
+  /**
+   * Get the service container.
+   *
+   * @return \Symfony\Component\DependencyInjection\ContainerInterface
+   */
+  public static function container() {
+    return Civi\Core\Container::singleton();
+  }
+
+  /**
+   * Fetch a service from the container.
+   *
+   * @param string $id
+   *   The service ID.
+   * @return mixed
+   */
+  public static function service($id) {
+    return \Civi\Core\Container::singleton()->get($id);
+  }
+
+  /**
+   * Reset all ephemeral system state, e.g. statics,
+   * singletons, containers.
+   */
+  public static function reset() {
+    self::$statics = array();
+    Civi\Core\Container::singleton();
+  }
+
+  /**
+   * @return CRM_Core_Resources
+   */
+  public static function resources() {
+    return CRM_Core_Resources::singleton();
+  }
+
+}
diff --git a/composer.json b/composer.json
index 5637ddf..4ab50c5 100644
--- a/composer.json
+++ b/composer.json
@@ -2,6 +2,7 @@
   "autoload": {
     "psr-0": {
       "PHPUnit_": ["packages/"],
+      "Civi": "",
       "Civi\\": [".", "tests/phpunit/"]
     }
   },
diff --git a/vendor/autoload.php b/vendor/autoload.php
index 5bcfe93..496dcfc 100644
--- a/vendor/autoload.php
+++ b/vendor/autoload.php
@@ -4,4 +4,4 @@
 
 require_once __DIR__ . '/composer' . '/autoload_real.php';
 
-return ComposerAutoloaderInit63ebf2d83757df13019a964a5b69d9c0::getLoader();
+return ComposerAutoloaderInit3d9ec4fd8df8ee96f040c4494bc97b60::getLoader();
diff --git a/vendor/composer/ClassLoader.php b/vendor/composer/ClassLoader.php
index 4e05d3b..5e1469e 100644
--- a/vendor/composer/ClassLoader.php
+++ b/vendor/composer/ClassLoader.php
@@ -351,7 +351,7 @@
             foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) {
                 if (0 === strpos($class, $prefix)) {
                     foreach ($this->prefixDirsPsr4[$prefix] as $dir) {
-                        if (is_file($file = $dir . DIRECTORY_SEPARATOR . 
substr($logicalPathPsr4, $length))) {
+                        if (file_exists($file = $dir . DIRECTORY_SEPARATOR . 
substr($logicalPathPsr4, $length))) {
                             return $file;
                         }
                     }
@@ -361,7 +361,7 @@
 
         // PSR-4 fallback dirs
         foreach ($this->fallbackDirsPsr4 as $dir) {
-            if (is_file($file = $dir . DIRECTORY_SEPARATOR . 
$logicalPathPsr4)) {
+            if (file_exists($file = $dir . DIRECTORY_SEPARATOR . 
$logicalPathPsr4)) {
                 return $file;
             }
         }
@@ -380,7 +380,7 @@
             foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
                 if (0 === strpos($class, $prefix)) {
                     foreach ($dirs as $dir) {
-                        if (is_file($file = $dir . DIRECTORY_SEPARATOR . 
$logicalPathPsr0)) {
+                        if (file_exists($file = $dir . DIRECTORY_SEPARATOR . 
$logicalPathPsr0)) {
                             return $file;
                         }
                     }
@@ -390,7 +390,7 @@
 
         // PSR-0 fallback dirs
         foreach ($this->fallbackDirsPsr0 as $dir) {
-            if (is_file($file = $dir . DIRECTORY_SEPARATOR . 
$logicalPathPsr0)) {
+            if (file_exists($file = $dir . DIRECTORY_SEPARATOR . 
$logicalPathPsr0)) {
                 return $file;
             }
         }
diff --git a/vendor/composer/LICENSE b/vendor/composer/LICENSE
new file mode 100644
index 0000000..c8d57af
--- /dev/null
+++ b/vendor/composer/LICENSE
@@ -0,0 +1,21 @@
+
+Copyright (c) 2015 Nils Adermann, Jordi Boggiano
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is furnished
+to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
diff --git a/vendor/composer/autoload_namespaces.php 
b/vendor/composer/autoload_namespaces.php
index bce8813..06c4a51 100644
--- a/vendor/composer/autoload_namespaces.php
+++ b/vendor/composer/autoload_namespaces.php
@@ -18,5 +18,6 @@
     'File' => array($vendorDir . '/phpseclib/phpseclib/phpseclib'),
     'Crypt' => array($vendorDir . '/phpseclib/phpseclib/phpseclib'),
     'Civi\\' => array($baseDir . '/', $baseDir . '/tests/phpunit'),
+    'Civi' => array($baseDir . '/'),
     'CA_Config' => array($vendorDir . '/totten/ca-config/src'),
 );
diff --git a/vendor/composer/autoload_real.php 
b/vendor/composer/autoload_real.php
index 81ddc32..6fe55cc 100644
--- a/vendor/composer/autoload_real.php
+++ b/vendor/composer/autoload_real.php
@@ -2,7 +2,7 @@
 
 // autoload_real.php @generated by Composer
 
-class ComposerAutoloaderInit63ebf2d83757df13019a964a5b69d9c0
+class ComposerAutoloaderInit3d9ec4fd8df8ee96f040c4494bc97b60
 {
     private static $loader;
 
@@ -19,9 +19,9 @@
             return self::$loader;
         }
 
-        
spl_autoload_register(array('ComposerAutoloaderInit63ebf2d83757df13019a964a5b69d9c0',
 'loadClassLoader'), true, true);
+        
spl_autoload_register(array('ComposerAutoloaderInit3d9ec4fd8df8ee96f040c4494bc97b60',
 'loadClassLoader'), true, true);
         self::$loader = $loader = new \Composer\Autoload\ClassLoader();
-        
spl_autoload_unregister(array('ComposerAutoloaderInit63ebf2d83757df13019a964a5b69d9c0',
 'loadClassLoader'));
+        
spl_autoload_unregister(array('ComposerAutoloaderInit3d9ec4fd8df8ee96f040c4494bc97b60',
 'loadClassLoader'));
 
         $includePaths = require __DIR__ . '/include_paths.php';
         array_push($includePaths, get_include_path());
@@ -46,14 +46,14 @@
 
         $includeFiles = require __DIR__ . '/autoload_files.php';
         foreach ($includeFiles as $file) {
-            composerRequire63ebf2d83757df13019a964a5b69d9c0($file);
+            composerRequire3d9ec4fd8df8ee96f040c4494bc97b60($file);
         }
 
         return $loader;
     }
 }
 
-function composerRequire63ebf2d83757df13019a964a5b69d9c0($file)
+function composerRequire3d9ec4fd8df8ee96f040c4494bc97b60($file)
 {
     require $file;
 }
diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json
index 75aa83e..9bc84f6 100644
--- a/vendor/composer/installed.json
+++ b/vendor/composer/installed.json
@@ -40,6 +40,148 @@
         ]
     },
     {
+        "name": "phpseclib/phpseclib",
+        "version": "0.3.10",
+        "version_normalized": "0.3.10.0",
+        "source": {
+            "type": "git",
+            "url": "https://github.com/phpseclib/phpseclib.git";,
+            "reference": "d15bba1edcc7c89e09cc74c5d961317a8b947bf4"
+        },
+        "dist": {
+            "type": "zip",
+            "url": 
"https://api.github.com/repos/phpseclib/phpseclib/zipball/d15bba1edcc7c89e09cc74c5d961317a8b947bf4";,
+            "reference": "d15bba1edcc7c89e09cc74c5d961317a8b947bf4",
+            "shasum": ""
+        },
+        "require": {
+            "php": ">=5.0.0"
+        },
+        "require-dev": {
+            "phing/phing": "~2.7",
+            "phpunit/phpunit": "~4.0",
+            "sami/sami": "~2.0",
+            "squizlabs/php_codesniffer": "~1.5"
+        },
+        "suggest": {
+            "ext-gmp": "Install the GMP (GNU Multiple Precision) extension in 
order to speed up arbitrary precision integer arithmetic operations.",
+            "ext-mcrypt": "Install the Mcrypt extension in order to speed up a 
wide variety of cryptographic operations.",
+            "pear-pear/PHP_Compat": "Install PHP_Compat to get phpseclib 
working on PHP < 4.3.3."
+        },
+        "time": "2015-01-28 21:50:33",
+        "type": "library",
+        "extra": {
+            "branch-alias": {
+                "dev-master": "0.3-dev"
+            }
+        },
+        "installation-source": "dist",
+        "autoload": {
+            "psr-0": {
+                "Crypt": "phpseclib/",
+                "File": "phpseclib/",
+                "Math": "phpseclib/",
+                "Net": "phpseclib/",
+                "System": "phpseclib/"
+            },
+            "files": [
+                "phpseclib/Crypt/Random.php"
+            ]
+        },
+        "notification-url": "https://packagist.org/downloads/";,
+        "include-path": [
+            "phpseclib/"
+        ],
+        "license": [
+            "MIT"
+        ],
+        "authors": [
+            {
+                "name": "Jim Wigginton",
+                "email": "[email protected]",
+                "role": "Lead Developer"
+            },
+            {
+                "name": "Patrick Monnerat",
+                "email": "[email protected]",
+                "role": "Developer"
+            },
+            {
+                "name": "Andreas Fischer",
+                "email": "[email protected]",
+                "role": "Developer"
+            },
+            {
+                "name": "Hans-Jürgen Petrich",
+                "email": "[email protected]",
+                "role": "Developer"
+            }
+        ],
+        "description": "PHP Secure Communications Library - Pure-PHP 
implementations of RSA, AES, SSH2, SFTP, X.509 etc.",
+        "homepage": "http://phpseclib.sourceforge.net";,
+        "keywords": [
+            "BigInteger",
+            "aes",
+            "asn.1",
+            "asn1",
+            "blowfish",
+            "crypto",
+            "cryptography",
+            "encryption",
+            "rsa",
+            "security",
+            "sftp",
+            "signature",
+            "signing",
+            "ssh",
+            "twofish",
+            "x.509",
+            "x509"
+        ]
+    },
+    {
+        "name": "civicrm/civicrm-cxn-rpc",
+        "version": "v0.15.07.27",
+        "version_normalized": "0.15.07.27",
+        "source": {
+            "type": "git",
+            "url": "https://github.com/civicrm/civicrm-cxn-rpc.git";,
+            "reference": "b6738943aec5b94be5bdc157453142c87851b684"
+        },
+        "dist": {
+            "type": "zip",
+            "url": 
"https://api.github.com/repos/civicrm/civicrm-cxn-rpc/zipball/b6738943aec5b94be5bdc157453142c87851b684";,
+            "reference": "b6738943aec5b94be5bdc157453142c87851b684",
+            "shasum": ""
+        },
+        "require": {
+            "phpseclib/phpseclib": "0.3.*",
+            "psr/log": "1.0.0"
+        },
+        "require-dev": {
+            "phpunit/phpunit": "3.7.*"
+        },
+        "time": "2015-07-28 02:17:20",
+        "type": "library",
+        "installation-source": "dist",
+        "autoload": {
+            "psr-4": {
+                "Civi\\Cxn\\Rpc\\": "src/"
+            }
+        },
+        "notification-url": "https://packagist.org/downloads/";,
+        "license": [
+            "MIT"
+        ],
+        "authors": [
+            {
+                "name": "Tim Otten",
+                "email": "[email protected]"
+            }
+        ],
+        "description": "RPC library for CiviConnect"
+    },
+    {
         "name": "phenx/php-font-lib",
         "version": "0.2.2",
         "version_normalized": "0.2.2.0",
@@ -117,6 +259,45 @@
         ],
         "description": "DOMPDF is a CSS 2.1 compliant HTML to PDF converter",
         "homepage": "https://github.com/dompdf/dompdf";
+    },
+    {
+        "name": "totten/ca-config",
+        "version": "v13.02.0",
+        "version_normalized": "13.02.0.0",
+        "source": {
+            "type": "git",
+            "url": "https://github.com/totten/ca_config.git";,
+            "reference": "7a51033f4e18c1ac846a16c6de16050e735b01cf"
+        },
+        "dist": {
+            "type": "zip",
+            "url": 
"https://api.github.com/repos/totten/ca_config/zipball/7a51033f4e18c1ac846a16c6de16050e735b01cf";,
+            "reference": "7a51033f4e18c1ac846a16c6de16050e735b01cf",
+            "shasum": ""
+        },
+        "require": {
+            "php": ">=5.2"
+        },
+        "time": "2013-02-13 03:40:18",
+        "type": "library",
+        "installation-source": "dist",
+        "autoload": {
+            "psr-0": {
+                "CA_Config": "src/"
+            }
+        },
+        "notification-url": "https://packagist.org/downloads/";,
+        "license": [
+            "BSD-2-Clause"
+        ],
+        "authors": [
+            {
+                "name": "Tim Otten",
+                "email": "[email protected]"
+            }
+        ],
+        "description": "Default configuration for certificate authorities",
+        "homepage": "https://github.com/totten/ca_config";
     },
     {
         "name": "symfony/dependency-injection",
@@ -332,186 +513,5 @@
         ],
         "description": "Symfony Process Component",
         "homepage": "https://symfony.com";
-    },
-    {
-        "name": "totten/ca-config",
-        "version": "v13.02.0",
-        "version_normalized": "13.02.0.0",
-        "source": {
-            "type": "git",
-            "url": "https://github.com/totten/ca_config.git";,
-            "reference": "7a51033f4e18c1ac846a16c6de16050e735b01cf"
-        },
-        "dist": {
-            "type": "zip",
-            "url": 
"https://api.github.com/repos/totten/ca_config/zipball/7a51033f4e18c1ac846a16c6de16050e735b01cf";,
-            "reference": "7a51033f4e18c1ac846a16c6de16050e735b01cf",
-            "shasum": ""
-        },
-        "require": {
-            "php": ">=5.2"
-        },
-        "time": "2013-02-13 03:40:18",
-        "type": "library",
-        "installation-source": "dist",
-        "autoload": {
-            "psr-0": {
-                "CA_Config": "src/"
-            }
-        },
-        "notification-url": "https://packagist.org/downloads/";,
-        "license": [
-            "BSD-2-Clause"
-        ],
-        "authors": [
-            {
-                "name": "Tim Otten",
-                "email": "[email protected]"
-            }
-        ],
-        "description": "Default configuration for certificate authorities",
-        "homepage": "https://github.com/totten/ca_config";
-    },
-    {
-        "name": "phpseclib/phpseclib",
-        "version": "0.3.10",
-        "version_normalized": "0.3.10.0",
-        "source": {
-            "type": "git",
-            "url": "https://github.com/phpseclib/phpseclib.git";,
-            "reference": "d15bba1edcc7c89e09cc74c5d961317a8b947bf4"
-        },
-        "dist": {
-            "type": "zip",
-            "url": 
"https://api.github.com/repos/phpseclib/phpseclib/zipball/d15bba1edcc7c89e09cc74c5d961317a8b947bf4";,
-            "reference": "d15bba1edcc7c89e09cc74c5d961317a8b947bf4",
-            "shasum": ""
-        },
-        "require": {
-            "php": ">=5.0.0"
-        },
-        "require-dev": {
-            "phing/phing": "~2.7",
-            "phpunit/phpunit": "~4.0",
-            "sami/sami": "~2.0",
-            "squizlabs/php_codesniffer": "~1.5"
-        },
-        "suggest": {
-            "ext-gmp": "Install the GMP (GNU Multiple Precision) extension in 
order to speed up arbitrary precision integer arithmetic operations.",
-            "ext-mcrypt": "Install the Mcrypt extension in order to speed up a 
wide variety of cryptographic operations.",
-            "pear-pear/PHP_Compat": "Install PHP_Compat to get phpseclib 
working on PHP < 4.3.3."
-        },
-        "time": "2015-01-28 21:50:33",
-        "type": "library",
-        "extra": {
-            "branch-alias": {
-                "dev-master": "0.3-dev"
-            }
-        },
-        "installation-source": "dist",
-        "autoload": {
-            "psr-0": {
-                "Crypt": "phpseclib/",
-                "File": "phpseclib/",
-                "Math": "phpseclib/",
-                "Net": "phpseclib/",
-                "System": "phpseclib/"
-            },
-            "files": [
-                "phpseclib/Crypt/Random.php"
-            ]
-        },
-        "notification-url": "https://packagist.org/downloads/";,
-        "include-path": [
-            "phpseclib/"
-        ],
-        "license": [
-            "MIT"
-        ],
-        "authors": [
-            {
-                "name": "Jim Wigginton",
-                "email": "[email protected]",
-                "role": "Lead Developer"
-            },
-            {
-                "name": "Patrick Monnerat",
-                "email": "[email protected]",
-                "role": "Developer"
-            },
-            {
-                "name": "Andreas Fischer",
-                "email": "[email protected]",
-                "role": "Developer"
-            },
-            {
-                "name": "Hans-Jürgen Petrich",
-                "email": "[email protected]",
-                "role": "Developer"
-            }
-        ],
-        "description": "PHP Secure Communications Library - Pure-PHP 
implementations of RSA, AES, SSH2, SFTP, X.509 etc.",
-        "homepage": "http://phpseclib.sourceforge.net";,
-        "keywords": [
-            "BigInteger",
-            "aes",
-            "asn.1",
-            "asn1",
-            "blowfish",
-            "crypto",
-            "cryptography",
-            "encryption",
-            "rsa",
-            "security",
-            "sftp",
-            "signature",
-            "signing",
-            "ssh",
-            "twofish",
-            "x.509",
-            "x509"
-        ]
-    },
-    {
-        "name": "civicrm/civicrm-cxn-rpc",
-        "version": "v0.15.07.27",
-        "version_normalized": "0.15.07.27",
-        "source": {
-            "type": "git",
-            "url": "https://github.com/civicrm/civicrm-cxn-rpc.git";,
-            "reference": "b6738943aec5b94be5bdc157453142c87851b684"
-        },
-        "dist": {
-            "type": "zip",
-            "url": 
"https://api.github.com/repos/civicrm/civicrm-cxn-rpc/zipball/b6738943aec5b94be5bdc157453142c87851b684";,
-            "reference": "b6738943aec5b94be5bdc157453142c87851b684",
-            "shasum": ""
-        },
-        "require": {
-            "phpseclib/phpseclib": "0.3.*",
-            "psr/log": "1.0.0"
-        },
-        "require-dev": {
-            "phpunit/phpunit": "3.7.*"
-        },
-        "time": "2015-07-28 02:17:20",
-        "type": "library",
-        "installation-source": "dist",
-        "autoload": {
-            "psr-4": {
-                "Civi\\Cxn\\Rpc\\": "src/"
-            }
-        },
-        "notification-url": "https://packagist.org/downloads/";,
-        "license": [
-            "MIT"
-        ],
-        "authors": [
-            {
-                "name": "Tim Otten",
-                "email": "[email protected]"
-            }
-        ],
-        "description": "RPC library for CiviConnect"
     }
 ]

-- 
To view, visit https://gerrit.wikimedia.org/r/256162
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I7c8c4c5d556b7a1bf820b744f9c0dda4359ab6c8
Gerrit-PatchSet: 3
Gerrit-Project: wikimedia/fundraising/crm/civicrm
Gerrit-Branch: master
Gerrit-Owner: Eileen <[email protected]>
Gerrit-Reviewer: Awight <[email protected]>
Gerrit-Reviewer: Eileen <[email protected]>
Gerrit-Reviewer: Ejegg <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to