summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2017-04-03 14:05:51 +0200
committerRemi Collet <remi@remirepo.net>2017-04-03 14:05:51 +0200
commitf2782e19870911ad2b65f1dffae49897c481bf8f (patch)
treeb173d97815cf62b48c8edf330d0ca27e52123114
parent1e2b3b5b6623656bffb6f3d5bf55c0560bf354d4 (diff)
rewrite autoloadersHEADmaster
-rw-r--r--nextcloud-fedora-autoloader.php119
-rw-r--r--nextcloud.spec40
2 files changed, 86 insertions, 73 deletions
diff --git a/nextcloud-fedora-autoloader.php b/nextcloud-fedora-autoloader.php
index 84f8c1b..a70713d 100644
--- a/nextcloud-fedora-autoloader.php
+++ b/nextcloud-fedora-autoloader.php
@@ -1,68 +1,65 @@
<?php
$vendor = '##DATADIR##/php';
-if (!isset($fedoraClassLoader) || !($fedoraClassLoader instanceof \Symfony\Component\ClassLoader\ClassLoader)) {
- if (!class_exists('Symfony\\Component\\ClassLoader\\ClassLoader', false)) {
- require_once $vendor . '/Symfony/Component/ClassLoader/ClassLoader.php';
- }
-
- $fedoraClassLoader = new \Symfony\Component\ClassLoader\ClassLoader();
- $fedoraClassLoader->register();
-}
+require_once $vendor . '/Fedora/Autoloader/autoload.php';
// For PEAR components
-$fedoraClassLoader->setUseIncludePath(true);
+\Fedora\Autoloader\Autoload::addIncludePath();
// Dependencies from 3rdparty composer.json
-// "guzzlehttp/guzzle"
-require_once $vendor . '/GuzzleHttp/autoload.php';
-// "sabre/dav"
-require_once $vendor . '/Sabre/DAV/autoload.php';
-// "doctrine/dbal"
-require_once $vendor . '/Doctrine/DBAL/autoload.php';
-// mcnetic/zipstreamer"
-require_once $vendor . '/ZipStreamer/autoload.php';
-// "phpeclib/phpseclib"
-require_once $vendor . '/phpseclib/autoload.php';
-// "rackspace/php-opencloud"
-require_once $vendor . '/OpenCloud/autoload.php';
-// "jeremeamia/superclosure"
-require_once $vendor . '/SuperClosure/autoload.php';
-// "bantu/ini-get-wrapper"
-require_once $vendor . '/bantu/IniGetWrapper/IniGetWrapper.php';
-// "natxet/CssMin"
-require_once $vendor . '/natxet/CssMin/autoload.php';
-// "punic/punic"
-require_once $vendor . '/Punic/autoload.php';
-// "patchwork/utf8"
-require_once $vendor . '/Patchwork/autoload.php';
-// "symfony/console"
-require_once $vendor . '/Symfony/Component/Console/autoload.php';
-// "symfony/event-dispatcher"
-require_once $vendor . '/Symfony/Component/EventDispatcher/autoload.php';
-// "symfony/routing"
-require_once $vendor . '/Symfony/Component/Routing/autoload.php';
-// "symfony/process"
-require_once $vendor . '/Symfony/Component/Process/autoload.php';
-// "pimple/pimple"
-require_once $vendor . '/Pimple/autoload.php';
-// "ircmaxell/password-compat"
-require_once $vendor . '/password_compat/password.php';
-// "nikic/php-parser"
-require_once $vendor . '/PhpParser/autoload.php';
-// "icewind/Streams"
-require_once $vendor . '/Icewind/Streams/autoload.php';
-// "swiftmailer/swiftmailer
-require_once $vendor . '/Swift/swift_required.php';
-// "league/flysystem"
-require_once $vendor . '/League/Flysystem/autoload.php';
-// "interfasys/lognormalizer"
-require_once $vendor . '/InterfaSys/LogNormalizer/autoload.php';
-// "deepdiver1975/TarSTreamer"
-require_once $vendor . '/ownCloud/TarStreamer/autoload.php';
-// "patchwork/jsqueeze"
-require_once $vendor . '/Patchwork/JSqueeze.php';
-// "symfony/polyfill-php{55,56,70}"
-require_once $vendor . '/Symfony/Polyfill/autoload.php';
-// "lukasreschke/id3parser": "^0.0.1"
-require_once $vendor . '/ID3Parser/autoload.php';
+\Fedora\Autoloader\Dependencies::required(array(
+ // "guzzlehttp/guzzle"
+ $vendor . '/GuzzleHttp/autoload.php',
+ // To avoid having Aws 3 loaded
+ $vendor . '/Aws/autoload.php',
+ // "sabre/dav"
+ $vendor . '/Sabre/DAV/autoload.php',
+ // "doctrine/dbal"
+ $vendor . '/Doctrine/DBAL/autoload.php',
+ // mcnetic/zipstreamer"
+ $vendor . '/ZipStreamer/autoload.php',
+ // "phpeclib/phpseclib"
+ $vendor . '/phpseclib/autoload.php',
+ // "rackspace/php-opencloud"
+ $vendor . '/OpenCloud/autoload.php',
+ // "jeremeamia/superclosure"
+ $vendor . '/SuperClosure/autoload.php',
+ // "bantu/ini-get-wrapper"
+ $vendor . '/bantu/IniGetWrapper/IniGetWrapper.php',
+ // "natxet/CssMin"
+ $vendor . '/natxet/CssMin/autoload.php',
+ // "punic/punic"
+ $vendor . '/Punic/autoload.php',
+ // "patchwork/utf8"
+ $vendor . '/Patchwork/autoload.php',
+ // "symfony/console"
+ $vendor . '/Symfony/Component/Console/autoload.php',
+ // "symfony/event-dispatcher"
+ $vendor . '/Symfony/Component/EventDispatcher/autoload.php',
+ // "symfony/routing"
+ $vendor . '/Symfony/Component/Routing/autoload.php',
+ // "symfony/process"
+ $vendor . '/Symfony/Component/Process/autoload.php',
+ // "pimple/pimple"
+ $vendor . '/Pimple/autoload.php',
+ // "ircmaxell/password-compat"
+ $vendor . '/password_compat/password.php',
+ // "nikic/php-parser"
+ $vendor . '/PhpParser/autoload.php',
+ // "icewind/Streams"
+ $vendor . '/Icewind/Streams/autoload.php',
+ // "swiftmailer/swiftmailer
+ $vendor . '/Swift/swift_required.php',
+ // "league/flysystem"
+ $vendor . '/League/Flysystem/autoload.php',
+ // "interfasys/lognormalizer"
+ $vendor . '/InterfaSys/LogNormalizer/autoload.php',
+ // "deepdiver1975/TarSTreamer"
+ $vendor . '/ownCloud/TarStreamer/autoload.php',
+ // "patchwork/jsqueeze"
+ $vendor . '/Patchwork/JSqueeze.php',
+ // "symfony/polyfill-php{55,56,70}"
+ $vendor . '/Symfony/Polyfill/autoload.php',
+ // "lukasreschke/id3parser": "^0.0.1"
+ $vendor . '/ID3Parser/autoload.php',
+));
diff --git a/nextcloud.spec b/nextcloud.spec
index 46ad3dd..562d565 100644
--- a/nextcloud.spec
+++ b/nextcloud.spec
@@ -16,7 +16,7 @@
Name: nextcloud
Version: 10.0.4
-Release: 2%{?dist}
+Release: 3%{?dist}
Summary: Private file sync and share server
Group: Applications/Internet
@@ -91,6 +91,8 @@ Requires: crontabs
# expand pear macros on install
BuildRequires: php-pear
+# Use by our autoloader
+BuildRequires: php-composer(fedora/autoloader) >= 1.0.0
# For sanity %%check
BuildRequires: php-cli
BuildRequires: php-composer(sabre/dav) >= 3.0.9
@@ -170,6 +172,8 @@ BuildRequires: php-composer(onelogin/php-saml) < 3.0
Requires: %{name}-webserver = %{version}-%{release}
Requires: %{name}-database = %{version}-%{release}
+# Use by our autoloader
+Requires: php-composer(fedora/autoloader) >= 1.0.0
# Core PHP libs/extensions required by OC core
Requires: php-curl
Requires: php-dom
@@ -592,15 +596,17 @@ rm -r apps/files_external/3rdparty/{icewind,Dropbox,google-api-php-client,aws-sd
# include stuff required directly but not in composer too
cat << 'EOF' | tee apps/files_external/3rdparty/autoload.php
<?php
-require_once '%{_datadir}/php/Icewind/Streams/autoload.php';
-require_once '%{_datadir}/php/Icewind/SMB/autoload.php';
-require_once '%{_datadir}/pear/Dropbox/autoload.php';
-if (file_exists('%{_datadir}/php/Google1/autoload.php')) {
- require_once '%{_datadir}/php/Google1/autoload.php';
-} else {
- require_once '%{_datadir}/php/Google/autoload.php';
-}
-require_once '%{_datadir}/php/Aws/autoload.php';
+require_once '%{_datadir}/php/Fedora/Autoloader/autoload.php';
+\Fedora\Autoloader\Dependencies::required(array(
+ '%{_datadir}/php/Icewind/Streams/autoload.php',
+ '%{_datadir}/php/Icewind/SMB/autoload.php',
+ '%{_datadir}/pear/Dropbox/autoload.php',
+ array(
+ '%{_datadir}/php/Google1/autoload.php',
+ '%{_datadir}/php/Google/autoload.php',
+ ),
+ '%{_datadir}/php/Aws/autoload.php',
+));
EOF
# remove gallery external bundled libraries
@@ -611,7 +617,10 @@ rm apps/gallery/composer.lock
# "symfony/yaml": "_2.6"
cat << 'EOF' | tee apps/gallery/vendor/autoload.php
<?php
-require_once '%{_datadir}/php/Symfony/Component/Yaml/autoload.php';
+require_once '%{_datadir}/php/Fedora/Autoloader/autoload.php';
+\Fedora\Autoloader\Dependencies::required(array(
+ '%{_datadir}/php/Symfony/Component/Yaml/autoload.php',
+));
EOF
# remove user_saml external bundled libraries
@@ -621,7 +630,10 @@ rm apps/user_saml/3rdparty/composer.lock
# create autoloader
cat << 'EOF' | tee apps/user_saml/3rdparty/vendor/autoload.php
<?php
-require_once '%{_datadir}/php/OneLogin/Saml2/autoload.php';
+require_once '%{_datadir}/php/Fedora/Autoloader/autoload.php';
+\Fedora\Autoloader\Dependencies::required(array(
+ '%{_datadir}/php/OneLogin/Saml2/autoload.php',
+));
EOF
# clean up content
@@ -905,6 +917,10 @@ fi
%changelog
+* Mon Apr 3 2017 Remi Collet remi@remirepo.net> - 10.0.4-3
+- ensure aws/php-sdk v2 loaded before v3
+- rewrite autoloader using fedora/autoloader
+
* Mon Apr 3 2017 Remi Collet remi@remirepo.net> - 10.0.4-2
- back to remi's repository