Version Description
= After an upgrade from version 2 =
Please check all settings after the update:
- Dropbox authentication must be done again
- SugarSync authentication must be done again
- S3 Settings
- Google Storage is now in S3
- Check all your passwords
Download this release
Release Info
Developer | danielhuesken |
Plugin | BackWPup – WordPress Backup Plugin |
Version | 3.0.9 |
Comparing to | |
See all releases |
Code changes from version 3.0.8 to 3.0.9
- backwpup.php +7 -6
- css/page_jobs.css +1 -1
- css/page_jobs.dev.css +3 -7
- inc/class-admin.php +87 -32
- inc/class-adminbar.php +2 -1
- inc/class-create-archive.php +1 -1
- inc/class-destination-dropbox.php +10 -13
- inc/class-destination-email.php +11 -16
- inc/class-destination-folder.php +7 -6
- inc/class-destination-ftp.php +8 -8
- inc/class-destination-msazure.php +8 -7
- inc/class-destination-rsc.php +13 -11
- inc/class-destination-s3-v1.php +12 -12
- inc/class-destination-s3.php +14 -14
- inc/class-destination-sugarsync.php +7 -7
- inc/class-help.php +1 -0
- inc/class-install.php +32 -38
- inc/class-job.php +100 -152
- inc/class-jobtype-dbcheck.php +6 -17
- inc/class-jobtype-dbdump.php +10 -26
- inc/class-jobtype-dboptimize.php +7 -19
- inc/class-jobtype-file.php +9 -9
- inc/class-jobtype-wpexp.php +5 -5
- inc/class-jobtype-wpplugin.php +2 -2
- inc/class-mysqldump.php +10 -0
- inc/class-page-backups.php +0 -6
- inc/class-page-backwpup.php +8 -7
- inc/class-page-editjob.php +16 -15
- inc/class-page-jobs.php +38 -15
- inc/class-page-settings.php +17 -16
- inc/class-wp-cli.php +8 -1
- languages/backwpup-de_DE.mo +0 -0
- languages/backwpup-de_DE.po +756 -791
- readme.txt +18 -1
- sdk/Aws/Aws/Common/Aws.php +1 -1
- sdk/Aws/Aws/Common/Client/AbstractClient.php +29 -23
- sdk/Aws/Aws/Common/Client/AwsClientInterface.php +7 -0
- sdk/Aws/Aws/Common/Client/ClientBuilder.php +44 -13
- sdk/Aws/Aws/Common/Client/ThrottlingErrorChecker.php +76 -0
- sdk/Aws/Aws/Common/Client/UploadBodyListener.php +0 -4
- sdk/Aws/Aws/Common/Client/UserAgentListener.php +4 -1
- sdk/Aws/Aws/Common/Enum/ClientOptions.php +5 -0
- sdk/Aws/Aws/Common/Resources/aws-config.php +7 -0
- sdk/Aws/Aws/Glacier/GlacierClient.php +4 -1
- sdk/Aws/Aws/S3/Model/PostObject.php +1 -9
- sdk/Aws/Aws/S3/S3Client.php +17 -2
- sdk/Aws/Aws/S3/StreamWrapper.php +738 -0
- sdk/Aws/Guzzle/Batch/composer.json +1 -1
- sdk/Aws/Guzzle/Cache/composer.json +1 -1
- sdk/Aws/Guzzle/Common/Exception/ExceptionCollection.php +7 -3
- sdk/Aws/Guzzle/Common/Version.php +1 -1
- sdk/Aws/Guzzle/Common/composer.json +1 -1
- sdk/Aws/Guzzle/Http/AbstractEntityBodyDecorator.php +54 -17
- sdk/Aws/Guzzle/Http/CachingEntityBody.php +277 -0
- sdk/Aws/Guzzle/Http/Client.php +68 -16
- sdk/Aws/Guzzle/Http/ClientInterface.php +8 -4
- sdk/Aws/Guzzle/Http/Curl/CurlHandle.php +59 -62
- sdk/Aws/Guzzle/Http/Curl/CurlMulti.php +106 -288
- sdk/Aws/Guzzle/Http/Curl/CurlMultiInterface.php +2 -15
- sdk/Aws/Guzzle/Http/Curl/CurlMultiProxy.php +156 -0
- sdk/Aws/Guzzle/Http/Curl/RequestMediator.php +3 -2
- sdk/Aws/Guzzle/Http/EntityBody.php +5 -7
- sdk/Aws/Guzzle/Http/EntityBodyInterface.php +2 -2
- sdk/Aws/Guzzle/Http/Exception/MultiTransferException.php +12 -0
- sdk/Aws/Guzzle/Http/Message/EntityEnclosingRequest.php +21 -8
- sdk/Aws/Guzzle/Http/Message/EntityEnclosingRequestInterface.php +2 -2
- sdk/Aws/Guzzle/Http/Message/Header.php +5 -14
- sdk/Aws/Guzzle/Http/Message/PostFile.php +21 -5
- sdk/Aws/Guzzle/Http/Message/PostFileInterface.php +2 -2
- sdk/Aws/Guzzle/Http/Message/Request.php +39 -24
- sdk/Aws/Guzzle/Http/Message/RequestFactory.php +53 -29
- sdk/Aws/Guzzle/Http/Message/RequestInterface.php +19 -2
- sdk/Aws/Guzzle/Http/Message/Response.php +6 -7
- sdk/Aws/Guzzle/Http/QueryString.php +7 -2
- sdk/Aws/Guzzle/Http/ReadLimitEntityBody.php +1 -1
- sdk/Aws/Guzzle/Http/RedirectPlugin.php +24 -22
- sdk/Aws/Guzzle/Http/Resources/cacert.pem +48 -2
- sdk/Aws/Guzzle/Http/Resources/cacert.pem.md5 +1 -0
- sdk/Aws/Guzzle/Http/Url.php +46 -35
- sdk/Aws/Guzzle/Http/Utils.php +0 -52
- sdk/Aws/Guzzle/Http/composer.json +1 -1
- sdk/Aws/Guzzle/Inflection/composer.json +1 -1
- sdk/Aws/Guzzle/Iterator/composer.json +1 -1
- sdk/Aws/Guzzle/Log/PsrLogAdapter.php +43 -0
- sdk/Aws/Guzzle/Log/composer.json +1 -1
- sdk/Aws/Guzzle/Parser/composer.json +1 -1
- sdk/Aws/Guzzle/Plugin/Async/AsyncPlugin.php +3 -8
- sdk/Aws/Guzzle/Plugin/Async/composer.json +1 -1
- sdk/Aws/Guzzle/Plugin/Backoff/BackoffPlugin.php +1 -1
- sdk/Aws/Guzzle/Plugin/Backoff/composer.json +1 -1
- sdk/Aws/Guzzle/Plugin/Cache/CachePlugin.php +197 -23
- sdk/Aws/Guzzle/Plugin/Cache/DefaultCacheStorage.php +4 -2
- sdk/Aws/Guzzle/Plugin/Cache/DefaultRevalidation.php +13 -4
- sdk/Aws/Guzzle/Plugin/Cache/composer.json +1 -1
- sdk/Aws/Guzzle/Plugin/Cookie/composer.json +1 -1
- sdk/Aws/Guzzle/Plugin/CurlAuth/composer.json +1 -1
- sdk/Aws/Guzzle/Plugin/ErrorResponse/ErrorResponseExceptionInterface.php +22 -0
- sdk/Aws/Guzzle/Plugin/ErrorResponse/ErrorResponsePlugin.php +74 -0
- sdk/Aws/Guzzle/Plugin/ErrorResponse/Exception/ErrorResponseException.php +7 -0
- sdk/Aws/Guzzle/Plugin/ErrorResponse/composer.json +27 -0
- sdk/Aws/Guzzle/Plugin/History/composer.json +1 -1
- sdk/Aws/Guzzle/Plugin/Log/LogPlugin.php +11 -3
- sdk/Aws/Guzzle/Plugin/Log/composer.json +1 -1
- sdk/Aws/Guzzle/Plugin/Md5/composer.json +1 -1
- sdk/Aws/Guzzle/Plugin/Mock/MockPlugin.php +54 -16
- sdk/Aws/Guzzle/Plugin/Mock/composer.json +1 -1
- sdk/Aws/Guzzle/Plugin/Oauth/OauthPlugin.php +70 -27
- sdk/Aws/Guzzle/Plugin/Oauth/composer.json +1 -1
- sdk/Aws/Guzzle/Plugin/composer.json +2 -1
- sdk/Aws/Guzzle/Service/AbstractConfigLoader.php +45 -18
- sdk/Aws/Guzzle/Service/Builder/ServiceBuilder.php +10 -6
- sdk/Aws/Guzzle/Service/Builder/ServiceBuilderInterface.php +3 -2
- sdk/Aws/Guzzle/Service/Client.php +35 -101
- sdk/Aws/Guzzle/Service/ClientInterface.php +7 -6
- sdk/Aws/Guzzle/Service/Command/AbstractCommand.php +18 -0
- sdk/Aws/Guzzle/Service/Command/DefaultRequestSerializer.php +51 -6
- sdk/Aws/Guzzle/Service/Command/Factory/CompositeFactory.php +5 -9
- sdk/Aws/Guzzle/Service/Command/Factory/ServiceDescriptionFactory.php +7 -3
- sdk/Aws/Guzzle/Service/Command/LocationVisitor/Request/JsonVisitor.php +6 -3
- sdk/Aws/Guzzle/Service/Command/LocationVisitor/Request/XmlVisitor.php +14 -1
- sdk/Aws/Guzzle/Service/Command/LocationVisitor/Response/HeaderVisitor.php +1 -1
- sdk/Aws/Guzzle/Service/Command/LocationVisitor/Response/JsonVisitor.php +7 -2
- sdk/Aws/Guzzle/Service/Command/LocationVisitor/Response/XmlVisitor.php +0 -9
- sdk/Aws/Guzzle/Service/Command/OperationResponseParser.php +53 -10
- sdk/Aws/Guzzle/Service/Command/ResponseClassInterface.php +18 -0
- sdk/Aws/Guzzle/Service/Description/Operation.php +47 -1
- sdk/Aws/Guzzle/Service/Description/Parameter.php +56 -29
- sdk/Aws/Guzzle/Service/Description/SchemaFormatter.php +8 -5
- sdk/Aws/Guzzle/Service/Description/SchemaValidator.php +4 -2
- sdk/Aws/Guzzle/Service/Description/ServiceDescription.php +1 -1
- sdk/Aws/Guzzle/Service/Description/ServiceDescriptionLoader.php +1 -1
- sdk/Aws/Guzzle/Service/Exception/ResponseClassException.php +9 -0
- sdk/Aws/Guzzle/Service/composer.json +1 -1
- sdk/Aws/Guzzle/Stream/PhpStreamRequestFactory.php +259 -0
- sdk/Aws/Guzzle/Stream/Stream.php +73 -13
- sdk/Aws/Guzzle/Stream/StreamInterface.php +42 -2
- sdk/Aws/Guzzle/Stream/StreamRequestFactoryInterface.php +24 -0
- sdk/Aws/Guzzle/Stream/composer.json +4 -1
- sdk/Aws/Symfony/Component/ClassLoader/ApcClassLoader.php +137 -0
- sdk/Aws/Symfony/Component/ClassLoader/ApcUniversalClassLoader.php +100 -0
- sdk/Aws/Symfony/Component/ClassLoader/CHANGELOG.md +15 -0
- sdk/Aws/Symfony/Component/ClassLoader/ClassCollectionLoader.php +367 -0
- sdk/Aws/Symfony/Component/ClassLoader/ClassLoader.php +203 -0
- sdk/Aws/Symfony/Component/ClassLoader/ClassMapGenerator.php +133 -0
- sdk/Aws/Symfony/Component/ClassLoader/DebugClassLoader.php +109 -0
- sdk/Aws/Symfony/Component/ClassLoader/DebugUniversalClassLoader.php +63 -0
- sdk/Aws/Symfony/Component/ClassLoader/LICENSE +19 -0
- sdk/Aws/Symfony/Component/ClassLoader/MapClassLoader.php +76 -0
- sdk/Aws/Symfony/Component/ClassLoader/README.md +69 -0
- sdk/Aws/{symfony/class-loader/Symfony → Symfony}/Component/ClassLoader/UniversalClassLoader.php +4 -0
- sdk/Aws/Symfony/Component/ClassLoader/XcacheClassLoader.php +124 -0
- sdk/Aws/Symfony/Component/ClassLoader/composer.json +34 -0
- sdk/Aws/Symfony/Component/ClassLoader/phpunit.xml.dist +30 -0
- sdk/Aws/Symfony/Component/EventDispatcher/CHANGELOG.md +16 -0
- sdk/Aws/{symfony/event-dispatcher/Symfony → Symfony}/Component/EventDispatcher/ContainerAwareEventDispatcher.php +2 -0
- sdk/Aws/{symfony/event-dispatcher/Symfony → Symfony}/Component/EventDispatcher/Debug/TraceableEventDispatcherInterface.php +0 -0
- sdk/Aws/{symfony/event-dispatcher/Symfony → Symfony}/Component/EventDispatcher/Event.php +3 -3
- sdk/Aws/{symfony/event-dispatcher/Symfony → Symfony}/Component/EventDispatcher/EventDispatcher.php +1 -1
- sdk/Aws/{symfony/event-dispatcher/Symfony → Symfony}/Component/EventDispatcher/EventDispatcherInterface.php +0 -0
- sdk/Aws/{symfony/event-dispatcher/Symfony → Symfony}/Component/EventDispatcher/EventSubscriberInterface.php +0 -0
- sdk/Aws/{symfony/event-dispatcher/Symfony → Symfony}/Component/EventDispatcher/GenericEvent.php +0 -4
- sdk/Aws/{symfony/event-dispatcher/Symfony → Symfony}/Component/EventDispatcher/ImmutableEventDispatcher.php +0 -0
- sdk/Aws/Symfony/Component/EventDispatcher/LICENSE +19 -0
- sdk/Aws/Symfony/Component/EventDispatcher/README.md +25 -0
- sdk/Aws/Symfony/Component/EventDispatcher/composer.json +38 -0
- sdk/Aws/Symfony/Component/EventDispatcher/phpunit.xml.dist +30 -0
- sdk/Aws_v1/lib/cachecore/_sql/README +5 -0
- sdk/Aws_v1/lib/cachecore/_sql/mysql.sql +7 -0
- sdk/Aws_v1/lib/cachecore/_sql/pgsql.sql +6 -0
- sdk/Aws_v1/lib/cachecore/_sql/sqlite3.sql +2 -0
- sdk/Aws_v1/sdk.class.php +2 -2
- sdk/Aws_v1/services/ec2.class.php +6 -6
- sdk/Aws_v1/services/rds.class.php +88 -69
- sdk/Aws_v1/services/s3.class.php +1 -1
- sdk/OpenCloud/Autoload.php +125 -0
- sdk/OpenCloud/{collection.php → OpenCloud/AbstractClass/Collection.php} +15 -19
- sdk/OpenCloud/{nova.php → OpenCloud/AbstractClass/Nova.php} +10 -31
- sdk/OpenCloud/{objstorebase.php → OpenCloud/AbstractClass/ObjectStore.php} +9 -12
- sdk/OpenCloud/{persistentobject.php → OpenCloud/AbstractClass/PersistentObject.php} +53 -54
- sdk/OpenCloud/{service.php → OpenCloud/AbstractClass/Service.php} +31 -26
- sdk/OpenCloud/{base.php → OpenCloud/Base/Base.php} +78 -33
- sdk/OpenCloud/OpenCloud/Base/Debug.php +24 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/AsyncError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/AsyncHttpError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/AsyncTimeoutError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/AttributeError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/AuthenticationError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/CdnError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/CdnHttpError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/CdnNotAvailableError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/CdnTtlError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/CollectionError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/ContainerCreateError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/ContainerDeleteError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/ContainerError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/ContainerNameError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/ContainerNotEmptyError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/ContainerNotFoundError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/CreateError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/CreateUpdateError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/CredentialError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/DatabaseCreateError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/DatabaseDeleteError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/DatabaseListError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/DatabaseNameError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/DatabaseUpdateError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/DeleteError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/DocumentError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/DomainError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/EmptyResponseError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/EndpointError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/FlavorError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/HttpError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/HttpForbiddenError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/HttpOverLimitError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/HttpRetryError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/HttpTimeoutError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/HttpUnauthorizedError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/HttpUrlError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/IOError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/IdRequiredError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/ImageError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/InstanceCreateError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/InstanceDeleteError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/InstanceError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/InstanceFlavorError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/InstanceNotFound.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/InstanceUpdateError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/InvalidArgumentError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/InvalidIdTypeError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/InvalidIpTypeError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/InvalidParameterError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/InvalidRequestError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/JsonError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/MetadataCreateError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/MetadataDeleteError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/MetadataError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/MetadataJsonError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/MetadataKeyError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/MetadataPrefixError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/MetadataUpdateError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/MisMatchedChecksumError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/MissingValueError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/NameError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/NetworkCreateError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/NetworkDeleteError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/NetworkError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/NetworkUpdateError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/NetworkUrlError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/NoContentTypeError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/NoNameError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/ObjFetchError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/ObjectCopyError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/ObjectError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/RecordTypeError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/ServerActionError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/ServerCreateError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/ServerDeleteError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/ServerIpsError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/ServerJsonError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/ServerUpdateError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/ServerUrlError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/ServiceValueError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/SnapshotError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/TempUrlMethodError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/UnknownError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/UnknownParameterError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/UnrecognizedServiceError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/UnsupportedExtensionError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/UnsupportedFeatureExtension.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/UnsupportedVersionError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/UpdateError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/UrlError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/UserCreateError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/UserDeleteError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/UserListError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/UserNameError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/UserUpdateError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/VolumeError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Exceptions/VolumeTypeError.php +5 -0
- sdk/OpenCloud/OpenCloud/Base/Lang.php +20 -0
- sdk/OpenCloud/{metadata.php → OpenCloud/Base/Metadata.php} +2 -4
- sdk/OpenCloud/{http.php → OpenCloud/Base/Request/Curl.php} +25 -178
- sdk/OpenCloud/OpenCloud/Base/Request/HttpRequestInterface.php +17 -0
- sdk/OpenCloud/OpenCloud/Base/Request/Response/Blank.php +20 -0
- sdk/OpenCloud/OpenCloud/Base/Request/Response/Http.php +112 -0
- sdk/OpenCloud/OpenCloud/Base/ServiceCatalogItem.php +12 -0
- sdk/OpenCloud/{flavor.php → OpenCloud/Compute/Flavor.php} +1 -3
- sdk/OpenCloud/{image.php → OpenCloud/Compute/Image.php} +1 -3
- sdk/OpenCloud/{network.php → OpenCloud/Compute/Network.php} +4 -7
- sdk/OpenCloud/{server.php → OpenCloud/Compute/Server.php} +33 -30
- sdk/OpenCloud/{servermetadata.php → OpenCloud/Compute/ServerMetadata.php} +17 -16
- sdk/OpenCloud/{compute.php → OpenCloud/Compute/Service.php} +19 -23
- sdk/OpenCloud/{volumeattachment.php → OpenCloud/Compute/VolumeAttachment.php} +8 -9
- sdk/OpenCloud/{asyncresponse.php → OpenCloud/DNS/AsyncResponse.php} +2 -4
- sdk/OpenCloud/{domain.php → OpenCloud/DNS/Domain.php} +2 -37
- sdk/OpenCloud/{dnsobject.php → OpenCloud/DNS/Object.php} +3 -6
- sdk/OpenCloud/{ptrrecord.php → OpenCloud/DNS/PtrRecord.php} +26 -13
- sdk/OpenCloud/{record.php → OpenCloud/DNS/Record.php} +2 -4
- sdk/OpenCloud/{dns.php → OpenCloud/DNS/Service.php} +14 -37
- sdk/OpenCloud/OpenCloud/DNS/Subdomain.php +35 -0
- sdk/OpenCloud/{database.php → OpenCloud/Database/Database.php} +15 -15
- sdk/OpenCloud/{instance.php → OpenCloud/Database/Instance.php} +25 -27
- sdk/OpenCloud/{dbservice.php → OpenCloud/Database/Service.php} +6 -9
- sdk/OpenCloud/{user.php → OpenCloud/Database/User.php} +14 -14
- sdk/OpenCloud/{globals.php → OpenCloud/Globals.php} +44 -31
- sdk/OpenCloud/OpenCloud/LoadBalancer/Algorithm.php +17 -0
- sdk/OpenCloud/OpenCloud/LoadBalancer/AllowedDomain.php +25 -0
- sdk/OpenCloud/OpenCloud/LoadBalancer/BillableLoadBalancer.php +14 -0
- sdk/OpenCloud/{loadbalancer.php → OpenCloud/LoadBalancer/LoadBalancer.php} +43 -46
- sdk/OpenCloud/OpenCloud/LoadBalancer/Protocol.php +18 -0
- sdk/OpenCloud/OpenCloud/LoadBalancer/Resources/Access.php +21 -0
- sdk/OpenCloud/OpenCloud/LoadBalancer/Resources/ConnectionLogging.php +20 -0
- sdk/OpenCloud/OpenCloud/LoadBalancer/Resources/ConnectionThrottle.php +30 -0
- sdk/OpenCloud/OpenCloud/LoadBalancer/Resources/ContentCaching.php +20 -0
- sdk/OpenCloud/OpenCloud/LoadBalancer/Resources/ErrorPage.php +27 -0
- sdk/OpenCloud/OpenCloud/LoadBalancer/Resources/HealthMonitor.php +42 -0
- sdk/OpenCloud/OpenCloud/LoadBalancer/Resources/Metadata.php +22 -0
- sdk/OpenCloud/OpenCloud/LoadBalancer/Resources/Node.php +100 -0
- sdk/OpenCloud/OpenCloud/LoadBalancer/Resources/NodeEvent.php +28 -0
- sdk/OpenCloud/OpenCloud/LoadBalancer/Resources/Readonly.php +23 -0
- sdk/OpenCloud/OpenCloud/LoadBalancer/Resources/SSLTermination.php +29 -0
- sdk/OpenCloud/OpenCloud/LoadBalancer/Resources/SessionPersistence.php +16 -0
- sdk/OpenCloud/OpenCloud/LoadBalancer/Resources/Stats.php +19 -0
- sdk/OpenCloud/OpenCloud/LoadBalancer/Resources/SubResource.php +112 -0
- sdk/OpenCloud/OpenCloud/LoadBalancer/Resources/Usage.php +27 -0
- sdk/OpenCloud/OpenCloud/LoadBalancer/Resources/VirtualIp.php +26 -0
- sdk/OpenCloud/{lbservice.php → OpenCloud/LoadBalancer/Service.php} +19 -22
- sdk/OpenCloud/OpenCloud/ObjectStore/CDNContainer.php +285 -0
- sdk/OpenCloud/OpenCloud/ObjectStore/Container.php +246 -0
- sdk/OpenCloud/{dataobject.php → OpenCloud/ObjectStore/DataObject.php} +91 -39
- sdk/OpenCloud/OpenCloud/ObjectStore/ObjectStoreBase.php +66 -0
- sdk/OpenCloud/OpenCloud/ObjectStore/ObjectStoreCDN.php +53 -0
- sdk/OpenCloud/OpenCloud/ObjectStore/Service.php +103 -0
- sdk/OpenCloud/OpenCloud/OpenStack.php +744 -0
- sdk/OpenCloud/OpenCloud/Rackspace.php +103 -0
- sdk/OpenCloud/{volumeservice.php → OpenCloud/Volume/Service.php} +10 -15
- sdk/OpenCloud/{snapshot.php → OpenCloud/Volume/Snapshot.php} +4 -7
- sdk/OpenCloud/{volume.php → OpenCloud/Volume/Volume.php} +4 -7
- sdk/OpenCloud/{volumetype.php → OpenCloud/Volume/VolumeType.php} +9 -12
- sdk/OpenCloud/cloud.php +0 -30
- sdk/OpenCloud/container.php +0 -512
- sdk/OpenCloud/exceptions.php +0 -166
- sdk/OpenCloud/lbresources.php +0 -551
- sdk/OpenCloud/objectstore.php +0 -221
- sdk/OpenCloud/openstack.php +2 -753
- sdk/OpenCloud/php-opencloud.php +8 -0
- sdk/OpenCloud/rackspace.php +2 -104
- uninstall.php +18 -0
backwpup.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* Description: WordPress Backup and more...
|
6 |
* Author: Inpsyde GmbH
|
7 |
* Author URI: http://inpsyde.com
|
8 |
-
* Version: 3.0.
|
9 |
* Text Domain: backwpup
|
10 |
* Domain Path: /languages/
|
11 |
* Network: true
|
@@ -79,7 +79,8 @@ if ( ! class_exists( 'BackWPup' ) ) {
|
|
79 |
add_action( 'backwpup_cron', array( 'BackWPup_Cron', 'run' ) );
|
80 |
add_action( 'backwpup_check_cleanup', array( 'BackWPup_Cron', 'check_cleanup' ) );
|
81 |
// add action for doing thinks if cron active
|
82 |
-
|
|
|
83 |
// if in cron the rest must not needed
|
84 |
return;
|
85 |
}
|
@@ -91,7 +92,7 @@ if ( ! class_exists( 'BackWPup' ) ) {
|
|
91 |
if ( get_site_option( 'backwpup_version' ) != self::get_plugin_data( 'Version' ) && class_exists( 'BackWPup_Install' ) )
|
92 |
BackWPup_Install::activate();
|
93 |
//only in backend
|
94 |
-
if ( is_admin() &&
|
95 |
BackWPup_Admin::getInstance();
|
96 |
//work with wp-cli
|
97 |
if ( defined( 'WP_CLI' ) && WP_CLI ) {
|
@@ -243,7 +244,7 @@ if ( ! class_exists( 'BackWPup' ) ) {
|
|
243 |
/**
|
244 |
* Get a array of instances for Backup Destination's
|
245 |
*
|
246 |
-
* @return array
|
247 |
*/
|
248 |
public static function get_destinations() {
|
249 |
|
@@ -284,7 +285,7 @@ if ( ! class_exists( 'BackWPup' ) ) {
|
|
284 |
/**
|
285 |
* Gets a array of instances from Job types
|
286 |
*
|
287 |
-
* @return array
|
288 |
*/
|
289 |
public static function get_job_types() {
|
290 |
|
@@ -314,7 +315,7 @@ if ( ! class_exists( 'BackWPup' ) ) {
|
|
314 |
/**
|
315 |
* Gets a array of instances from Wizards Pro version Only
|
316 |
*
|
317 |
-
* @return array
|
318 |
*/
|
319 |
public static function get_wizards() {
|
320 |
|
5 |
* Description: WordPress Backup and more...
|
6 |
* Author: Inpsyde GmbH
|
7 |
* Author URI: http://inpsyde.com
|
8 |
+
* Version: 3.0.9
|
9 |
* Text Domain: backwpup
|
10 |
* Domain Path: /languages/
|
11 |
* Network: true
|
79 |
add_action( 'backwpup_cron', array( 'BackWPup_Cron', 'run' ) );
|
80 |
add_action( 'backwpup_check_cleanup', array( 'BackWPup_Cron', 'check_cleanup' ) );
|
81 |
// add action for doing thinks if cron active
|
82 |
+
// must done in int before wp-cron control
|
83 |
+
add_action( 'init', array( 'BackWPup_Cron', 'cron_active' ), 1 );
|
84 |
// if in cron the rest must not needed
|
85 |
return;
|
86 |
}
|
92 |
if ( get_site_option( 'backwpup_version' ) != self::get_plugin_data( 'Version' ) && class_exists( 'BackWPup_Install' ) )
|
93 |
BackWPup_Install::activate();
|
94 |
//only in backend
|
95 |
+
if ( is_admin() && class_exists( 'BackWPup_Admin' ) )
|
96 |
BackWPup_Admin::getInstance();
|
97 |
//work with wp-cli
|
98 |
if ( defined( 'WP_CLI' ) && WP_CLI ) {
|
244 |
/**
|
245 |
* Get a array of instances for Backup Destination's
|
246 |
*
|
247 |
+
* @return array BackWPup_Destinations
|
248 |
*/
|
249 |
public static function get_destinations() {
|
250 |
|
285 |
/**
|
286 |
* Gets a array of instances from Job types
|
287 |
*
|
288 |
+
* @return array BackWPup_JobTypes
|
289 |
*/
|
290 |
public static function get_job_types() {
|
291 |
|
315 |
/**
|
316 |
* Gets a array of instances from Wizards Pro version Only
|
317 |
*
|
318 |
+
* @return array BackWPup_Wizards
|
319 |
*/
|
320 |
public static function get_wizards() {
|
321 |
|
css/page_jobs.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.column-id{width:3%;text-align:center}.column-last,.column-next,.column-type,.column-dest{width:15%}#TB_ajaxContent{background-color:black;color:white}#showworking{font-family:Fixedsys,Courier,monospace;line-height:15px;font-size:12px;white-space:pre;display:block;width:100%}#runningjob{padding:10px;background-image:url(../images/progresshg.jpg);position:relative;margin:15px 0 25px 0;padding-bottom:25px}#runniginfos{font-size:14px;font-family:sans-serif,"Arial"}h2#runnigtitle{font-size:18px;margin-bottom:15px;padding:0}#warningsid{margin-right:10px}
|
1 |
+
.column-id{width:3%;text-align:center}.column-last,.column-next,.column-type,.column-dest{width:15%}#TB_ajaxContent{background-color:black;color:white}#showworking{font-family:Fixedsys,Courier,monospace;line-height:15px;font-size:12px;white-space:pre;display:block;width:100%}#runningjob{padding:10px;background-image:url(../images/progresshg.jpg);position:relative;margin:15px 0 25px 0;padding-bottom:25px}#runniginfos{font-size:14px;font-family:sans-serif,"Arial"}h2#runnigtitle{font-size:18px;margin-bottom:15px;padding:0}#warningsid,#errorid{margin-right:10px}.infobuttons{position:absolute;right:10px;bottom:10px}a#showworkingbutton{float:left;padding:10px;font-size:12px;font-family:sans-serif,"Arial";text-decoration:none;background-color:#93b509;color:#fff;border:0}a#abortbutton,a#showworkingclose{float:left;margin-left:10px;padding:10px;font-size:12px;font-family:sans-serif,"Arial";text-decoration:none;background-color:#cd1212;color:#fff;border:0}.progressbar{margin-top:20px;height:auto;background:#f6f6f6 url(../images/progressbarhg.jpg)}#lastmsg,#onstep,#lasterrormsg{text-align:center;margin-bottom:20px}#progressstep{background-color:#1d94cf;color:#fff;padding:5px 0;text-align:center;font-size:14px;font-family:sans-serif,"Arial"}#progresssteps{background-color:#007fb6;color:#fff;padding:5px 0;text-align:center;font-size:14px;font-family:sans-serif,"Arial"}
|
css/page_jobs.dev.css
CHANGED
@@ -35,13 +35,10 @@ h2#runnigtitle {
|
|
35 |
margin-bottom: 15px;
|
36 |
padding: 0;
|
37 |
}
|
38 |
-
#warningsid {
|
39 |
margin-right: 10px;
|
40 |
}
|
41 |
|
42 |
-
#errorid {
|
43 |
-
margin-left: 10px;
|
44 |
-
}
|
45 |
.infobuttons {
|
46 |
position: absolute;
|
47 |
right: 10px;
|
@@ -71,11 +68,10 @@ a#abortbutton, a#showworkingclose {
|
|
71 |
.progressbar {
|
72 |
margin-top: 20px;
|
73 |
height: auto;
|
74 |
-
|
75 |
-
background-image: url(../images/progressbarhg.jpg);
|
76 |
}
|
77 |
|
78 |
-
#lastmsg, #onstep {
|
79 |
text-align: center;
|
80 |
margin-bottom: 20px;
|
81 |
}
|
35 |
margin-bottom: 15px;
|
36 |
padding: 0;
|
37 |
}
|
38 |
+
#warningsid, #errorid {
|
39 |
margin-right: 10px;
|
40 |
}
|
41 |
|
|
|
|
|
|
|
42 |
.infobuttons {
|
43 |
position: absolute;
|
44 |
right: 10px;
|
68 |
.progressbar {
|
69 |
margin-top: 20px;
|
70 |
height: auto;
|
71 |
+
background: #f6f6f6 url(../images/progressbarhg.jpg);
|
|
|
72 |
}
|
73 |
|
74 |
+
#lastmsg, #onstep, #lasterrormsg {
|
75 |
text-align: center;
|
76 |
margin-bottom: 20px;
|
77 |
}
|
inc/class-admin.php
CHANGED
@@ -46,6 +46,13 @@ final class BackWPup_Admin {
|
|
46 |
//Admin Footer Text replacement
|
47 |
add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ), 100 );
|
48 |
add_filter( 'update_footer', array( $this, 'update_footer' ), 100 );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
}
|
50 |
|
51 |
/**
|
@@ -72,8 +79,6 @@ final class BackWPup_Admin {
|
|
72 |
//ajax calls
|
73 |
add_action( 'wp_ajax_backwpup_working', array( 'BackWPup_Page_Jobs', 'ajax_working' ) );
|
74 |
add_action( 'wp_ajax_backwpup_cron_text', array( 'BackWPup_Page_Editjob', 'ajax_cron_text' ) );
|
75 |
-
//ajax handler for jobtypes
|
76 |
-
add_action( 'wp_ajax_backwpup_jobtype', array( $this, 'jobtype_edit_ajax' ) );
|
77 |
//ajax or view logs
|
78 |
add_action( 'wp_ajax_backwpup_view_log', array( 'BackWPup_Page_Logs', 'ajax_view_log' ) );
|
79 |
//ajax calls for job types
|
@@ -232,7 +237,7 @@ final class BackWPup_Admin {
|
|
232 |
*/
|
233 |
public function admin_page_about( $page_hooks ) {
|
234 |
|
235 |
-
$this->page_hooks[ 'backwpupabout' ] = add_submenu_page( 'backwpup', __( 'About', 'backwpup' ), __( 'About', 'backwpup' ), '
|
236 |
add_action( 'load-' . $this->page_hooks[ 'backwpupabout' ], array( 'BackWPup_Admin', 'init_generel' ) );
|
237 |
add_action( 'admin_print_styles-' . $this->page_hooks[ 'backwpupabout' ], array( 'BackWPup_Page_About', 'admin_print_styles' ) );
|
238 |
add_action( 'admin_print_scripts-' . $this->page_hooks[ 'backwpupabout' ], array( 'BackWPup_Page_About', 'admin_print_scripts' ) );
|
@@ -245,13 +250,6 @@ final class BackWPup_Admin {
|
|
245 |
* Load for all BackWPup pages
|
246 |
*/
|
247 |
public static function init_generel() {
|
248 |
-
|
249 |
-
//start using sessions
|
250 |
-
if ( ! session_id() ) {
|
251 |
-
if ( ! is_writeable( session_save_path() ) )
|
252 |
-
session_save_path( BackWPup::get_plugin_data( 'temp' ) );
|
253 |
-
session_start();
|
254 |
-
}
|
255 |
|
256 |
add_thickbox();
|
257 |
|
@@ -277,13 +275,6 @@ final class BackWPup_Admin {
|
|
277 |
*/
|
278 |
public function save_post_form() {
|
279 |
|
280 |
-
//start using sessions
|
281 |
-
if ( ! session_id() ) {
|
282 |
-
if ( ! is_writeable( session_save_path() ) )
|
283 |
-
session_save_path( BackWPup::get_plugin_data( 'temp' ) );
|
284 |
-
session_start();
|
285 |
-
}
|
286 |
-
|
287 |
//Allowed Pages
|
288 |
if ( ! in_array( $_POST[ 'page' ], array ( 'backwpupeditjob', 'backwpupinformation', 'backwpupsettings' ) ) )
|
289 |
wp_die( __( 'Cheating, huh?', 'backwpup' ) );
|
@@ -343,13 +334,15 @@ final class BackWPup_Admin {
|
|
343 |
*/
|
344 |
public static function message( $message ) {
|
345 |
|
346 |
-
|
347 |
-
|
348 |
|
349 |
if ( is_array( $message ) )
|
350 |
-
$
|
351 |
else
|
352 |
-
$
|
|
|
|
|
353 |
|
354 |
}
|
355 |
|
@@ -358,12 +351,9 @@ final class BackWPup_Admin {
|
|
358 |
*
|
359 |
* @return array
|
360 |
*/
|
361 |
-
public static function get_message(
|
362 |
|
363 |
-
|
364 |
-
return array();
|
365 |
-
|
366 |
-
return $_SESSION[ 'backwpup_messages' ];
|
367 |
}
|
368 |
|
369 |
/**
|
@@ -375,21 +365,24 @@ final class BackWPup_Admin {
|
|
375 |
public static function display_messages( $echo = TRUE ) {
|
376 |
|
377 |
$message = '';
|
|
|
378 |
|
379 |
-
if ( ! empty( $
|
380 |
-
foreach( $
|
381 |
$message .= '<p>' . $saved . '</p>';
|
382 |
//clean messages
|
383 |
-
|
384 |
}
|
385 |
|
386 |
if( empty( $message ) )
|
387 |
return '';
|
388 |
|
389 |
-
if ( $echo )
|
390 |
echo '<div id="message" class="updated">' . $message . '</div>';
|
391 |
-
|
|
|
392 |
return '<div id="message" class="updated">' . $message . '</div>';
|
|
|
393 |
}
|
394 |
|
395 |
/**
|
@@ -435,7 +428,69 @@ final class BackWPup_Admin {
|
|
435 |
return;
|
436 |
|
437 |
if ( ! get_site_option( 'backwpup_about_page' ) && ! ( isset( $_REQUEST[ 'page' ] ) && $_REQUEST[ 'page' ] == 'backwpup' ) )
|
438 |
-
echo '<div class="updated"><p>' . str_replace( '\"','"', sprintf( __( 'You have activated or updated BackWPup. Please check <a href="%s">this page</a>.', 'backwpup'), network_admin_url( 'admin.php').'?page=backwpup' ) ) . '</p></div>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
439 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
440 |
}
|
|
|
441 |
}
|
46 |
//Admin Footer Text replacement
|
47 |
add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ), 100 );
|
48 |
add_filter( 'update_footer', array( $this, 'update_footer' ), 100 );
|
49 |
+
//User Profile fields
|
50 |
+
if ( current_user_can( 'administrator' ) || current_user_can( 'backwpup_admin' ) ) {
|
51 |
+
add_action( 'show_user_profile', array( $this, 'user_profile_fields' ) );
|
52 |
+
add_action( 'edit_user_profile', array( $this, 'user_profile_fields' ) );
|
53 |
+
add_action( 'personal_options_update', array( $this, 'save_user_profile_fields' ) );
|
54 |
+
add_action( 'edit_user_profile_update', array( $this, 'save_user_profile_fields' ) );
|
55 |
+
}
|
56 |
}
|
57 |
|
58 |
/**
|
79 |
//ajax calls
|
80 |
add_action( 'wp_ajax_backwpup_working', array( 'BackWPup_Page_Jobs', 'ajax_working' ) );
|
81 |
add_action( 'wp_ajax_backwpup_cron_text', array( 'BackWPup_Page_Editjob', 'ajax_cron_text' ) );
|
|
|
|
|
82 |
//ajax or view logs
|
83 |
add_action( 'wp_ajax_backwpup_view_log', array( 'BackWPup_Page_Logs', 'ajax_view_log' ) );
|
84 |
//ajax calls for job types
|
237 |
*/
|
238 |
public function admin_page_about( $page_hooks ) {
|
239 |
|
240 |
+
$this->page_hooks[ 'backwpupabout' ] = add_submenu_page( 'backwpup', __( 'About', 'backwpup' ), __( 'About', 'backwpup' ), 'administrator', 'backwpupabout', array( 'BackWPup_Page_About', 'page' ) );
|
241 |
add_action( 'load-' . $this->page_hooks[ 'backwpupabout' ], array( 'BackWPup_Admin', 'init_generel' ) );
|
242 |
add_action( 'admin_print_styles-' . $this->page_hooks[ 'backwpupabout' ], array( 'BackWPup_Page_About', 'admin_print_styles' ) );
|
243 |
add_action( 'admin_print_scripts-' . $this->page_hooks[ 'backwpupabout' ], array( 'BackWPup_Page_About', 'admin_print_scripts' ) );
|
250 |
* Load for all BackWPup pages
|
251 |
*/
|
252 |
public static function init_generel() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
253 |
|
254 |
add_thickbox();
|
255 |
|
275 |
*/
|
276 |
public function save_post_form() {
|
277 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
278 |
//Allowed Pages
|
279 |
if ( ! in_array( $_POST[ 'page' ], array ( 'backwpupeditjob', 'backwpupinformation', 'backwpupsettings' ) ) )
|
280 |
wp_die( __( 'Cheating, huh?', 'backwpup' ) );
|
334 |
*/
|
335 |
public static function message( $message ) {
|
336 |
|
337 |
+
|
338 |
+
$saved_message = self::get_message();
|
339 |
|
340 |
if ( is_array( $message ) )
|
341 |
+
$saved_message = array_merge( $saved_message, $message );
|
342 |
else
|
343 |
+
$saved_message[] = $message;
|
344 |
+
|
345 |
+
update_site_option( 'backwpup_messages', $saved_message);
|
346 |
|
347 |
}
|
348 |
|
351 |
*
|
352 |
* @return array
|
353 |
*/
|
354 |
+
public static function get_message() {
|
355 |
|
356 |
+
return get_site_option( 'backwpup_messages', array(), FALSE );
|
|
|
|
|
|
|
357 |
}
|
358 |
|
359 |
/**
|
365 |
public static function display_messages( $echo = TRUE ) {
|
366 |
|
367 |
$message = '';
|
368 |
+
$saved_message = self::get_message();
|
369 |
|
370 |
+
if ( ! empty( $saved_message ) ) {
|
371 |
+
foreach( $saved_message as $saved)
|
372 |
$message .= '<p>' . $saved . '</p>';
|
373 |
//clean messages
|
374 |
+
delete_site_option( 'backwpup_messages' );
|
375 |
}
|
376 |
|
377 |
if( empty( $message ) )
|
378 |
return '';
|
379 |
|
380 |
+
if ( $echo ) {
|
381 |
echo '<div id="message" class="updated">' . $message . '</div>';
|
382 |
+
return '';
|
383 |
+
} else {
|
384 |
return '<div id="message" class="updated">' . $message . '</div>';
|
385 |
+
}
|
386 |
}
|
387 |
|
388 |
/**
|
428 |
return;
|
429 |
|
430 |
if ( ! get_site_option( 'backwpup_about_page' ) && ! ( isset( $_REQUEST[ 'page' ] ) && $_REQUEST[ 'page' ] == 'backwpup' ) )
|
431 |
+
echo '<div class="updated"><p>' . str_replace( '\"','"', sprintf( __( 'You have activated or updated BackWPup. Please check <a href="%s">this page</a>.', 'backwpup'), network_admin_url( 'admin.php') . '?page=backwpup' ) ) . '</p></div>';
|
432 |
+
|
433 |
+
}
|
434 |
+
|
435 |
+
|
436 |
+
/**
|
437 |
+
* Add filed for selecting user role in user section
|
438 |
+
*
|
439 |
+
* @param $user WP_User
|
440 |
+
*/
|
441 |
+
public function user_profile_fields( $user ) {
|
442 |
+
|
443 |
+
?>
|
444 |
+
<h3><?php echo BackWPup::get_plugin_data( 'name' ); ?></h3>
|
445 |
+
<table class="form-table">
|
446 |
+
<tr>
|
447 |
+
<th>
|
448 |
+
<label for="backwpup_role"><?php _e('BackWPup Role', 'backwpup'); ?>
|
449 |
+
</label></th>
|
450 |
+
<td>
|
451 |
+
<select name="backwpup_role" id="backwpup_role">
|
452 |
+
<option value=""><?php _e('None', 'backwpup'); ?></option>
|
453 |
+
<?php
|
454 |
+
$roles = get_editable_roles();
|
455 |
+
foreach ( $roles as $role => $rolevalue ) {
|
456 |
+
if ( ! stristr( $role, 'backwpup' ) )
|
457 |
+
continue;
|
458 |
+
echo '<option value="'.$role.'" '. selected( in_array( $role, $user->roles ), TRUE, FALSE ) .'>'.$rolevalue[ 'name' ] . '</option>';
|
459 |
+
}
|
460 |
+
?>
|
461 |
+
</select>
|
462 |
+
<br />
|
463 |
+
<span class="description"><?php _e('Role that the user have on BackWPup', 'backwpup'); ?></span>
|
464 |
+
</td>
|
465 |
+
</tr>
|
466 |
+
</table>
|
467 |
+
<?php
|
468 |
+
}
|
469 |
|
470 |
+
/**
|
471 |
+
* Save for user role adding
|
472 |
+
*
|
473 |
+
* @param $user_id int
|
474 |
+
* @return bool
|
475 |
+
*/
|
476 |
+
public function save_user_profile_fields( $user_id ) {
|
477 |
+
|
478 |
+
if ( ! ( current_user_can( 'administrator' ) || current_user_can( 'backwpup_admin' ) ) )
|
479 |
+
return FALSE;
|
480 |
+
|
481 |
+
$backwpup_roles = array();
|
482 |
+
$user = new WP_User( $user_id );
|
483 |
+
$roles = array_keys( get_editable_roles() );
|
484 |
+
foreach ( $roles as $role ) {
|
485 |
+
if ( ! stristr( $role, 'backwpup' ) )
|
486 |
+
continue;
|
487 |
+
$user->remove_role( $role );
|
488 |
+
$backwpup_roles[] = $role;
|
489 |
+
}
|
490 |
+
if ( in_array( $_POST['backwpup_role'], $backwpup_roles ) )
|
491 |
+
$user->add_role( $_POST['backwpup_role'] );
|
492 |
+
|
493 |
+
return TRUE;
|
494 |
}
|
495 |
+
|
496 |
}
|
inc/class-adminbar.php
CHANGED
@@ -44,7 +44,8 @@ class BackWPup_Adminbar {
|
|
44 |
*/
|
45 |
public function adminbar() {
|
46 |
global $wp_admin_bar;
|
47 |
-
|
|
|
48 |
$job_object = BackWPup_Job::get_working_data( FALSE );
|
49 |
$menu_title = '<span class="ab-icon"></span><span class="ab-label">' . BackWPup::get_plugin_data( 'name' ) . '</span>';
|
50 |
$menu_herf = network_admin_url( 'admin.php' ) . '?page=backwpup';
|
44 |
*/
|
45 |
public function adminbar() {
|
46 |
global $wp_admin_bar;
|
47 |
+
/* @var WP_Admin_Bar $wp_admin_bar */
|
48 |
+
|
49 |
$job_object = BackWPup_Job::get_working_data( FALSE );
|
50 |
$menu_title = '<span class="ab-icon"></span><span class="ab-label">' . BackWPup::get_plugin_data( 'name' ) . '</span>';
|
51 |
$menu_herf = network_admin_url( 'admin.php' ) . '?page=backwpup';
|
inc/class-create-archive.php
CHANGED
@@ -469,7 +469,7 @@ class BackWPup_Create_Archive {
|
|
469 |
fwrite( $this->filehandel, $header );
|
470 |
}
|
471 |
|
472 |
-
// read/write files in
|
473 |
while ( ! feof( $fd ) ) {
|
474 |
$file_data = fread( $fd, 512 );
|
475 |
if ( strlen( $file_data ) > 0 ) {
|
469 |
fwrite( $this->filehandel, $header );
|
470 |
}
|
471 |
|
472 |
+
// read/write files in 512 bite Blocks
|
473 |
while ( ! feof( $fd ) ) {
|
474 |
$file_data = fread( $fd, 512 );
|
475 |
if ( strlen( $file_data ) > 0 ) {
|
inc/class-destination-dropbox.php
CHANGED
@@ -63,10 +63,10 @@ class BackWPup_Destination_Dropbox extends BackWPup_Destinations {
|
|
63 |
<h3 class="title"><?php _e( 'Login', 'backwpup' ); ?></h3>
|
64 |
<p></p>
|
65 |
<table class="form-table">
|
66 |
-
<tr
|
67 |
<th scope="row"><?php _e( 'Authenticate', 'backwpup' ); ?></th>
|
68 |
<td><?php if ( ! BackWPup_Option::get( $jobid, 'dropboxtoken' ) && ! BackWPup_Option::get( $jobid, 'dropboxsecret' ) && ! isset( $oAuthStuff[ 'oauth_token' ] ) ) { ?>
|
69 |
-
<span style="color:red;"><?php _e( 'Not authenticated!', 'backwpup' ); ?></span> <a href="http://db.tt/
|
70 |
<?php } else { ?>
|
71 |
<span style="color:green;"><?php _e( 'Authenticated!', 'backwpup' ); ?></span><br />
|
72 |
<?php } ?>
|
@@ -80,13 +80,13 @@ class BackWPup_Destination_Dropbox extends BackWPup_Destinations {
|
|
80 |
<h3 class="title"><?php _e( 'Backup settings', 'backwpup' ); ?></h3>
|
81 |
<p></p>
|
82 |
<table class="form-table">
|
83 |
-
<tr
|
84 |
<th scope="row"><label for="iddropboxdir"><?php _e( 'Folder in Dropbox', 'backwpup' ); ?></label></th>
|
85 |
<td>
|
86 |
<input id="iddropboxdir" name="dropboxdir" type="text" value="<?php echo esc_attr( BackWPup_Option::get( $jobid, 'dropboxdir' ) ); ?>" class="regular-text" />
|
87 |
</td>
|
88 |
</tr>
|
89 |
-
<tr
|
90 |
<th scope="row"><?php _e( 'File Deletion', 'backwpup' ); ?></th>
|
91 |
<td>
|
92 |
<?php
|
@@ -489,7 +489,6 @@ final class BackWPup_Destination_Dropbox_API {
|
|
489 |
*/
|
490 |
public function chunked_upload( $file, $path = '', $overwrite = TRUE ) {
|
491 |
|
492 |
-
$temp_file = tmpfile();
|
493 |
$file = str_replace( "\\", "/", $file );
|
494 |
|
495 |
if ( ! is_readable( $file ) or ! is_file( $file ) )
|
@@ -505,9 +504,9 @@ final class BackWPup_Destination_Dropbox_API {
|
|
505 |
fseek( $file_handel, $job_object->steps_data[ $job_object->step_working ][ 'offset' ] );
|
506 |
|
507 |
while ( $data = fread( $file_handel, 4194304 ) ) { //4194304 = 4MB
|
508 |
-
if ( ! $chunk_handle = fopen( 'php://temp/maxmemory:
|
509 |
//fallback if php://temp not working
|
510 |
-
if ( ! $chunk_handle =
|
511 |
throw new BackWPup_Destination_Dropbox_API_Exception( "Can not open temp file for chunked transfer." );
|
512 |
}
|
513 |
fwrite( $chunk_handle, $data );
|
@@ -524,10 +523,6 @@ final class BackWPup_Destination_Dropbox_API {
|
|
524 |
//correct position
|
525 |
fseek( $file_handel, $job_object->steps_data[ $job_object->step_working ][ 'offset' ] );
|
526 |
}
|
527 |
-
|
528 |
-
// delete temp file if existing
|
529 |
-
if ( is_file( $temp_file ) )
|
530 |
-
unlink( $temp_file );
|
531 |
|
532 |
fclose( $file_handel );
|
533 |
$url = self::API_CONTENT_URL . self::API_VERSION_URL . 'commit_chunked_upload/' . $this->root . '/' . $this->encode_path( $path );
|
@@ -538,15 +533,17 @@ final class BackWPup_Destination_Dropbox_API {
|
|
538 |
/**
|
539 |
* @param $path
|
540 |
* @param bool $echo
|
541 |
-
* @return
|
542 |
*/
|
543 |
public function download( $path, $echo = FALSE ) {
|
544 |
|
545 |
$url = self::API_CONTENT_URL . self::API_VERSION_URL . 'files/' . $this->root . '/' . $path;
|
546 |
if ( ! $echo )
|
547 |
return $this->request( $url );
|
548 |
-
else
|
549 |
$this->request( $url, NULL, 'GET', NULL, 0, TRUE );
|
|
|
|
|
550 |
}
|
551 |
|
552 |
/**
|
63 |
<h3 class="title"><?php _e( 'Login', 'backwpup' ); ?></h3>
|
64 |
<p></p>
|
65 |
<table class="form-table">
|
66 |
+
<tr>
|
67 |
<th scope="row"><?php _e( 'Authenticate', 'backwpup' ); ?></th>
|
68 |
<td><?php if ( ! BackWPup_Option::get( $jobid, 'dropboxtoken' ) && ! BackWPup_Option::get( $jobid, 'dropboxsecret' ) && ! isset( $oAuthStuff[ 'oauth_token' ] ) ) { ?>
|
69 |
+
<span style="color:red;"><?php _e( 'Not authenticated!', 'backwpup' ); ?></span> <a href="http://db.tt/8irM1vQ0"><?php _e( 'Create Account', 'backwpup' ); ?></a><br />
|
70 |
<?php } else { ?>
|
71 |
<span style="color:green;"><?php _e( 'Authenticated!', 'backwpup' ); ?></span><br />
|
72 |
<?php } ?>
|
80 |
<h3 class="title"><?php _e( 'Backup settings', 'backwpup' ); ?></h3>
|
81 |
<p></p>
|
82 |
<table class="form-table">
|
83 |
+
<tr>
|
84 |
<th scope="row"><label for="iddropboxdir"><?php _e( 'Folder in Dropbox', 'backwpup' ); ?></label></th>
|
85 |
<td>
|
86 |
<input id="iddropboxdir" name="dropboxdir" type="text" value="<?php echo esc_attr( BackWPup_Option::get( $jobid, 'dropboxdir' ) ); ?>" class="regular-text" />
|
87 |
</td>
|
88 |
</tr>
|
89 |
+
<tr>
|
90 |
<th scope="row"><?php _e( 'File Deletion', 'backwpup' ); ?></th>
|
91 |
<td>
|
92 |
<?php
|
489 |
*/
|
490 |
public function chunked_upload( $file, $path = '', $overwrite = TRUE ) {
|
491 |
|
|
|
492 |
$file = str_replace( "\\", "/", $file );
|
493 |
|
494 |
if ( ! is_readable( $file ) or ! is_file( $file ) )
|
504 |
fseek( $file_handel, $job_object->steps_data[ $job_object->step_working ][ 'offset' ] );
|
505 |
|
506 |
while ( $data = fread( $file_handel, 4194304 ) ) { //4194304 = 4MB
|
507 |
+
if ( ! $chunk_handle = fopen( 'php://temp/maxmemory:4194304', 'r+' ) ) {
|
508 |
//fallback if php://temp not working
|
509 |
+
if ( ! $chunk_handle = tmpfile() )
|
510 |
throw new BackWPup_Destination_Dropbox_API_Exception( "Can not open temp file for chunked transfer." );
|
511 |
}
|
512 |
fwrite( $chunk_handle, $data );
|
523 |
//correct position
|
524 |
fseek( $file_handel, $job_object->steps_data[ $job_object->step_working ][ 'offset' ] );
|
525 |
}
|
|
|
|
|
|
|
|
|
526 |
|
527 |
fclose( $file_handel );
|
528 |
$url = self::API_CONTENT_URL . self::API_VERSION_URL . 'commit_chunked_upload/' . $this->root . '/' . $this->encode_path( $path );
|
533 |
/**
|
534 |
* @param $path
|
535 |
* @param bool $echo
|
536 |
+
* @return string
|
537 |
*/
|
538 |
public function download( $path, $echo = FALSE ) {
|
539 |
|
540 |
$url = self::API_CONTENT_URL . self::API_VERSION_URL . 'files/' . $this->root . '/' . $path;
|
541 |
if ( ! $echo )
|
542 |
return $this->request( $url );
|
543 |
+
else {
|
544 |
$this->request( $url, NULL, 'GET', NULL, 0, TRUE );
|
545 |
+
return '';
|
546 |
+
}
|
547 |
}
|
548 |
|
549 |
/**
|
inc/class-destination-email.php
CHANGED
@@ -54,7 +54,7 @@ class BackWPup_Destination_Email extends BackWPup_Destinations {
|
|
54 |
?>
|
55 |
<h3 class="title"><?php _e( 'E-Mail Address', 'backwpup' ); ?></h3>
|
56 |
<table class="form-table">
|
57 |
-
<tr
|
58 |
<th scope="row"><label for="emailaddress"><?PHP _e( 'E-Mail address', 'backwpup' ); ?></label></th>
|
59 |
<td>
|
60 |
<input name="emailaddress" id="emailaddress" type="text"
|
@@ -62,7 +62,7 @@ class BackWPup_Destination_Email extends BackWPup_Destinations {
|
|
62 |
<?php BackWPup_Help::tip( __('E-Mail address to which Backups are sent.','backwpup') ); ?>
|
63 |
</td>
|
64 |
</tr>
|
65 |
-
<tr
|
66 |
<th scope="row"><label for="sendemailtest"><?PHP _e( 'Send test e-mail', 'backwpup' ); ?></label></th>
|
67 |
<td>
|
68 |
<button id="sendemailtest" class="button secondary"><?PHP _e( 'Send test e-mail', 'backwpup' ); ?></button>
|
@@ -72,13 +72,13 @@ class BackWPup_Destination_Email extends BackWPup_Destinations {
|
|
72 |
|
73 |
<h3 class="title"><?php _e( 'Send e-mail settings', 'backwpup' ); ?></h3>
|
74 |
<table class="form-table">
|
75 |
-
<tr
|
76 |
<th scope="row"><label for="idemailefilesize"><?PHP _e( 'Maximum file size', 'backwpup' ); ?></label></th>
|
77 |
<td><input id="idemailefilesize" name="emailefilesize" type="text" value="<?php echo esc_attr( BackWPup_Option::get( $jobid, 'emailefilesize' ) ); ?>" class="small-text" /><?php _e('MB','backwpup'); ?>
|
78 |
<?php BackWPup_Help::tip( __('Maximum file size to be included in an e-mail. 0 = unlimited','backwpup') ); ?>
|
79 |
</td>
|
80 |
</tr>
|
81 |
-
<tr
|
82 |
<th scope="row"><label for="emailsndemail"><?PHP _e( 'Sender e-mail address', 'backwpup' ); ?></label></th>
|
83 |
<td><input name="emailsndemail" type="text" id="emailsndemail"
|
84 |
value="<?PHP echo esc_attr( BackWPup_Option::get( $jobid, 'emailsndemail' ) );?>"
|
@@ -86,7 +86,7 @@ class BackWPup_Destination_Email extends BackWPup_Destinations {
|
|
86 |
<?php BackWPup_Help::tip( __( 'Sender e-mail address', 'backwpup' ) ); ?>
|
87 |
</td>
|
88 |
</tr>
|
89 |
-
<tr
|
90 |
<th scope="row"><label for="emailsndemailname"><?PHP _e( 'Sender name', 'backwpup' ); ?></label></th>
|
91 |
<td><input name="emailsndemailname" type="text" id="emailsndemailname"
|
92 |
value="<?PHP echo esc_attr( BackWPup_Option::get( $jobid, 'emailsndemailname' ) );?>"
|
@@ -94,7 +94,7 @@ class BackWPup_Destination_Email extends BackWPup_Destinations {
|
|
94 |
<?php BackWPup_Help::tip( __( 'Name of e-mail sender', 'backwpup' ) ); ?>
|
95 |
</td>
|
96 |
</tr>
|
97 |
-
<tr
|
98 |
<th scope="row"><label for="emailmethod"><?PHP _e( 'Sending method', 'backwpup' ); ?></label></th>
|
99 |
<td>
|
100 |
<select id="emailmethod" name="emailmethod">
|
@@ -108,8 +108,7 @@ class BackWPup_Destination_Email extends BackWPup_Destinations {
|
|
108 |
<?php BackWPup_Help::tip( __('- Use site settings: retrieves the e-mail settings of your site. -PHP mail(): needs more PHP memory','backwpup') ); ?>
|
109 |
</td>
|
110 |
</tr>
|
111 |
-
<tr
|
112 |
-
id="emailsendmail" <?PHP if ( BackWPup_Option::get( $jobid, 'emailmethod' ) != 'sendmail' ) echo 'style="display:none;"';?>>
|
113 |
<th scope="row"><label for="emailsendmail"><?PHP _e( 'Sendmail path', 'backwpup' ); ?></label></th>
|
114 |
<td>
|
115 |
<input name="emailsendmail" id="emailsendmail" type="text"
|
@@ -117,8 +116,7 @@ class BackWPup_Destination_Email extends BackWPup_Destinations {
|
|
117 |
class="regular-text code" />
|
118 |
</td>
|
119 |
</tr>
|
120 |
-
<tr
|
121 |
-
class="emailsmtp" <?PHP if ( BackWPup_Option::get( $jobid, 'emailmethod' ) != 'smtp' ) echo 'style="display:none;"';?>>
|
122 |
<th scope="row"><label for="emailhost"><?PHP _e( 'SMTP host name', 'backwpup' ); ?></label></th>
|
123 |
<td>
|
124 |
<input name="emailhost" id="emailhost" type="text"
|
@@ -129,8 +127,7 @@ class BackWPup_Destination_Email extends BackWPup_Destinations {
|
|
129 |
class="small-text code" /></label>
|
130 |
</td>
|
131 |
</tr>
|
132 |
-
<tr
|
133 |
-
class="emailsmtp" <?PHP if ( BackWPup_Option::get( $jobid, 'emailmethod' ) != 'smtp' ) echo 'style="display:none;"';?>>
|
134 |
<th scope="row"><label for="emailsecure"><?PHP _e( 'SMTP secure connection', 'backwpup' ); ?></label>
|
135 |
</th>
|
136 |
<td>
|
@@ -141,16 +138,14 @@ class BackWPup_Destination_Email extends BackWPup_Destinations {
|
|
141 |
</select>
|
142 |
</td>
|
143 |
</tr>
|
144 |
-
<tr
|
145 |
-
class="emailsmtp" <?PHP if ( BackWPup_Option::get( $jobid, 'emailmethod' ) != 'smtp' ) echo 'style="display:none;"';?>>
|
146 |
<th scope="row"><label for="emailuser"><?PHP _e( 'SMTP username', 'backwpup' ); ?></label></th>
|
147 |
<td>
|
148 |
<input name="emailuser" id="emailuser" type="text"
|
149 |
value="<?PHP echo esc_attr( BackWPup_Option::get( $jobid, 'emailuser' ) );?>" class="regular-text" autocomplete="off" />
|
150 |
</td>
|
151 |
</tr>
|
152 |
-
<tr
|
153 |
-
class="emailsmtp" <?PHP if ( BackWPup_Option::get( $jobid, 'emailmethod' ) != 'smtp' ) echo 'style="display:none;"';?>>
|
154 |
<th scope="row"><label for="emailpass"><?PHP _e( 'SMTP password', 'backwpup' ); ?></label></th>
|
155 |
<td>
|
156 |
<input name="emailpass" id="emailpass" type="password"
|
54 |
?>
|
55 |
<h3 class="title"><?php _e( 'E-Mail Address', 'backwpup' ); ?></h3>
|
56 |
<table class="form-table">
|
57 |
+
<tr>
|
58 |
<th scope="row"><label for="emailaddress"><?PHP _e( 'E-Mail address', 'backwpup' ); ?></label></th>
|
59 |
<td>
|
60 |
<input name="emailaddress" id="emailaddress" type="text"
|
62 |
<?php BackWPup_Help::tip( __('E-Mail address to which Backups are sent.','backwpup') ); ?>
|
63 |
</td>
|
64 |
</tr>
|
65 |
+
<tr>
|
66 |
<th scope="row"><label for="sendemailtest"><?PHP _e( 'Send test e-mail', 'backwpup' ); ?></label></th>
|
67 |
<td>
|
68 |
<button id="sendemailtest" class="button secondary"><?PHP _e( 'Send test e-mail', 'backwpup' ); ?></button>
|
72 |
|
73 |
<h3 class="title"><?php _e( 'Send e-mail settings', 'backwpup' ); ?></h3>
|
74 |
<table class="form-table">
|
75 |
+
<tr>
|
76 |
<th scope="row"><label for="idemailefilesize"><?PHP _e( 'Maximum file size', 'backwpup' ); ?></label></th>
|
77 |
<td><input id="idemailefilesize" name="emailefilesize" type="text" value="<?php echo esc_attr( BackWPup_Option::get( $jobid, 'emailefilesize' ) ); ?>" class="small-text" /><?php _e('MB','backwpup'); ?>
|
78 |
<?php BackWPup_Help::tip( __('Maximum file size to be included in an e-mail. 0 = unlimited','backwpup') ); ?>
|
79 |
</td>
|
80 |
</tr>
|
81 |
+
<tr>
|
82 |
<th scope="row"><label for="emailsndemail"><?PHP _e( 'Sender e-mail address', 'backwpup' ); ?></label></th>
|
83 |
<td><input name="emailsndemail" type="text" id="emailsndemail"
|
84 |
value="<?PHP echo esc_attr( BackWPup_Option::get( $jobid, 'emailsndemail' ) );?>"
|
86 |
<?php BackWPup_Help::tip( __( 'Sender e-mail address', 'backwpup' ) ); ?>
|
87 |
</td>
|
88 |
</tr>
|
89 |
+
<tr>
|
90 |
<th scope="row"><label for="emailsndemailname"><?PHP _e( 'Sender name', 'backwpup' ); ?></label></th>
|
91 |
<td><input name="emailsndemailname" type="text" id="emailsndemailname"
|
92 |
value="<?PHP echo esc_attr( BackWPup_Option::get( $jobid, 'emailsndemailname' ) );?>"
|
94 |
<?php BackWPup_Help::tip( __( 'Name of e-mail sender', 'backwpup' ) ); ?>
|
95 |
</td>
|
96 |
</tr>
|
97 |
+
<tr>
|
98 |
<th scope="row"><label for="emailmethod"><?PHP _e( 'Sending method', 'backwpup' ); ?></label></th>
|
99 |
<td>
|
100 |
<select id="emailmethod" name="emailmethod">
|
108 |
<?php BackWPup_Help::tip( __('- Use site settings: retrieves the e-mail settings of your site. -PHP mail(): needs more PHP memory','backwpup') ); ?>
|
109 |
</td>
|
110 |
</tr>
|
111 |
+
<tr id="emailsendmail" <?PHP if ( BackWPup_Option::get( $jobid, 'emailmethod' ) != 'sendmail' ) echo 'style="display:none;"';?>>
|
|
|
112 |
<th scope="row"><label for="emailsendmail"><?PHP _e( 'Sendmail path', 'backwpup' ); ?></label></th>
|
113 |
<td>
|
114 |
<input name="emailsendmail" id="emailsendmail" type="text"
|
116 |
class="regular-text code" />
|
117 |
</td>
|
118 |
</tr>
|
119 |
+
<tr class="emailsmtp" <?PHP if ( BackWPup_Option::get( $jobid, 'emailmethod' ) != 'smtp' ) echo 'style="display:none;"';?>>
|
|
|
120 |
<th scope="row"><label for="emailhost"><?PHP _e( 'SMTP host name', 'backwpup' ); ?></label></th>
|
121 |
<td>
|
122 |
<input name="emailhost" id="emailhost" type="text"
|
127 |
class="small-text code" /></label>
|
128 |
</td>
|
129 |
</tr>
|
130 |
+
<tr class="emailsmtp" <?PHP if ( BackWPup_Option::get( $jobid, 'emailmethod' ) != 'smtp' ) echo 'style="display:none;"';?>>
|
|
|
131 |
<th scope="row"><label for="emailsecure"><?PHP _e( 'SMTP secure connection', 'backwpup' ); ?></label>
|
132 |
</th>
|
133 |
<td>
|
138 |
</select>
|
139 |
</td>
|
140 |
</tr>
|
141 |
+
<tr class="emailsmtp" <?PHP if ( BackWPup_Option::get( $jobid, 'emailmethod' ) != 'smtp' ) echo 'style="display:none;"';?>>
|
|
|
142 |
<th scope="row"><label for="emailuser"><?PHP _e( 'SMTP username', 'backwpup' ); ?></label></th>
|
143 |
<td>
|
144 |
<input name="emailuser" id="emailuser" type="text"
|
145 |
value="<?PHP echo esc_attr( BackWPup_Option::get( $jobid, 'emailuser' ) );?>" class="regular-text" autocomplete="off" />
|
146 |
</td>
|
147 |
</tr>
|
148 |
+
<tr class="emailsmtp" <?PHP if ( BackWPup_Option::get( $jobid, 'emailmethod' ) != 'smtp' ) echo 'style="display:none;"';?>>
|
|
|
149 |
<th scope="row"><label for="emailpass"><?PHP _e( 'SMTP password', 'backwpup' ); ?></label></th>
|
150 |
<td>
|
151 |
<input name="emailpass" id="emailpass" type="password"
|
inc/class-destination-folder.php
CHANGED
@@ -41,13 +41,13 @@ class BackWPup_Destination_Folder extends BackWPup_Destinations {
|
|
41 |
<h3 class="title"><?php _e( 'Backup settings', 'backwpup' ); ?></h3>
|
42 |
<p></p>
|
43 |
<table class="form-table">
|
44 |
-
<tr
|
45 |
<th scope="row"><label for="idbackupdir"><?php _e( 'Folder to store backups in', 'backwpup' ); ?></label></th>
|
46 |
<td>
|
47 |
<input name="backupdir" id="idbackupdir" type="text" value="<?php echo esc_attr( BackWPup_Option::get( $jobid, 'backupdir' ) ); ?>" class="regular-text" />
|
48 |
</td>
|
49 |
</tr>
|
50 |
-
<tr
|
51 |
<th scope="row"><?php _e( 'File Deletion', 'backwpup' ); ?></th>
|
52 |
<td>
|
53 |
<?php
|
@@ -110,13 +110,13 @@ class BackWPup_Destination_Folder extends BackWPup_Destinations {
|
|
110 |
header( "Content-Length: " . filesize( $get_file ) );
|
111 |
@set_time_limit( 0 );
|
112 |
//chunked readfile
|
113 |
-
ob_end_clean();
|
114 |
$handle = fopen( $get_file, 'rb' );
|
115 |
if ( $handle ) {
|
116 |
while ( ! feof( $handle ) ) {
|
117 |
echo fread( $handle, 20482048 ); //2MB chunkes
|
118 |
-
ob_flush();
|
119 |
-
flush();
|
120 |
}
|
121 |
fclose( $handle );
|
122 |
}
|
@@ -151,7 +151,8 @@ class BackWPup_Destination_Folder extends BackWPup_Destinations {
|
|
151 |
$files[ $filecounter ][ 'downloadurl' ] = add_query_arg( array(
|
152 |
'page' => 'backwpupbackups',
|
153 |
'action' => 'downloadfolder',
|
154 |
-
'file' => $backup_folder . $file
|
|
|
155 |
), network_admin_url( 'admin.php' ) );
|
156 |
$files[ $filecounter ][ 'filesize' ] = filesize( $backup_folder . $file );
|
157 |
$files[ $filecounter ][ 'time' ] = filemtime( $backup_folder . $file );
|
41 |
<h3 class="title"><?php _e( 'Backup settings', 'backwpup' ); ?></h3>
|
42 |
<p></p>
|
43 |
<table class="form-table">
|
44 |
+
<tr>
|
45 |
<th scope="row"><label for="idbackupdir"><?php _e( 'Folder to store backups in', 'backwpup' ); ?></label></th>
|
46 |
<td>
|
47 |
<input name="backupdir" id="idbackupdir" type="text" value="<?php echo esc_attr( BackWPup_Option::get( $jobid, 'backupdir' ) ); ?>" class="regular-text" />
|
48 |
</td>
|
49 |
</tr>
|
50 |
+
<tr>
|
51 |
<th scope="row"><?php _e( 'File Deletion', 'backwpup' ); ?></th>
|
52 |
<td>
|
53 |
<?php
|
110 |
header( "Content-Length: " . filesize( $get_file ) );
|
111 |
@set_time_limit( 0 );
|
112 |
//chunked readfile
|
113 |
+
@ob_end_clean();
|
114 |
$handle = fopen( $get_file, 'rb' );
|
115 |
if ( $handle ) {
|
116 |
while ( ! feof( $handle ) ) {
|
117 |
echo fread( $handle, 20482048 ); //2MB chunkes
|
118 |
+
@ob_flush();
|
119 |
+
@flush();
|
120 |
}
|
121 |
fclose( $handle );
|
122 |
}
|
151 |
$files[ $filecounter ][ 'downloadurl' ] = add_query_arg( array(
|
152 |
'page' => 'backwpupbackups',
|
153 |
'action' => 'downloadfolder',
|
154 |
+
'file' => $backup_folder . $file,
|
155 |
+
'jobid' => $jobid
|
156 |
), network_admin_url( 'admin.php' ) );
|
157 |
$files[ $filecounter ][ 'filesize' ] = filesize( $backup_folder . $file );
|
158 |
$files[ $filecounter ][ 'time' ] = filemtime( $backup_folder . $file );
|
inc/class-destination-ftp.php
CHANGED
@@ -38,7 +38,7 @@ class BackWPup_Destination_Ftp extends BackWPup_Destinations {
|
|
38 |
<h3 class="title"><?php _e( 'FTP server and login', 'backwpup' ); ?></h3>
|
39 |
<p></p>
|
40 |
<table class="form-table">
|
41 |
-
<tr
|
42 |
<th scope="row"><label for="idftphost"><?php _e( 'FTP server', 'backwpup' ); ?></label></th>
|
43 |
<td>
|
44 |
<input id="idftphost" name="ftphost" type="text" value="<?php echo esc_attr( BackWPup_Option::get( $jobid, 'ftphost' ) );?>"
|
@@ -48,14 +48,14 @@ class BackWPup_Destination_Ftp extends BackWPup_Destinations {
|
|
48 |
class="small-text" /></label>
|
49 |
</td>
|
50 |
</tr>
|
51 |
-
<tr
|
52 |
<th scope="row"><label for="idftpuser"><?php _e( 'Username', 'backwpup' ); ?></label></th>
|
53 |
<td>
|
54 |
<input id="idftpuser" name="ftpuser" type="text" value="<?php echo esc_attr( BackWPup_Option::get( $jobid, 'ftpuser' ) ); ?>"
|
55 |
class="user regular-text" autocomplete="off" />
|
56 |
</td>
|
57 |
</tr>
|
58 |
-
<tr
|
59 |
<th scope="row"><label for="idftppass"><?php _e( 'Password', 'backwpup' ); ?></label></th>
|
60 |
<td>
|
61 |
<input id="idftppass" name="ftppass" type="password" value="<?php echo esc_attr( BackWPup_Encryption::decrypt(BackWPup_Option::get( $jobid, 'ftppass' ) ) ); ?>"
|
@@ -67,13 +67,13 @@ class BackWPup_Destination_Ftp extends BackWPup_Destinations {
|
|
67 |
<h3 class="title"><?php _e( 'Backup settings', 'backwpup' ); ?></h3>
|
68 |
<p></p>
|
69 |
<table class="form-table">
|
70 |
-
<tr
|
71 |
<th scope="row"><label for="idftpdir"><?php _e( 'Folder to store files in', 'backwpup' ); ?></label></th>
|
72 |
<td>
|
73 |
<input id="idftpdir" name="ftpdir" type="text" value="<?php echo esc_attr( BackWPup_Option::get( $jobid, 'ftpdir' ) ); ?>" class="regular-text" />
|
74 |
</td>
|
75 |
</tr>
|
76 |
-
<tr
|
77 |
<th scope="row"><?php _e( 'File Deletion', 'backwpup' ); ?></th>
|
78 |
<td>
|
79 |
<?php
|
@@ -93,7 +93,7 @@ class BackWPup_Destination_Ftp extends BackWPup_Destinations {
|
|
93 |
<h3 class="title"><?php _e( 'FTP specific settings', 'backwpup' ); ?></h3>
|
94 |
<p></p>
|
95 |
<table class="form-table">
|
96 |
-
<tr
|
97 |
<th scope="row"><label for="idftptimeout"><?php _e( 'Timeout for FTP connection', 'backwpup' ); ?></label></th>
|
98 |
<td>
|
99 |
<input id="idftptimeout" name="ftptimeout" type="text" size="3"
|
@@ -101,7 +101,7 @@ class BackWPup_Destination_Ftp extends BackWPup_Destinations {
|
|
101 |
class="small-text" /> <?php _e( 'seconds', 'backwpup' ); ?>
|
102 |
</td>
|
103 |
</tr>
|
104 |
-
<tr
|
105 |
<th scope="row"><?php _e( 'SSL-FTP connection', 'backwpup' ); ?></th>
|
106 |
<td>
|
107 |
<label for="idftpssl"><input class="checkbox" value="1"
|
@@ -110,7 +110,7 @@ class BackWPup_Destination_Ftp extends BackWPup_Destinations {
|
|
110 |
|
111 |
</td>
|
112 |
</tr>
|
113 |
-
<tr
|
114 |
<th scope="row"><?php _e( 'FTP Passive Mode', 'backwpup' ); ?></th>
|
115 |
<td>
|
116 |
<label for="idftppasv"><input class="checkbox" value="1"
|
38 |
<h3 class="title"><?php _e( 'FTP server and login', 'backwpup' ); ?></h3>
|
39 |
<p></p>
|
40 |
<table class="form-table">
|
41 |
+
<tr>
|
42 |
<th scope="row"><label for="idftphost"><?php _e( 'FTP server', 'backwpup' ); ?></label></th>
|
43 |
<td>
|
44 |
<input id="idftphost" name="ftphost" type="text" value="<?php echo esc_attr( BackWPup_Option::get( $jobid, 'ftphost' ) );?>"
|
48 |
class="small-text" /></label>
|
49 |
</td>
|
50 |
</tr>
|
51 |
+
<tr>
|
52 |
<th scope="row"><label for="idftpuser"><?php _e( 'Username', 'backwpup' ); ?></label></th>
|
53 |
<td>
|
54 |
<input id="idftpuser" name="ftpuser" type="text" value="<?php echo esc_attr( BackWPup_Option::get( $jobid, 'ftpuser' ) ); ?>"
|
55 |
class="user regular-text" autocomplete="off" />
|
56 |
</td>
|
57 |
</tr>
|
58 |
+
<tr>
|
59 |
<th scope="row"><label for="idftppass"><?php _e( 'Password', 'backwpup' ); ?></label></th>
|
60 |
<td>
|
61 |
<input id="idftppass" name="ftppass" type="password" value="<?php echo esc_attr( BackWPup_Encryption::decrypt(BackWPup_Option::get( $jobid, 'ftppass' ) ) ); ?>"
|
67 |
<h3 class="title"><?php _e( 'Backup settings', 'backwpup' ); ?></h3>
|
68 |
<p></p>
|
69 |
<table class="form-table">
|
70 |
+
<tr>
|
71 |
<th scope="row"><label for="idftpdir"><?php _e( 'Folder to store files in', 'backwpup' ); ?></label></th>
|
72 |
<td>
|
73 |
<input id="idftpdir" name="ftpdir" type="text" value="<?php echo esc_attr( BackWPup_Option::get( $jobid, 'ftpdir' ) ); ?>" class="regular-text" />
|
74 |
</td>
|
75 |
</tr>
|
76 |
+
<tr>
|
77 |
<th scope="row"><?php _e( 'File Deletion', 'backwpup' ); ?></th>
|
78 |
<td>
|
79 |
<?php
|
93 |
<h3 class="title"><?php _e( 'FTP specific settings', 'backwpup' ); ?></h3>
|
94 |
<p></p>
|
95 |
<table class="form-table">
|
96 |
+
<tr>
|
97 |
<th scope="row"><label for="idftptimeout"><?php _e( 'Timeout for FTP connection', 'backwpup' ); ?></label></th>
|
98 |
<td>
|
99 |
<input id="idftptimeout" name="ftptimeout" type="text" size="3"
|
101 |
class="small-text" /> <?php _e( 'seconds', 'backwpup' ); ?>
|
102 |
</td>
|
103 |
</tr>
|
104 |
+
<tr>
|
105 |
<th scope="row"><?php _e( 'SSL-FTP connection', 'backwpup' ); ?></th>
|
106 |
<td>
|
107 |
<label for="idftpssl"><input class="checkbox" value="1"
|
110 |
|
111 |
</td>
|
112 |
</tr>
|
113 |
+
<tr>
|
114 |
<th scope="row"><?php _e( 'FTP Passive Mode', 'backwpup' ); ?></th>
|
115 |
<td>
|
116 |
<label for="idftppasv"><input class="checkbox" value="1"
|
inc/class-destination-msazure.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
// Windows Azure SDK v0.3.1_2011-08
|
3 |
// http://www.windowsazure.com/en-us/develop/php/
|
4 |
// https://github.com/WindowsAzure/azure-sdk-for-php
|
5 |
-
include
|
6 |
// Pear libs include
|
7 |
// http://www.pear.com/
|
8 |
set_include_path( get_include_path() . PATH_SEPARATOR . BackWPup::get_plugin_data( 'PluginDir' ) . '/sdk/PEAR/');
|
@@ -44,14 +44,14 @@ class BackWPup_Destination_MSAzure extends BackWPup_Destinations {
|
|
44 |
<h3 class="title"><?php _e( 'MS Azure access keys', 'backwpup' ); ?></h3>
|
45 |
<p></p>
|
46 |
<table class="form-table">
|
47 |
-
<tr
|
48 |
<th scope="row"><label for="msazureaccname"><?php _e( 'Account name', 'backwpup' ); ?></label></th>
|
49 |
<td>
|
50 |
<input id="msazureaccname" name="msazureaccname" type="text"
|
51 |
value="<?php echo esc_attr( BackWPup_Option::get( $jobid, 'msazureaccname' ) );?>" class="regular-text" autocomplete="off" />
|
52 |
</td>
|
53 |
</tr>
|
54 |
-
<tr
|
55 |
<th scope="row"><label for="msazurekey"><?php _e( 'Access key', 'backwpup' ); ?></label></th>
|
56 |
<td>
|
57 |
<input id="msazurekey" name="msazurekey" type="password"
|
@@ -63,7 +63,7 @@ class BackWPup_Destination_MSAzure extends BackWPup_Destinations {
|
|
63 |
<h3 class="title"><?php _e( 'Blob container', 'backwpup' ); ?></h3>
|
64 |
<p></p>
|
65 |
<table class="form-table">
|
66 |
-
<tr
|
67 |
<th scope="row"><label for="msazurecontainerselected"><?php _e( 'Container selection', 'backwpup' ); ?></label></th>
|
68 |
<td>
|
69 |
<input id="msazurecontainerselected" name="msazurecontainerselected" type="hidden" value="<?php echo esc_attr( BackWPup_Option::get( $jobid, 'msazurecontainer' ) );?>" />
|
@@ -75,7 +75,7 @@ class BackWPup_Destination_MSAzure extends BackWPup_Destinations {
|
|
75 |
) ); ?>
|
76 |
</td>
|
77 |
</tr>
|
78 |
-
<tr
|
79 |
<th scope="row"><label for="newmsazurecontainer"><?php _e( 'Create a new container', 'backwpup' ); ?></label></th>
|
80 |
<td>
|
81 |
<input id="newmsazurecontainer" name="newmsazurecontainer" type="text" value="" class="small-text" autocomplete="off" />
|
@@ -86,13 +86,13 @@ class BackWPup_Destination_MSAzure extends BackWPup_Destinations {
|
|
86 |
<h3 class="title"><?php _e( 'Backup settings', 'backwpup' ); ?></h3>
|
87 |
<p></p>
|
88 |
<table class="form-table">
|
89 |
-
<tr
|
90 |
<th scope="row"><label for="idmsazuredir"><?php _e( 'Folder in container', 'backwpup' ); ?></label></th>
|
91 |
<td>
|
92 |
<input id="idmsazuredir" name="msazuredir" type="text" value="<?php echo esc_attr( BackWPup_Option::get( $jobid, 'msazuredir' ) ); ?>" class="regular-text" />
|
93 |
</td>
|
94 |
</tr>
|
95 |
-
<tr
|
96 |
<th scope="row"><?php _e( 'File deletion', 'backwpup' ); ?></th>
|
97 |
<td>
|
98 |
<?php
|
@@ -114,6 +114,7 @@ class BackWPup_Destination_MSAzure extends BackWPup_Destinations {
|
|
114 |
|
115 |
/**
|
116 |
* @param $jobid
|
|
|
117 |
*/
|
118 |
public function edit_form_post_save( $jobid ) {
|
119 |
$message="";
|
2 |
// Windows Azure SDK v0.3.1_2011-08
|
3 |
// http://www.windowsazure.com/en-us/develop/php/
|
4 |
// https://github.com/WindowsAzure/azure-sdk-for-php
|
5 |
+
include __DIR__ . '/../sdk/WindowsAzure/WindowsAzure.php';
|
6 |
// Pear libs include
|
7 |
// http://www.pear.com/
|
8 |
set_include_path( get_include_path() . PATH_SEPARATOR . BackWPup::get_plugin_data( 'PluginDir' ) . '/sdk/PEAR/');
|
44 |
<h3 class="title"><?php _e( 'MS Azure access keys', 'backwpup' ); ?></h3>
|
45 |
<p></p>
|
46 |
<table class="form-table">
|
47 |
+
<tr>
|
48 |
<th scope="row"><label for="msazureaccname"><?php _e( 'Account name', 'backwpup' ); ?></label></th>
|
49 |
<td>
|
50 |
<input id="msazureaccname" name="msazureaccname" type="text"
|
51 |
value="<?php echo esc_attr( BackWPup_Option::get( $jobid, 'msazureaccname' ) );?>" class="regular-text" autocomplete="off" />
|
52 |
</td>
|
53 |
</tr>
|
54 |
+
<tr>
|
55 |
<th scope="row"><label for="msazurekey"><?php _e( 'Access key', 'backwpup' ); ?></label></th>
|
56 |
<td>
|
57 |
<input id="msazurekey" name="msazurekey" type="password"
|
63 |
<h3 class="title"><?php _e( 'Blob container', 'backwpup' ); ?></h3>
|
64 |
<p></p>
|
65 |
<table class="form-table">
|
66 |
+
<tr>
|
67 |
<th scope="row"><label for="msazurecontainerselected"><?php _e( 'Container selection', 'backwpup' ); ?></label></th>
|
68 |
<td>
|
69 |
<input id="msazurecontainerselected" name="msazurecontainerselected" type="hidden" value="<?php echo esc_attr( BackWPup_Option::get( $jobid, 'msazurecontainer' ) );?>" />
|
75 |
) ); ?>
|
76 |
</td>
|
77 |
</tr>
|
78 |
+
<tr>
|
79 |
<th scope="row"><label for="newmsazurecontainer"><?php _e( 'Create a new container', 'backwpup' ); ?></label></th>
|
80 |
<td>
|
81 |
<input id="newmsazurecontainer" name="newmsazurecontainer" type="text" value="" class="small-text" autocomplete="off" />
|
86 |
<h3 class="title"><?php _e( 'Backup settings', 'backwpup' ); ?></h3>
|
87 |
<p></p>
|
88 |
<table class="form-table">
|
89 |
+
<tr>
|
90 |
<th scope="row"><label for="idmsazuredir"><?php _e( 'Folder in container', 'backwpup' ); ?></label></th>
|
91 |
<td>
|
92 |
<input id="idmsazuredir" name="msazuredir" type="text" value="<?php echo esc_attr( BackWPup_Option::get( $jobid, 'msazuredir' ) ); ?>" class="regular-text" />
|
93 |
</td>
|
94 |
</tr>
|
95 |
+
<tr>
|
96 |
<th scope="row"><?php _e( 'File deletion', 'backwpup' ); ?></th>
|
97 |
<td>
|
98 |
<?php
|
114 |
|
115 |
/**
|
116 |
* @param $jobid
|
117 |
+
* @return string
|
118 |
*/
|
119 |
public function edit_form_post_save( $jobid ) {
|
120 |
$message="";
|
inc/class-destination-rsc.php
CHANGED
@@ -1,11 +1,13 @@
|
|
1 |
<?php
|
2 |
-
// Rackspace OpenCloud SDK v1.4
|
3 |
// http://www.rackspace.com/cloud/files/
|
4 |
// https://github.com/rackspace/php-opencloud
|
5 |
if ( ! defined( 'RAXSDK_CACERTPEM' ) )
|
6 |
-
define('RAXSDK_CACERTPEM',
|
|
|
|
|
7 |
if ( ! class_exists( 'Rackspace' ) )
|
8 |
-
require
|
9 |
|
10 |
/**
|
11 |
*
|
@@ -44,14 +46,14 @@ class BackWPup_Destination_RSC extends BackWPup_Destinations {
|
|
44 |
<h3 class="title"><?php _e( 'Rack Space Cloud Keys', 'backwpup' ); ?></h3>
|
45 |
<p></p>
|
46 |
<table class="form-table">
|
47 |
-
<tr
|
48 |
<th scope="row"><label for="rscusername"><?php _e( 'Username', 'backwpup' ); ?></label></th>
|
49 |
<td>
|
50 |
<input id="rscusername" name="rscusername" type="text"
|
51 |
value="<?php echo esc_attr( BackWPup_Option::get( $jobid, 'rscusername' ) );?>" class="regular-text" autocomplete="off" />
|
52 |
</td>
|
53 |
</tr>
|
54 |
-
<tr
|
55 |
<th scope="row"><label for="rscapikey"><?php _e( 'API Key', 'backwpup' ); ?></label></th>
|
56 |
<td>
|
57 |
<input id="rscapikey" name="rscapikey" type="password"
|
@@ -63,7 +65,7 @@ class BackWPup_Destination_RSC extends BackWPup_Destinations {
|
|
63 |
<h3 class="title"><?php _e( 'Select region', 'backwpup' ); ?></h3>
|
64 |
<p></p>
|
65 |
<table class="form-table">
|
66 |
-
<tr
|
67 |
<th scope="row"><label for="rscregion"><?php _e( 'Rackspace Cloud Files Region', 'backwpup' ); ?></label></th>
|
68 |
<td>
|
69 |
<select name="rscregion" id="rscregion" title="<?php _e( 'Rackspace Cloud Files Region', 'backwpup' ); ?>">
|
@@ -72,7 +74,7 @@ class BackWPup_Destination_RSC extends BackWPup_Destinations {
|
|
72 |
</select><br/>
|
73 |
</td>
|
74 |
</tr>
|
75 |
-
<tr
|
76 |
<th scope="row"><label for="rsccontainerselected"><?php _e( 'Container selection', 'backwpup' ); ?></label></th>
|
77 |
<td>
|
78 |
<input id="rsccontainerselected" name="rsccontainerselected" type="hidden" value="<?php echo esc_attr( BackWPup_Option::get( $jobid, 'rsccontainer' ) ); ?>" />
|
@@ -84,7 +86,7 @@ class BackWPup_Destination_RSC extends BackWPup_Destinations {
|
|
84 |
) ); ?>
|
85 |
</td>
|
86 |
</tr>
|
87 |
-
<tr
|
88 |
<th scope="row"><label for="idnewrsccontainer"><?php _e( 'Create a new container', 'backwpup' ); ?></label></th>
|
89 |
<td>
|
90 |
<input id="idnewrsccontainer" name="newrsccontainer" type="text" value="" class="text" />
|
@@ -92,16 +94,16 @@ class BackWPup_Destination_RSC extends BackWPup_Destinations {
|
|
92 |
</tr>
|
93 |
</table>
|
94 |
|
95 |
-
<h3 class="title"><?php _e( '
|
96 |
<p></p>
|
97 |
<table class="form-table">
|
98 |
-
<tr
|
99 |
<th scope="row"><label for="idrscdir"><?php _e( 'Folder in bucket', 'backwpup' ); ?></label></th>
|
100 |
<td>
|
101 |
<input id="idrscdir" name="rscdir" type="text" value="<?php echo esc_attr( BackWPup_Option::get( $jobid, 'rscdir' ) ); ?>" class="regular-text" />
|
102 |
</td>
|
103 |
</tr>
|
104 |
-
<tr
|
105 |
<th scope="row"><?php _e( 'File deletion', 'backwpup' ); ?></th>
|
106 |
<td>
|
107 |
<?php
|
1 |
<?php
|
2 |
+
// Rackspace OpenCloud SDK v1.5.4
|
3 |
// http://www.rackspace.com/cloud/files/
|
4 |
// https://github.com/rackspace/php-opencloud
|
5 |
if ( ! defined( 'RAXSDK_CACERTPEM' ) )
|
6 |
+
define('RAXSDK_CACERTPEM', dirname( __FILE__ ) . '/cacert.pem');
|
7 |
+
if ( ! defined( 'RAXSDK_TIMEOUT' ) )
|
8 |
+
define('RAXSDK_TIMEOUT', 0 ); //todo file uploads times out
|
9 |
if ( ! class_exists( 'Rackspace' ) )
|
10 |
+
require __DIR__ . '/../sdk/OpenCloud/php-opencloud.php';
|
11 |
|
12 |
/**
|
13 |
*
|
46 |
<h3 class="title"><?php _e( 'Rack Space Cloud Keys', 'backwpup' ); ?></h3>
|
47 |
<p></p>
|
48 |
<table class="form-table">
|
49 |
+
<tr>
|
50 |
<th scope="row"><label for="rscusername"><?php _e( 'Username', 'backwpup' ); ?></label></th>
|
51 |
<td>
|
52 |
<input id="rscusername" name="rscusername" type="text"
|
53 |
value="<?php echo esc_attr( BackWPup_Option::get( $jobid, 'rscusername' ) );?>" class="regular-text" autocomplete="off" />
|
54 |
</td>
|
55 |
</tr>
|
56 |
+
<tr>
|
57 |
<th scope="row"><label for="rscapikey"><?php _e( 'API Key', 'backwpup' ); ?></label></th>
|
58 |
<td>
|
59 |
<input id="rscapikey" name="rscapikey" type="password"
|
65 |
<h3 class="title"><?php _e( 'Select region', 'backwpup' ); ?></h3>
|
66 |
<p></p>
|
67 |
<table class="form-table">
|
68 |
+
<tr>
|
69 |
<th scope="row"><label for="rscregion"><?php _e( 'Rackspace Cloud Files Region', 'backwpup' ); ?></label></th>
|
70 |
<td>
|
71 |
<select name="rscregion" id="rscregion" title="<?php _e( 'Rackspace Cloud Files Region', 'backwpup' ); ?>">
|
74 |
</select><br/>
|
75 |
</td>
|
76 |
</tr>
|
77 |
+
<tr>
|
78 |
<th scope="row"><label for="rsccontainerselected"><?php _e( 'Container selection', 'backwpup' ); ?></label></th>
|
79 |
<td>
|
80 |
<input id="rsccontainerselected" name="rsccontainerselected" type="hidden" value="<?php echo esc_attr( BackWPup_Option::get( $jobid, 'rsccontainer' ) ); ?>" />
|
86 |
) ); ?>
|
87 |
</td>
|
88 |
</tr>
|
89 |
+
<tr>
|
90 |
<th scope="row"><label for="idnewrsccontainer"><?php _e( 'Create a new container', 'backwpup' ); ?></label></th>
|
91 |
<td>
|
92 |
<input id="idnewrsccontainer" name="newrsccontainer" type="text" value="" class="text" />
|
94 |
</tr>
|
95 |
</table>
|
96 |
|
97 |
+
<h3 class="title"><?php _e( 'Backup settings', 'backwpup' ); ?></h3>
|
98 |
<p></p>
|
99 |
<table class="form-table">
|
100 |
+
<tr>
|
101 |
<th scope="row"><label for="idrscdir"><?php _e( 'Folder in bucket', 'backwpup' ); ?></label></th>
|
102 |
<td>
|
103 |
<input id="idrscdir" name="rscdir" type="text" value="<?php echo esc_attr( BackWPup_Option::get( $jobid, 'rscdir' ) ); ?>" class="regular-text" />
|
104 |
</td>
|
105 |
</tr>
|
106 |
+
<tr>
|
107 |
<th scope="row"><?php _e( 'File deletion', 'backwpup' ); ?></th>
|
108 |
<td>
|
109 |
<?php
|
inc/class-destination-s3-v1.php
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
<?php
|
2 |
-
// Amazon S3 SDK v1.6.
|
3 |
// http://aws.amazon.com/de/sdkforphp/
|
4 |
// https://github.com/amazonwebservices/aws-sdk-for-php
|
5 |
if ( ! class_exists( 'AmazonS3' ) )
|
6 |
-
include
|
7 |
if ( ! defined( 'E_USER_DEPRECATED') )
|
8 |
define( 'E_USER_DEPRECATED', 16384 );
|
9 |
|
@@ -84,7 +84,7 @@ class BackWPup_Destination_S3_V1 extends BackWPup_Destinations {
|
|
84 |
<h3 class="title"><?php _e( 'S3 Service', 'backwpup' ) ?></h3>
|
85 |
<p></p>
|
86 |
<table class="form-table">
|
87 |
-
<tr
|
88 |
<th scope="row"><label for="s3region"><?php _e( 'Select an S3 service', 'backwpup' ) ?></label></th>
|
89 |
<td>
|
90 |
<select name="s3region" id="s3region" title="<?php _e( 'Amazon S3 Region', 'backwpup' ); ?>">
|
@@ -102,7 +102,7 @@ class BackWPup_Destination_S3_V1 extends BackWPup_Destinations {
|
|
102 |
</select>
|
103 |
</td>
|
104 |
</tr>
|
105 |
-
<tr
|
106 |
<th scope="row"><label for="s3base_url"><?php _e( 'Or an S3 Server URL', 'backwpup' ) ?></label></th>
|
107 |
<td>
|
108 |
<input id="s3base_url" name="s3base_url" type="text" value="<?php echo esc_attr( BackWPup_Option::get( $jobid, 's3base_url' ) );?>" class="regular-text" autocomplete="off" />
|
@@ -113,14 +113,14 @@ class BackWPup_Destination_S3_V1 extends BackWPup_Destinations {
|
|
113 |
<h3 class="title"><?php _e( 'S3 Access Keys', 'backwpup' ); ?></h3>
|
114 |
<p></p>
|
115 |
<table class="form-table">
|
116 |
-
<tr
|
117 |
<th scope="row"><label for="s3accesskey"><?php _e( 'Access Key', 'backwpup' ); ?></label></th>
|
118 |
<td>
|
119 |
<input id="s3accesskey" name="s3accesskey" type="text"
|
120 |
value="<?php echo esc_attr( BackWPup_Option::get( $jobid, 's3accesskey' ) );?>" class="regular-text" autocomplete="off" />
|
121 |
</td>
|
122 |
</tr>
|
123 |
-
<tr
|
124 |
<th scope="row"><label for="s3secretkey"><?php _e( 'Secret Key', 'backwpup' ); ?></label></th>
|
125 |
<td>
|
126 |
<input id="s3secretkey" name="s3secretkey" type="password"
|
@@ -132,7 +132,7 @@ class BackWPup_Destination_S3_V1 extends BackWPup_Destinations {
|
|
132 |
<h3 class="title"><?php _e( 'S3 Bucket', 'backwpup' ); ?></h3>
|
133 |
<p></p>
|
134 |
<table class="form-table">
|
135 |
-
<tr
|
136 |
<th scope="row"><label for="s3bucketselected"><?php _e( 'Bucket selection', 'backwpup' ); ?></label></th>
|
137 |
<td>
|
138 |
<input id="s3bucketselected" name="s3bucketselected" type="hidden" value="<?php echo esc_attr( BackWPup_Option::get( $jobid, 's3bucket' ) ); ?>" />
|
@@ -145,7 +145,7 @@ class BackWPup_Destination_S3_V1 extends BackWPup_Destinations {
|
|
145 |
) ); ?>
|
146 |
</td>
|
147 |
</tr>
|
148 |
-
<tr
|
149 |
<th scope="row"><label for="s3newbucket"><?php _e( 'Create a new bucket', 'backwpup' ); ?></label></th>
|
150 |
<td>
|
151 |
<input id="s3newbucket" name="s3newbucket" type="text" value="" class="small-text" autocomplete="off" />
|
@@ -156,13 +156,13 @@ class BackWPup_Destination_S3_V1 extends BackWPup_Destinations {
|
|
156 |
<h3 class="title"><?php _e( 'S3 Backup settings', 'backwpup' ); ?></h3>
|
157 |
<p></p>
|
158 |
<table class="form-table">
|
159 |
-
<tr
|
160 |
<th scope="row"><label for="ids3dir"><?php _e( 'Folder in bucket', 'backwpup' ); ?></label></th>
|
161 |
<td>
|
162 |
<input id="ids3dir" name="s3dir" type="text" value="<?php echo esc_attr( BackWPup_Option::get( $jobid, 's3dir' ) ); ?>" class="regular-text" />
|
163 |
</td>
|
164 |
</tr>
|
165 |
-
<tr
|
166 |
<th scope="row"><?php _e( 'File deletion', 'backwpup' ); ?></th>
|
167 |
<td>
|
168 |
<?php
|
@@ -182,7 +182,7 @@ class BackWPup_Destination_S3_V1 extends BackWPup_Destinations {
|
|
182 |
<h3 class="title"><?php _e( 'Amazon specific settings', 'backwpup' ); ?></h3>
|
183 |
<p></p>
|
184 |
<table class="form-table">
|
185 |
-
<tr
|
186 |
<th scope="row"><label for="ids3storageclass"><?php _e( 'Amazon: Storage Class', 'backwpup' ); ?></label></th>
|
187 |
<td>
|
188 |
<select name="s3storageclass" id="ids3storageclass" title="<?php _e( 'Amazon: Storage Class', 'backwpup' ); ?>">
|
@@ -191,7 +191,7 @@ class BackWPup_Destination_S3_V1 extends BackWPup_Destinations {
|
|
191 |
</select>
|
192 |
</td>
|
193 |
</tr>
|
194 |
-
<tr
|
195 |
<th scope="row"><label for="ids3ssencrypt"><?php _e( 'Server side encryption', 'backwpup' ); ?></label></th>
|
196 |
<td>
|
197 |
<input class="checkbox" value="AES256"
|
1 |
<?php
|
2 |
+
// Amazon S3 SDK v1.6.2
|
3 |
// http://aws.amazon.com/de/sdkforphp/
|
4 |
// https://github.com/amazonwebservices/aws-sdk-for-php
|
5 |
if ( ! class_exists( 'AmazonS3' ) )
|
6 |
+
include dirname( __FILE__ ) . '/../sdk/Aws_v1/sdk.class.php';
|
7 |
if ( ! defined( 'E_USER_DEPRECATED') )
|
8 |
define( 'E_USER_DEPRECATED', 16384 );
|
9 |
|
84 |
<h3 class="title"><?php _e( 'S3 Service', 'backwpup' ) ?></h3>
|
85 |
<p></p>
|
86 |
<table class="form-table">
|
87 |
+
<tr>
|
88 |
<th scope="row"><label for="s3region"><?php _e( 'Select an S3 service', 'backwpup' ) ?></label></th>
|
89 |
<td>
|
90 |
<select name="s3region" id="s3region" title="<?php _e( 'Amazon S3 Region', 'backwpup' ); ?>">
|
102 |
</select>
|
103 |
</td>
|
104 |
</tr>
|
105 |
+
<tr>
|
106 |
<th scope="row"><label for="s3base_url"><?php _e( 'Or an S3 Server URL', 'backwpup' ) ?></label></th>
|
107 |
<td>
|
108 |
<input id="s3base_url" name="s3base_url" type="text" value="<?php echo esc_attr( BackWPup_Option::get( $jobid, 's3base_url' ) );?>" class="regular-text" autocomplete="off" />
|
113 |
<h3 class="title"><?php _e( 'S3 Access Keys', 'backwpup' ); ?></h3>
|
114 |
<p></p>
|
115 |
<table class="form-table">
|
116 |
+
<tr>
|
117 |
<th scope="row"><label for="s3accesskey"><?php _e( 'Access Key', 'backwpup' ); ?></label></th>
|
118 |
<td>
|
119 |
<input id="s3accesskey" name="s3accesskey" type="text"
|
120 |
value="<?php echo esc_attr( BackWPup_Option::get( $jobid, 's3accesskey' ) );?>" class="regular-text" autocomplete="off" />
|
121 |
</td>
|
122 |
</tr>
|
123 |
+
<tr>
|
124 |
<th scope="row"><label for="s3secretkey"><?php _e( 'Secret Key', 'backwpup' ); ?></label></th>
|
125 |
<td>
|
126 |
<input id="s3secretkey" name="s3secretkey" type="password"
|
132 |
<h3 class="title"><?php _e( 'S3 Bucket', 'backwpup' ); ?></h3>
|
133 |
<p></p>
|
134 |
<table class="form-table">
|
135 |
+
<tr>
|
136 |
<th scope="row"><label for="s3bucketselected"><?php _e( 'Bucket selection', 'backwpup' ); ?></label></th>
|
137 |
<td>
|
138 |
<input id="s3bucketselected" name="s3bucketselected" type="hidden" value="<?php echo esc_attr( BackWPup_Option::get( $jobid, 's3bucket' ) ); ?>" />
|
145 |
) ); ?>
|
146 |
</td>
|
147 |
</tr>
|
148 |
+
<tr>
|
149 |
<th scope="row"><label for="s3newbucket"><?php _e( 'Create a new bucket', 'backwpup' ); ?></label></th>
|
150 |
<td>
|
151 |
<input id="s3newbucket" name="s3newbucket" type="text" value="" class="small-text" autocomplete="off" />
|
156 |
<h3 class="title"><?php _e( 'S3 Backup settings', 'backwpup' ); ?></h3>
|
157 |
<p></p>
|
158 |
<table class="form-table">
|
159 |
+
<tr>
|
160 |
<th scope="row"><label for="ids3dir"><?php _e( 'Folder in bucket', 'backwpup' ); ?></label></th>
|
161 |
<td>
|
162 |
<input id="ids3dir" name="s3dir" type="text" value="<?php echo esc_attr( BackWPup_Option::get( $jobid, 's3dir' ) ); ?>" class="regular-text" />
|
163 |
</td>
|
164 |
</tr>
|
165 |
+
<tr>
|
166 |
<th scope="row"><?php _e( 'File deletion', 'backwpup' ); ?></th>
|
167 |
<td>
|
168 |
<?php
|
182 |
<h3 class="title"><?php _e( 'Amazon specific settings', 'backwpup' ); ?></h3>
|
183 |
<p></p>
|
184 |
<table class="form-table">
|
185 |
+
<tr>
|
186 |
<th scope="row"><label for="ids3storageclass"><?php _e( 'Amazon: Storage Class', 'backwpup' ); ?></label></th>
|
187 |
<td>
|
188 |
<select name="s3storageclass" id="ids3storageclass" title="<?php _e( 'Amazon: Storage Class', 'backwpup' ); ?>">
|
191 |
</select>
|
192 |
</td>
|
193 |
</tr>
|
194 |
+
<tr>
|
195 |
<th scope="row"><label for="ids3ssencrypt"><?php _e( 'Server side encryption', 'backwpup' ); ?></label></th>
|
196 |
<td>
|
197 |
<input class="checkbox" value="AES256"
|
inc/class-destination-s3.php
CHANGED
@@ -1,14 +1,14 @@
|
|
1 |
<?php
|
2 |
-
// Amazon S3 SDK v2.
|
3 |
// http://aws.amazon.com/de/sdkforphp2/
|
4 |
// https://github.com/aws/aws-sdk-php
|
5 |
if ( ! class_exists( 'Symfony\\Component\\ClassLoader\\UniversalClassLoader' ) )
|
6 |
-
include
|
7 |
$classLoader = new Symfony\Component\ClassLoader\UniversalClassLoader();
|
8 |
$classLoader->registerNamespaces( array(
|
9 |
'Aws' => BackWPup::get_plugin_data( 'PluginDir' ) . '/sdk/Aws',
|
10 |
'Guzzle' => BackWPup::get_plugin_data( 'PluginDir' ) . '/sdk/Aws',
|
11 |
-
'Symfony\\Component\\EventDispatcher' => BackWPup::get_plugin_data( 'PluginDir' ) . '/sdk/Aws
|
12 |
));
|
13 |
$classLoader->register();
|
14 |
|
@@ -89,7 +89,7 @@ class BackWPup_Destination_S3 extends BackWPup_Destinations {
|
|
89 |
<h3 class="title"><?php _e( 'S3 Service', 'backwpup' ) ?></h3>
|
90 |
<p></p>
|
91 |
<table class="form-table">
|
92 |
-
<tr
|
93 |
<th scope="row"><label for="s3region"><?php _e( 'Select an S3 service', 'backwpup' ) ?></label></th>
|
94 |
<td>
|
95 |
<select name="s3region" id="s3region" title="<?php _e( 'Amazon S3 Region', 'backwpup' ); ?>">
|
@@ -107,7 +107,7 @@ class BackWPup_Destination_S3 extends BackWPup_Destinations {
|
|
107 |
</select>
|
108 |
</td>
|
109 |
</tr>
|
110 |
-
<tr
|
111 |
<th scope="row"><label for="s3base_url"><?php _e( 'Or an S3 Server URL', 'backwpup' ) ?></label></th>
|
112 |
<td>
|
113 |
<input id="s3base_url" name="s3base_url" type="text" value="<?php echo esc_attr( BackWPup_Option::get( $jobid, 's3base_url' ) );?>" class="regular-text" autocomplete="off" />
|
@@ -118,14 +118,14 @@ class BackWPup_Destination_S3 extends BackWPup_Destinations {
|
|
118 |
<h3 class="title"><?php _e( 'S3 Access Keys', 'backwpup' ); ?></h3>
|
119 |
<p></p>
|
120 |
<table class="form-table">
|
121 |
-
<tr
|
122 |
<th scope="row"><label for="s3accesskey"><?php _e( 'Access Key', 'backwpup' ); ?></label></th>
|
123 |
<td>
|
124 |
<input id="s3accesskey" name="s3accesskey" type="text"
|
125 |
value="<?php echo esc_attr( BackWPup_Option::get( $jobid, 's3accesskey' ) );?>" class="regular-text" autocomplete="off" />
|
126 |
</td>
|
127 |
</tr>
|
128 |
-
<tr
|
129 |
<th scope="row"><label for="s3secretkey"><?php _e( 'Secret Key', 'backwpup' ); ?></label></th>
|
130 |
<td>
|
131 |
<input id="s3secretkey" name="s3secretkey" type="password"
|
@@ -137,7 +137,7 @@ class BackWPup_Destination_S3 extends BackWPup_Destinations {
|
|
137 |
<h3 class="title"><?php _e( 'S3 Bucket', 'backwpup' ); ?></h3>
|
138 |
<p></p>
|
139 |
<table class="form-table">
|
140 |
-
<tr
|
141 |
<th scope="row"><label for="s3bucketselected"><?php _e( 'Bucket selection', 'backwpup' ); ?></label></th>
|
142 |
<td>
|
143 |
<input id="s3bucketselected" name="s3bucketselected" type="hidden" value="<?php echo esc_attr( BackWPup_Option::get( $jobid, 's3bucket' ) ); ?>" />
|
@@ -150,7 +150,7 @@ class BackWPup_Destination_S3 extends BackWPup_Destinations {
|
|
150 |
) ); ?>
|
151 |
</td>
|
152 |
</tr>
|
153 |
-
<tr
|
154 |
<th scope="row"><label for="s3newbucket"><?php _e( 'Create a new bucket', 'backwpup' ); ?></label></th>
|
155 |
<td>
|
156 |
<input id="s3newbucket" name="s3newbucket" type="text" value="" class="small-text" autocomplete="off" />
|
@@ -161,13 +161,13 @@ class BackWPup_Destination_S3 extends BackWPup_Destinations {
|
|
161 |
<h3 class="title"><?php _e( 'S3 Backup settings', 'backwpup' ); ?></h3>
|
162 |
<p></p>
|
163 |
<table class="form-table">
|
164 |
-
<tr
|
165 |
<th scope="row"><label for="ids3dir"><?php _e( 'Folder in bucket', 'backwpup' ); ?></label></th>
|
166 |
<td>
|
167 |
<input id="ids3dir" name="s3dir" type="text" value="<?php echo esc_attr( BackWPup_Option::get( $jobid, 's3dir' ) ); ?>" class="regular-text" />
|
168 |
</td>
|
169 |
</tr>
|
170 |
-
<tr
|
171 |
<th scope="row"><?php _e( 'File deletion', 'backwpup' ); ?></th>
|
172 |
<td>
|
173 |
<?php
|
@@ -183,7 +183,7 @@ class BackWPup_Destination_S3 extends BackWPup_Destinations {
|
|
183 |
</td>
|
184 |
</tr>
|
185 |
<?php if ( BackWPup_Option::get( $jobid, 'backuptype' ) == 'archive' ) { ?>
|
186 |
-
<tr
|
187 |
<th scope="row"><?php _e( 'Multipart Upload', 'backwpup' ); ?></th>
|
188 |
<td>
|
189 |
<label for="ids3multipart"><input class="checkbox" value="1"
|
@@ -198,7 +198,7 @@ class BackWPup_Destination_S3 extends BackWPup_Destinations {
|
|
198 |
<h3 class="title"><?php _e( 'Amazon specific settings', 'backwpup' ); ?></h3>
|
199 |
<p></p>
|
200 |
<table class="form-table">
|
201 |
-
<tr
|
202 |
<th scope="row"><label for="ids3storageclass"><?php _e( 'Amazon: Storage Class', 'backwpup' ); ?></label></th>
|
203 |
<td>
|
204 |
<select name="s3storageclass" id="ids3storageclass" title="<?php _e( 'Amazon: Storage Class', 'backwpup' ); ?>">
|
@@ -207,7 +207,7 @@ class BackWPup_Destination_S3 extends BackWPup_Destinations {
|
|
207 |
</select>
|
208 |
</td>
|
209 |
</tr>
|
210 |
-
<tr
|
211 |
<th scope="row"><label for="ids3ssencrypt"><?php _e( 'Server side encryption', 'backwpup' ); ?></label></th>
|
212 |
<td>
|
213 |
<input class="checkbox" value="AES256"
|
1 |
<?php
|
2 |
+
// Amazon S3 SDK v2.3.0
|
3 |
// http://aws.amazon.com/de/sdkforphp2/
|
4 |
// https://github.com/aws/aws-sdk-php
|
5 |
if ( ! class_exists( 'Symfony\\Component\\ClassLoader\\UniversalClassLoader' ) )
|
6 |
+
include __DIR__ . '/../sdk/Aws/Symfony/Component/ClassLoader/UniversalClassLoader.php';
|
7 |
$classLoader = new Symfony\Component\ClassLoader\UniversalClassLoader();
|
8 |
$classLoader->registerNamespaces( array(
|
9 |
'Aws' => BackWPup::get_plugin_data( 'PluginDir' ) . '/sdk/Aws',
|
10 |
'Guzzle' => BackWPup::get_plugin_data( 'PluginDir' ) . '/sdk/Aws',
|
11 |
+
'Symfony\\Component\\EventDispatcher' => BackWPup::get_plugin_data( 'PluginDir' ) . '/sdk/Aws'
|
12 |
));
|
13 |
$classLoader->register();
|
14 |
|
89 |
<h3 class="title"><?php _e( 'S3 Service', 'backwpup' ) ?></h3>
|
90 |
<p></p>
|
91 |
<table class="form-table">
|
92 |
+
<tr>
|
93 |
<th scope="row"><label for="s3region"><?php _e( 'Select an S3 service', 'backwpup' ) ?></label></th>
|
94 |
<td>
|
95 |
<select name="s3region" id="s3region" title="<?php _e( 'Amazon S3 Region', 'backwpup' ); ?>">
|
107 |
</select>
|
108 |
</td>
|
109 |
</tr>
|
110 |
+
<tr>
|
111 |
<th scope="row"><label for="s3base_url"><?php _e( 'Or an S3 Server URL', 'backwpup' ) ?></label></th>
|
112 |
<td>
|
113 |
<input id="s3base_url" name="s3base_url" type="text" value="<?php echo esc_attr( BackWPup_Option::get( $jobid, 's3base_url' ) );?>" class="regular-text" autocomplete="off" />
|
118 |
<h3 class="title"><?php _e( 'S3 Access Keys', 'backwpup' ); ?></h3>
|
119 |
<p></p>
|
120 |
<table class="form-table">
|
121 |
+
<tr>
|
122 |
<th scope="row"><label for="s3accesskey"><?php _e( 'Access Key', 'backwpup' ); ?></label></th>
|
123 |
<td>
|
124 |
<input id="s3accesskey" name="s3accesskey" type="text"
|
125 |
value="<?php echo esc_attr( BackWPup_Option::get( $jobid, 's3accesskey' ) );?>" class="regular-text" autocomplete="off" />
|
126 |
</td>
|
127 |
</tr>
|
128 |
+
<tr>
|
129 |
<th scope="row"><label for="s3secretkey"><?php _e( 'Secret Key', 'backwpup' ); ?></label></th>
|
130 |
<td>
|
131 |
<input id="s3secretkey" name="s3secretkey" type="password"
|
137 |
<h3 class="title"><?php _e( 'S3 Bucket', 'backwpup' ); ?></h3>
|
138 |
<p></p>
|
139 |
<table class="form-table">
|
140 |
+
<tr>
|
141 |
<th scope="row"><label for="s3bucketselected"><?php _e( 'Bucket selection', 'backwpup' ); ?></label></th>
|
142 |
<td>
|
143 |
<input id="s3bucketselected" name="s3bucketselected" type="hidden" value="<?php echo esc_attr( BackWPup_Option::get( $jobid, 's3bucket' ) ); ?>" />
|
150 |
) ); ?>
|
151 |
</td>
|
152 |
</tr>
|
153 |
+
<tr>
|
154 |
<th scope="row"><label for="s3newbucket"><?php _e( 'Create a new bucket', 'backwpup' ); ?></label></th>
|
155 |
<td>
|
156 |
<input id="s3newbucket" name="s3newbucket" type="text" value="" class="small-text" autocomplete="off" />
|
161 |
<h3 class="title"><?php _e( 'S3 Backup settings', 'backwpup' ); ?></h3>
|
162 |
<p></p>
|
163 |
<table class="form-table">
|
164 |
+
<tr>
|
165 |
<th scope="row"><label for="ids3dir"><?php _e( 'Folder in bucket', 'backwpup' ); ?></label></th>
|
166 |
<td>
|
167 |
<input id="ids3dir" name="s3dir" type="text" value="<?php echo esc_attr( BackWPup_Option::get( $jobid, 's3dir' ) ); ?>" class="regular-text" />
|
168 |
</td>
|
169 |
</tr>
|
170 |
+
<tr>
|
171 |
<th scope="row"><?php _e( 'File deletion', 'backwpup' ); ?></th>
|
172 |
<td>
|
173 |
<?php
|
183 |
</td>
|
184 |
</tr>
|
185 |
<?php if ( BackWPup_Option::get( $jobid, 'backuptype' ) == 'archive' ) { ?>
|
186 |
+
<tr>
|
187 |
<th scope="row"><?php _e( 'Multipart Upload', 'backwpup' ); ?></th>
|
188 |
<td>
|
189 |
<label for="ids3multipart"><input class="checkbox" value="1"
|
198 |
<h3 class="title"><?php _e( 'Amazon specific settings', 'backwpup' ); ?></h3>
|
199 |
<p></p>
|
200 |
<table class="form-table">
|
201 |
+
<tr>
|
202 |
<th scope="row"><label for="ids3storageclass"><?php _e( 'Amazon: Storage Class', 'backwpup' ); ?></label></th>
|
203 |
<td>
|
204 |
<select name="s3storageclass" id="ids3storageclass" title="<?php _e( 'Amazon: Storage Class', 'backwpup' ); ?>">
|
207 |
</select>
|
208 |
</td>
|
209 |
</tr>
|
210 |
+
<tr>
|
211 |
<th scope="row"><label for="ids3ssencrypt"><?php _e( 'Server side encryption', 'backwpup' ); ?></label></th>
|
212 |
<td>
|
213 |
<input class="checkbox" value="AES256"
|
inc/class-destination-sugarsync.php
CHANGED
@@ -38,7 +38,7 @@ class BackWPup_Destination_SugarSync extends BackWPup_Destinations {
|
|
38 |
<table class="form-table">
|
39 |
|
40 |
<?php if ( ! BackWPup_Option::get( $jobid, 'sugarrefreshtoken' ) ) { ?>
|
41 |
-
<tr
|
42 |
<th scope="row"><?php _e( 'Authentication', 'backwpup' ); ?></th>
|
43 |
<td>
|
44 |
<label for="sugaremail"><?php _e( 'E-Mail address:', 'backwpup' ); ?><br/>
|
@@ -57,7 +57,7 @@ class BackWPup_Destination_SugarSync extends BackWPup_Destinations {
|
|
57 |
</td>
|
58 |
</tr>
|
59 |
<?php } else { ?>
|
60 |
-
<tr
|
61 |
<th scope="row"><label for="idauthbutton"><?php _e( 'Authentication', 'backwpup' ); ?></label></th>
|
62 |
<td>
|
63 |
<span style="color:green;"><?php _e( 'Authenticated!', 'backwpup' ); ?></span>
|
@@ -71,7 +71,7 @@ class BackWPup_Destination_SugarSync extends BackWPup_Destinations {
|
|
71 |
<h3 class="title"><?php _e( 'SugarSync Root', 'backwpup' ); ?></h3>
|
72 |
<p></p>
|
73 |
<table class="form-table">
|
74 |
-
<tr
|
75 |
<th scope="row"><label for="sugarroot"><?php _e( 'Sync folder selection', 'backwpup' ); ?></label></th>
|
76 |
<td>
|
77 |
<?php
|
@@ -100,13 +100,13 @@ class BackWPup_Destination_SugarSync extends BackWPup_Destinations {
|
|
100 |
<h3 class="title"><?php _e( 'Backup settings', 'backwpup' ); ?></h3>
|
101 |
<p></p>
|
102 |
<table class="form-table">
|
103 |
-
<tr
|
104 |
<th scope="row"><label for="idsugardir"><?php _e( 'Folder in root', 'backwpup' ); ?></label></th>
|
105 |
<td>
|
106 |
<input id="idsugardir" name="sugardir" type="text" value="<?php echo BackWPup_Option::get( $jobid, 'sugardir' ); ?>" class="regular-text" />
|
107 |
</td>
|
108 |
</tr>
|
109 |
-
<tr
|
110 |
<th scope="row"><?php _e( 'File Deletion', 'backwpup' ); ?></th>
|
111 |
<td>
|
112 |
<?php
|
@@ -763,7 +763,7 @@ class BackWPup_Destination_SugarSync_API {
|
|
763 |
}
|
764 |
}
|
765 |
if ( ! $isdir ) {
|
766 |
-
$
|
767 |
$contents = $this->getcontents( 'folder' );
|
768 |
foreach ( $contents->collection as $collection ) {
|
769 |
if ( strtolower( $collection->displayName ) == strtolower( $dir ) ) {
|
@@ -865,7 +865,7 @@ class BackWPup_Destination_SugarSync_API {
|
|
865 |
|
866 |
$xmlrequest .= '</file>';
|
867 |
|
868 |
-
$
|
869 |
$getfiles = $this->getcontents( 'file' );
|
870 |
foreach ( $getfiles->file as $getfile ) {
|
871 |
if ( $getfile->displayName == $name ) {
|
38 |
<table class="form-table">
|
39 |
|
40 |
<?php if ( ! BackWPup_Option::get( $jobid, 'sugarrefreshtoken' ) ) { ?>
|
41 |
+
<tr>
|
42 |
<th scope="row"><?php _e( 'Authentication', 'backwpup' ); ?></th>
|
43 |
<td>
|
44 |
<label for="sugaremail"><?php _e( 'E-Mail address:', 'backwpup' ); ?><br/>
|
57 |
</td>
|
58 |
</tr>
|
59 |
<?php } else { ?>
|
60 |
+
<tr>
|
61 |
<th scope="row"><label for="idauthbutton"><?php _e( 'Authentication', 'backwpup' ); ?></label></th>
|
62 |
<td>
|
63 |
<span style="color:green;"><?php _e( 'Authenticated!', 'backwpup' ); ?></span>
|
71 |
<h3 class="title"><?php _e( 'SugarSync Root', 'backwpup' ); ?></h3>
|
72 |
<p></p>
|
73 |
<table class="form-table">
|
74 |
+
<tr>
|
75 |
<th scope="row"><label for="sugarroot"><?php _e( 'Sync folder selection', 'backwpup' ); ?></label></th>
|
76 |
<td>
|
77 |
<?php
|
100 |
<h3 class="title"><?php _e( 'Backup settings', 'backwpup' ); ?></h3>
|
101 |
<p></p>
|
102 |
<table class="form-table">
|
103 |
+
<tr>
|
104 |
<th scope="row"><label for="idsugardir"><?php _e( 'Folder in root', 'backwpup' ); ?></label></th>
|
105 |
<td>
|
106 |
<input id="idsugardir" name="sugardir" type="text" value="<?php echo BackWPup_Option::get( $jobid, 'sugardir' ); ?>" class="regular-text" />
|
107 |
</td>
|
108 |
</tr>
|
109 |
+
<tr>
|
110 |
<th scope="row"><?php _e( 'File Deletion', 'backwpup' ); ?></th>
|
111 |
<td>
|
112 |
<?php
|
763 |
}
|
764 |
}
|
765 |
if ( ! $isdir ) {
|
766 |
+
$this->doCall( $this->folder, '<?xml version="1.0" encoding="UTF-8"?><folder><displayName>' . mb_convert_encoding( $dir, 'UTF-8', $this->encoding ) . '</displayName></folder>', 'POST' );
|
767 |
$contents = $this->getcontents( 'folder' );
|
768 |
foreach ( $contents->collection as $collection ) {
|
769 |
if ( strtolower( $collection->displayName ) == strtolower( $dir ) ) {
|
865 |
|
866 |
$xmlrequest .= '</file>';
|
867 |
|
868 |
+
$this->doCall( $this->folder, $xmlrequest, 'POST' );
|
869 |
$getfiles = $this->getcontents( 'file' );
|
870 |
foreach ( $getfiles->file as $getfile ) {
|
871 |
if ( $getfile->displayName == $name ) {
|
inc/class-help.php
CHANGED
@@ -58,5 +58,6 @@ class BackWPup_Help {
|
|
58 |
return '<img class="help_tip" title="' . esc_attr( $text ) . '" src="' . BackWPup::get_plugin_data( 'URL' ) . '/images/help.png" />';
|
59 |
|
60 |
echo '<img class="help_tip" title="' . esc_attr( $text ) . '" src="' . BackWPup::get_plugin_data( 'URL' ) . '/images/help.png" />';
|
|
|
61 |
}
|
62 |
}
|
58 |
return '<img class="help_tip" title="' . esc_attr( $text ) . '" src="' . BackWPup::get_plugin_data( 'URL' ) . '/images/help.png" />';
|
59 |
|
60 |
echo '<img class="help_tip" title="' . esc_attr( $text ) . '" src="' . BackWPup::get_plugin_data( 'URL' ) . '/images/help.png" />';
|
61 |
+
return '';
|
62 |
}
|
63 |
}
|
inc/class-install.php
CHANGED
@@ -32,30 +32,31 @@ class BackWPup_Install {
|
|
32 |
wp_clear_scheduled_hook( 'backwpup_check_cleanup' );
|
33 |
wp_schedule_event( time(), 'twicedaily', 'backwpup_check_cleanup' );
|
34 |
|
35 |
-
//
|
36 |
$role = get_role( 'administrator' );
|
37 |
-
$role->
|
38 |
-
$role->
|
39 |
-
$role->
|
40 |
-
$role->
|
41 |
-
$role->
|
42 |
-
$role->
|
43 |
-
$role->
|
44 |
-
$role->
|
45 |
-
$role->
|
46 |
-
$role->
|
47 |
|
|
|
48 |
add_role( 'backwpup_admin', __( 'BackWPup Admin', 'backwpup' ), array(
|
49 |
-
'backwpup' => TRUE,
|
50 |
-
'backwpup_jobs' => TRUE,
|
51 |
-
'backwpup_jobs_edit' => TRUE,
|
52 |
-
'backwpup_jobs_start' => TRUE,
|
53 |
-
'backwpup_backups' => TRUE,
|
54 |
-
'backwpup_backups_download' => TRUE,
|
55 |
-
'backwpup_backups_delete' => TRUE,
|
56 |
-
'backwpup_logs' => TRUE,
|
57 |
-
'backwpup_logs_delete' => TRUE,
|
58 |
-
'backwpup_settings' => TRUE,
|
59 |
) );
|
60 |
|
61 |
add_role( 'backwpup_check', __( 'BackWPup jobs checker', 'backwpup' ), array(
|
@@ -83,6 +84,16 @@ class BackWPup_Install {
|
|
83 |
'backwpup_logs_delete' => TRUE,
|
84 |
'backwpup_settings' => FALSE,
|
85 |
) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
|
87 |
//add cfg options to database prevent false false if option not exists
|
88 |
$cfg_options = BackWPup_Option::defaults( 'cfg', NULL );
|
@@ -120,20 +131,6 @@ class BackWPup_Install {
|
|
120 |
}
|
121 |
}
|
122 |
wp_clear_scheduled_hook( 'backwpup_check_cleanup' );
|
123 |
-
remove_role( 'backwpup_admin' );
|
124 |
-
remove_role( 'backwpup_helper' );
|
125 |
-
remove_role( 'backwpup_check' );
|
126 |
-
$role = get_role( 'administrator' );
|
127 |
-
$role->remove_cap( 'backwpup' );
|
128 |
-
$role->remove_cap( 'backwpup_jobs' );
|
129 |
-
$role->remove_cap( 'backwpup_jobs_edit' );
|
130 |
-
$role->remove_cap( 'backwpup_jobs_start' );
|
131 |
-
$role->remove_cap( 'backwpup_backups' );
|
132 |
-
$role->remove_cap( 'backwpup_backups_download' );
|
133 |
-
$role->remove_cap( 'backwpup_backups_delete' );
|
134 |
-
$role->remove_cap( 'backwpup_logs' );
|
135 |
-
$role->remove_cap( 'backwpup_logs_delete' );
|
136 |
-
$role->remove_cap( 'backwpup_settings' );
|
137 |
//to reschedule on activation and so on
|
138 |
update_site_option( 'backwpup_version', BackWPup::get_plugin_data( 'version' ) .'-inactive' );
|
139 |
}
|
@@ -267,9 +264,6 @@ class BackWPup_Install {
|
|
267 |
$jobvalue[ 'dbdumpexclude' ] = $jobvalue[ 'dbexclude' ];
|
268 |
unset( $jobvalue[ 'dbexclude' ], $jobvalue['dbshortinsert'] );
|
269 |
//convert jobtype DBDUMP, DBCHECK, DBOPTIMIZE
|
270 |
-
$jobvalue[ 'dbdumpmaintenance' ] = $jobvalue['maintenance'];
|
271 |
-
$jobvalue[ 'dbcheckmaintenance' ] = $jobvalue['maintenance'];
|
272 |
-
$jobvalue[ 'dboptimizemaintenance' ] = $jobvalue['maintenance'];
|
273 |
$jobvalue[ 'dbcheckrepair' ] = TRUE;
|
274 |
unset( $jobvalue[ 'maintenance' ] );
|
275 |
//convert jobtype wpexport
|
32 |
wp_clear_scheduled_hook( 'backwpup_check_cleanup' );
|
33 |
wp_schedule_event( time(), 'twicedaily', 'backwpup_check_cleanup' );
|
34 |
|
35 |
+
//remove old roles pre v.3.0.9
|
36 |
$role = get_role( 'administrator' );
|
37 |
+
$role->remove_cap( 'backwpup' );
|
38 |
+
$role->remove_cap( 'backwpup_jobs' );
|
39 |
+
$role->remove_cap( 'backwpup_jobs_edit' );
|
40 |
+
$role->remove_cap( 'backwpup_jobs_start' );
|
41 |
+
$role->remove_cap( 'backwpup_backups' );
|
42 |
+
$role->remove_cap( 'backwpup_backups_download' );
|
43 |
+
$role->remove_cap( 'backwpup_backups_delete' );
|
44 |
+
$role->remove_cap( 'backwpup_logs' );
|
45 |
+
$role->remove_cap( 'backwpup_logs_delete' );
|
46 |
+
$role->remove_cap( 'backwpup_settings' );
|
47 |
|
48 |
+
//add/overwrite roles
|
49 |
add_role( 'backwpup_admin', __( 'BackWPup Admin', 'backwpup' ), array(
|
50 |
+
'backwpup' => TRUE, // BackWPup general accesses (like Dashboard)
|
51 |
+
'backwpup_jobs' => TRUE, // accesses for job page
|
52 |
+
'backwpup_jobs_edit' => TRUE, // user can edit/delete/copy/export jobs
|
53 |
+
'backwpup_jobs_start' => TRUE, // user can start jobs
|
54 |
+
'backwpup_backups' => TRUE, // accesses for backups page
|
55 |
+
'backwpup_backups_download' => TRUE, // user can download backup files
|
56 |
+
'backwpup_backups_delete' => TRUE, // user can delete backup files
|
57 |
+
'backwpup_logs' => TRUE, // accesses for logs page
|
58 |
+
'backwpup_logs_delete' => TRUE, // user can delete log files
|
59 |
+
'backwpup_settings' => TRUE, // accesses for settings page
|
60 |
) );
|
61 |
|
62 |
add_role( 'backwpup_check', __( 'BackWPup jobs checker', 'backwpup' ), array(
|
84 |
'backwpup_logs_delete' => TRUE,
|
85 |
'backwpup_settings' => FALSE,
|
86 |
) );
|
87 |
+
|
88 |
+
//add role to admin user if no one
|
89 |
+
$users_backwpup = get_users( array( 'blog_id' => 1, 'role' => 'backwpup_admin' ) );
|
90 |
+
if ( empty( $users_backwpup ) ) {
|
91 |
+
/* @var WP_User $user */
|
92 |
+
$users = get_users( array( 'blog_id' => 1, 'role' => 'administrator' ) );
|
93 |
+
foreach ( $users as $user ) {
|
94 |
+
$user->add_role( 'backwpup_admin' );
|
95 |
+
}
|
96 |
+
}
|
97 |
|
98 |
//add cfg options to database prevent false false if option not exists
|
99 |
$cfg_options = BackWPup_Option::defaults( 'cfg', NULL );
|
131 |
}
|
132 |
}
|
133 |
wp_clear_scheduled_hook( 'backwpup_check_cleanup' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
134 |
//to reschedule on activation and so on
|
135 |
update_site_option( 'backwpup_version', BackWPup::get_plugin_data( 'version' ) .'-inactive' );
|
136 |
}
|
264 |
$jobvalue[ 'dbdumpexclude' ] = $jobvalue[ 'dbexclude' ];
|
265 |
unset( $jobvalue[ 'dbexclude' ], $jobvalue['dbshortinsert'] );
|
266 |
//convert jobtype DBDUMP, DBCHECK, DBOPTIMIZE
|
|
|
|
|
|
|
267 |
$jobvalue[ 'dbcheckrepair' ] = TRUE;
|
268 |
unset( $jobvalue[ 'maintenance' ] );
|
269 |
//convert jobtype wpexport
|
inc/class-job.php
CHANGED
@@ -59,9 +59,13 @@ final class BackWPup_Job {
|
|
59 |
*/
|
60 |
public $errors = 0;
|
61 |
/**
|
62 |
-
* @var string the last log message
|
63 |
*/
|
64 |
public $lastmsg = '';
|
|
|
|
|
|
|
|
|
65 |
/**
|
66 |
* @var array of steps to do
|
67 |
*/
|
@@ -130,33 +134,20 @@ final class BackWPup_Job {
|
|
130 |
* @var string path to remove from file path
|
131 |
*/
|
132 |
public $remove_path = '';
|
133 |
-
/**
|
134 |
-
* @var bool maintenance mode already active
|
135 |
-
*/
|
136 |
-
private $maintenance_mode = FALSE;
|
137 |
|
138 |
/**
|
139 |
*
|
140 |
* This starts or restarts the job working
|
141 |
*
|
142 |
-
* @param string
|
143 |
-
* @param array|int $job_settings The id of job or the
|
144 |
*/
|
145 |
-
private function __construct( $
|
146 |
global $wpdb;
|
147 |
-
|
148 |
-
|
149 |
-
if ( is_file( BackWPup::get_plugin_data( 'running_file' ) ) )
|
150 |
-
return;
|
151 |
-
else
|
152 |
-
file_put_contents( BackWPup::get_plugin_data( 'running_file' ), '<?php //'. serialize( $this ) );
|
153 |
-
|
154 |
//check startype
|
155 |
-
if ( ! in_array( $
|
156 |
-
return;
|
157 |
-
|
158 |
-
//check $job_settings
|
159 |
-
if ( empty( $job_settings ) )
|
160 |
return;
|
161 |
|
162 |
if ( is_int( $job_settings ) )
|
@@ -165,7 +156,7 @@ final class BackWPup_Job {
|
|
165 |
$this->job = $job_settings;
|
166 |
else
|
167 |
return;
|
168 |
-
$this->jobstarttype = $
|
169 |
$this->start_time = current_time( 'timestamp' );
|
170 |
$this->lastmsg = '<samp>' . __( 'Starting job', 'backwpup' ) . '</samp>';
|
171 |
//set Logfile
|
@@ -177,16 +168,17 @@ final class BackWPup_Job {
|
|
177 |
BackWPup_Option::update( $this->job[ 'jobid' ], 'lastbackupdownloadurl', '' );
|
178 |
}
|
179 |
//Set needed job values
|
180 |
-
$this->timestamp_last_update
|
181 |
-
$this->exclude_from_backup
|
182 |
-
$this->exclude_from_backup
|
183 |
if ( trailingslashit( str_replace( '\\', '/', ABSPATH ) ) != '/' and trailingslashit( str_replace( '\\', '/', ABSPATH ) ) != '' ) //create path to remove
|
184 |
-
$this->remove_path
|
185 |
//setup job steps
|
186 |
$this->steps_data[ 'START' ][ 'CALLBACK' ] = '';
|
187 |
$this->steps_data[ 'START' ][ 'NAME' ] = __( 'Job Start', 'backwpup' );
|
188 |
$this->steps_data[ 'START' ][ 'STEP_TRY' ] = 0;
|
189 |
//ADD Job types file
|
|
|
190 |
$job_need_dest = FALSE;
|
191 |
if ( $job_types = BackWPup::get_job_types() ) {
|
192 |
foreach ( $job_types as $id => $job_type_class ) {
|
@@ -221,6 +213,7 @@ final class BackWPup_Job {
|
|
221 |
$this->steps_data[ 'CREATE_ARCHIVE' ][ 'STEP_TRY' ] = 0;
|
222 |
}
|
223 |
//ADD Destinations
|
|
|
224 |
foreach ( BackWPup::get_destinations() as $id => $dest_class ) {
|
225 |
if ( in_array( $id, $this->job[ 'destinations' ] ) && $dest_class->can_run( $this ) ) {
|
226 |
if ( $this->job[ 'backuptype' ] == 'sync' ) {
|
@@ -250,15 +243,13 @@ final class BackWPup_Job {
|
|
250 |
$this->steps_todo[] = 'END';
|
251 |
$this->steps_data[ 'END' ][ 'NAME' ] = __( 'Job End', 'backwpup' );
|
252 |
$this->steps_data[ 'END' ][ 'STEP_TRY' ] = 0;
|
253 |
-
//must write working data
|
254 |
-
file_put_contents( BackWPup::get_plugin_data( 'running_file' ), '<?php //'. serialize( $this ) );
|
255 |
//create log file
|
256 |
$fd = fopen( $this->logfile, 'w' );
|
257 |
fwrite( $fd, "<!DOCTYPE html>" . PHP_EOL . "<html lang=\"" . str_replace( '_', '-', get_locale() ) . "\">" . PHP_EOL . "<head>" . PHP_EOL );
|
258 |
fwrite( $fd, "<meta charset=\"" . get_bloginfo( 'charset' ) . "\" />" . PHP_EOL );
|
259 |
fwrite( $fd, "<title>" . sprintf( __( 'BackWPup log for %1$s from %2$s at %3$s', 'backwpup' ), $this->job[ 'name' ], date_i18n( get_option( 'date_format' ) ), date_i18n( get_option( 'time_format' ) ) ) . "</title>" . PHP_EOL );
|
260 |
fwrite( $fd, "<meta name=\"robots\" content=\"noindex, nofollow\" />" . PHP_EOL );
|
261 |
-
fwrite( $fd, "<meta name=\"copyright\" content=\"Copyright ©
|
262 |
fwrite( $fd, "<meta name=\"author\" content=\"Daniel Hüsken\" />" . PHP_EOL );
|
263 |
fwrite( $fd, "<meta name=\"generator\" content=\"BackWPup " . BackWPup::get_plugin_data( 'Version' ) . "\" />" . PHP_EOL );
|
264 |
fwrite( $fd, "<meta http-equiv=\"cache-control\" content=\"no-cache\" />" . PHP_EOL );
|
@@ -319,6 +310,8 @@ final class BackWPup_Job {
|
|
319 |
}
|
320 |
//Set start as done
|
321 |
$this->steps_done[] = 'START';
|
|
|
|
|
322 |
}
|
323 |
|
324 |
// prevent 'clone()' from external.
|
@@ -330,8 +323,8 @@ final class BackWPup_Job {
|
|
330 |
*/
|
331 |
public function __sleep(){
|
332 |
//not saved: 'temp',
|
333 |
-
return array( 'jobstarttype', 'job', 'start_time', 'logfile', 'backup_folder', 'folder_list_file',
|
334 |
-
'backup_file', 'backup_filesize', 'pid', 'timestamp_last_update', 'warnings', 'errors', 'lastmsg',
|
335 |
'steps_todo', 'steps_done', 'steps_data', 'step_working', 'substeps_todo', 'substeps_done', 'step_percent',
|
336 |
'substep_percent', 'additional_files_to_backup', 'exclude_from_backup', 'count_files',
|
337 |
'count_filesize', 'count_folder', 'count_files_in_folder', 'count_filesize_in_folder', 'remove_path' );
|
@@ -358,12 +351,13 @@ final class BackWPup_Job {
|
|
358 |
*/
|
359 |
public static function get_jobrun_url( $starttype, $jobid = 0 ) {
|
360 |
|
361 |
-
|
362 |
-
$
|
363 |
-
$
|
364 |
-
$
|
365 |
-
|
366 |
-
|
|
|
367 |
|
368 |
if ( in_array( $starttype, array( 'restart', 'runnow', 'cronrun', 'runext' ) ) )
|
369 |
$query_args[ 'backwpup_run' ] = $starttype;
|
@@ -372,9 +366,9 @@ final class BackWPup_Job {
|
|
372 |
$query_args[ 'jobid' ] = $jobid;
|
373 |
|
374 |
if ( BackWPup_Option::get( 'cfg', 'httpauthuser' ) && BackWPup_Option::get( 'cfg', 'httpauthpassword' ) ) {
|
375 |
-
$header
|
376 |
$authurl = BackWPup_Option::get( 'cfg', 'httpauthuser' ) . ':' . BackWPup_Encryption::decrypt( BackWPup_Option::get( 'cfg', 'httpauthpassword' ) ) . '@';
|
377 |
-
}
|
378 |
|
379 |
if ( $starttype == 'runext' ) {
|
380 |
$query_args[ '_nonce' ] = BackWPup_Option::get( 'cfg', 'jobrunauthkey' );
|
@@ -464,13 +458,18 @@ final class BackWPup_Job {
|
|
464 |
trigger_error( __( 'No BackWPup job running', 'backwpup' ), E_USER_ERROR );
|
465 |
wp_die( __( 'No BackWPup job running', 'backwpup' ), __( 'No BackWPup job running', 'backwpup' ), array( 'response' => 400 ) );
|
466 |
}
|
467 |
-
if ( $starttype != 'restart' && is_object( $backwpup_job_object ) ) {
|
468 |
trigger_error( __( 'A BackWPup job is already running', 'backwpup' ), E_USER_ERROR );
|
469 |
wp_die( __( 'A BackWPup job is already running', 'backwpup' ), __( 'A BackWPup job is already running', 'backwpup' ), array( 'response' => 503 ) );
|
470 |
}
|
471 |
if ( $starttype == 'restart' && is_object( $backwpup_job_object ) ) {
|
472 |
self::$instance = $backwpup_job_object;
|
473 |
}
|
|
|
|
|
|
|
|
|
|
|
474 |
// disable user abort. wp-cron.php set it now
|
475 |
//ignore_user_abort( TRUE );
|
476 |
//close session file on server side to avoid blocking other requests
|
@@ -484,7 +483,7 @@ final class BackWPup_Job {
|
|
484 |
ob_end_flush();
|
485 |
flush();
|
486 |
//start class
|
487 |
-
if ( in_array( $starttype, array( 'runnow', 'runnowalt', 'runext' ) ) ) {
|
488 |
//schedule restart event
|
489 |
wp_schedule_single_event( time() + 60, 'backwpup_cron', array( 'id' => 'restart' ) );
|
490 |
//start job
|
@@ -532,7 +531,10 @@ final class BackWPup_Job {
|
|
532 |
if ( self::get_working_data( FALSE ) ) {
|
533 |
trigger_error( __( 'A BackWPup job is already running', 'backwpup' ), E_USER_ERROR );
|
534 |
die( __( 'A BackWPup job is already running', 'backwpup' ) );
|
535 |
-
}
|
|
|
|
|
|
|
536 |
//start/restart class
|
537 |
fwrite( STDOUT, __( 'Job Started' ) . PHP_EOL );
|
538 |
fwrite( STDOUT, '----------------------------------------------------------------------' . PHP_EOL );
|
@@ -588,7 +590,10 @@ final class BackWPup_Job {
|
|
588 |
return;
|
589 |
}
|
590 |
//start/restart class
|
591 |
-
if ( !
|
|
|
|
|
|
|
592 |
//schedule restart event
|
593 |
wp_schedule_single_event( time() + 60, 'backwpup_cron', array( 'id' => 'restart' ) );
|
594 |
//start job
|
@@ -604,7 +609,8 @@ final class BackWPup_Job {
|
|
604 |
*/
|
605 |
public function run() {
|
606 |
global $wpdb;
|
607 |
-
|
|
|
608 |
//Check double running and inactivity
|
609 |
$job_object = self::get_working_data();
|
610 |
if ( ! $job_object )
|
@@ -640,8 +646,8 @@ final class BackWPup_Job {
|
|
640 |
@putenv( 'TMPDIR='.BackWPup::get_plugin_data( 'TEMP') );
|
641 |
}
|
642 |
//increase MySQL timeout
|
643 |
-
@ini_set( 'mysql.connect_timeout', '
|
644 |
-
$wpdb->query( "SET session wait_timeout =
|
645 |
//Write Wordpress DB errors to log
|
646 |
$wpdb->suppress_errors( FALSE );
|
647 |
$wpdb->hide_errors();
|
@@ -664,11 +670,9 @@ final class BackWPup_Job {
|
|
664 |
if ( function_exists( 'apc_clear_cache' ) ) { //clear APC
|
665 |
apc_clear_cache();
|
666 |
}
|
667 |
-
if (
|
668 |
-
|
669 |
-
|
670 |
-
w3tc_minify_flush();
|
671 |
-
//w3tc_objectcache_flush(); //can make problems if flushed
|
672 |
} elseif ( function_exists('wp_cache_clear_cache') ) { //WP Super Cache
|
673 |
wp_cache_clear_cache();
|
674 |
} elseif ( has_action('cachify_flush_cache') ) { //Cachify
|
@@ -749,7 +753,6 @@ final class BackWPup_Job {
|
|
749 |
//do things for a clean restart
|
750 |
$this->pid = 0;
|
751 |
$this->jobstarttype = 'restart';
|
752 |
-
$this->set_maintenance_mode( FALSE );
|
753 |
$this->update_working_data( TRUE );
|
754 |
remove_action( 'shutdown', array( $this, 'shutdown' ) );
|
755 |
//do restart
|
@@ -760,8 +763,7 @@ final class BackWPup_Job {
|
|
760 |
} else {
|
761 |
self::get_jobrun_url( 'restart' );
|
762 |
}
|
763 |
-
exit();
|
764 |
-
|
765 |
}
|
766 |
|
767 |
/**
|
@@ -770,7 +772,7 @@ final class BackWPup_Job {
|
|
770 |
*
|
771 |
* @param bool $get_object is full object needed or only that it working
|
772 |
*
|
773 |
-
* @return bool|object BackWPup_Job
|
774 |
*/
|
775 |
public static function get_working_data( $get_object = TRUE ) {
|
776 |
|
@@ -782,10 +784,13 @@ final class BackWPup_Job {
|
|
782 |
|
783 |
if ( $running_data = file_get_contents( BackWPup::get_plugin_data( 'running_file' ), FALSE, NULL, 8 ) ) {
|
784 |
$job_object = unserialize( $running_data );
|
785 |
-
if ( is_object( $job_object )
|
786 |
return $job_object;
|
787 |
-
else
|
788 |
-
|
|
|
|
|
|
|
789 |
}
|
790 |
|
791 |
return FALSE;
|
@@ -824,7 +829,6 @@ final class BackWPup_Job {
|
|
824 |
$metas = (array)get_meta_tags( $logfile );
|
825 |
}
|
826 |
|
827 |
-
|
828 |
//only output needed data
|
829 |
foreach ( $usedmetas as $keyword => $field ) {
|
830 |
if ( isset( $metas[ $keyword ] ) ) {
|
@@ -839,7 +843,7 @@ final class BackWPup_Job {
|
|
839 |
if ( isset( $metas[ 'date' ] ) )
|
840 |
$joddata[ 'logtime' ] = strtotime( $metas[ 'date' ] ) + ( get_option( 'gmt_offset' ) * 3600 );
|
841 |
|
842 |
-
//use file create
|
843 |
if ( empty( $joddata[ 'logtime' ] ) )
|
844 |
$joddata[ 'logtime' ] = filectime( $logfile );
|
845 |
|
@@ -941,8 +945,7 @@ final class BackWPup_Job {
|
|
941 |
}
|
942 |
|
943 |
/**
|
944 |
-
*
|
945 |
-
* The error handler to write message to log
|
946 |
*
|
947 |
* @internal param int the error number (E_USER_ERROR,E_USER_WARNING,E_USER_NOTICE, ...)
|
948 |
* @internal param string the error message
|
@@ -965,15 +968,15 @@ final class BackWPup_Job {
|
|
965 |
$args[ 1 ] = $temp;
|
966 |
}
|
967 |
|
968 |
-
//if first the message and
|
969 |
-
if ( ! isset( $args[ 1 ] )
|
970 |
$args[ 1 ] = $args[ 0 ];
|
971 |
$args[ 0 ] = E_USER_NOTICE;
|
972 |
}
|
973 |
|
974 |
-
//
|
975 |
if ( is_array( $args[ 1 ] ) || is_object( $args[ 1 ] ) )
|
976 |
-
$args[ 1 ] =
|
977 |
|
978 |
//if not set line and file get it
|
979 |
if ( empty( $args[ 2 ] ) || empty( $args[ 3 ] ) ) {
|
@@ -982,7 +985,7 @@ final class BackWPup_Job {
|
|
982 |
$args[ 3 ] = $debug_info[ 0 ][ 'line' ];
|
983 |
}
|
984 |
|
985 |
-
$
|
986 |
|
987 |
switch ( $args[ 0 ] ) {
|
988 |
case E_NOTICE:
|
@@ -994,7 +997,7 @@ final class BackWPup_Job {
|
|
994 |
case E_COMPILE_WARNING:
|
995 |
case E_USER_WARNING:
|
996 |
$this->warnings ++;
|
997 |
-
$
|
998 |
$messagetype = '<samp style="background-color:#ffc000;color:#fff">' . __( 'WARNING:', 'backwpup' ) . ' ';
|
999 |
break;
|
1000 |
case E_ERROR:
|
@@ -1003,7 +1006,7 @@ final class BackWPup_Job {
|
|
1003 |
case E_COMPILE_ERROR:
|
1004 |
case E_USER_ERROR:
|
1005 |
$this->errors ++;
|
1006 |
-
$
|
1007 |
$messagetype = '<samp style="background-color:red;color:#fff">' . __( 'ERROR:', 'backwpup' ) . ' ';
|
1008 |
break;
|
1009 |
case 8192: //E_DEPRECATED comes with php 5.3
|
@@ -1031,35 +1034,37 @@ final class BackWPup_Job {
|
|
1031 |
//ste last Message
|
1032 |
if ( $args[ 0 ] == E_NOTICE || $args[ 0 ] == E_USER_NOTICE )
|
1033 |
$this->lastmsg = $messagetype . htmlentities( $args[ 1 ], ENT_COMPAT , get_bloginfo( 'charset' ), FALSE ) . '</samp>';
|
|
|
|
|
1034 |
//write log file
|
1035 |
file_put_contents( $this->logfile, $timestamp . $messagetype . htmlentities( $args[ 1 ], ENT_COMPAT , get_bloginfo( 'charset' ), FALSE ) . '</samp>' . PHP_EOL, FILE_APPEND );
|
1036 |
|
1037 |
//write new log header
|
1038 |
-
if ( $
|
1039 |
$found = 0;
|
1040 |
$fd = fopen( $this->logfile, 'r+' );
|
1041 |
-
$
|
1042 |
while ( ! feof( $fd ) ) {
|
1043 |
$line = fgets( $fd );
|
1044 |
if ( stripos( $line, "<meta name=\"backwpup_errors\" content=\"" ) !== FALSE ) {
|
1045 |
-
fseek( $fd, $
|
1046 |
fwrite( $fd, str_pad( "<meta name=\"backwpup_errors\" content=\"" . $this->errors . "\" />", 100 ) . PHP_EOL );
|
1047 |
$found ++;
|
1048 |
}
|
1049 |
if ( stripos( $line, "<meta name=\"backwpup_warnings\" content=\"" ) !== FALSE ) {
|
1050 |
-
fseek( $fd, $
|
1051 |
fwrite( $fd, str_pad( "<meta name=\"backwpup_warnings\" content=\"" . $this->warnings . "\" />", 100 ) . PHP_EOL );
|
1052 |
$found ++;
|
1053 |
}
|
1054 |
if ( $found >= 2 )
|
1055 |
break;
|
1056 |
-
$
|
1057 |
}
|
1058 |
fclose( $fd );
|
1059 |
}
|
1060 |
|
1061 |
//write working data
|
1062 |
-
$this->update_working_data( $
|
1063 |
|
1064 |
//true for no more php error handling.
|
1065 |
return TRUE;
|
@@ -1070,19 +1075,20 @@ final class BackWPup_Job {
|
|
1070 |
* Write the Working data to display the process or that i can executes again
|
1071 |
*
|
1072 |
* @global wpdb $wpdb
|
1073 |
-
* @param bool $
|
1074 |
* @return bool true if working date written
|
1075 |
*/
|
1076 |
-
public function update_working_data( $
|
1077 |
global $wpdb;
|
1078 |
-
|
|
|
1079 |
//to reduce server load
|
1080 |
if ( BackWPup_Option::get( 'cfg', 'jobwaittimems' ) > 0 && BackWPup_Option::get( 'cfg', 'jobwaittimems') <= 500000 )
|
1081 |
usleep( BackWPup_Option::get( 'cfg', 'jobwaittimems' ) );
|
1082 |
|
1083 |
//only run every 1 sec.
|
1084 |
-
$
|
1085 |
-
if ( ! $
|
1086 |
return TRUE;
|
1087 |
|
1088 |
//set execution time again
|
@@ -1092,18 +1098,15 @@ final class BackWPup_Job {
|
|
1092 |
$this->need_free_memory( '10M' );
|
1093 |
|
1094 |
//check MySQL connection to WordPress Database and reconnect if needed
|
1095 |
-
|
1096 |
-
|
1097 |
-
|
1098 |
-
} else {
|
1099 |
-
$res = $wpdb->query( 'SELECT 1' );
|
1100 |
-
if ( $res === FALSE )
|
1101 |
-
$wpdb->db_connect();
|
1102 |
-
}
|
1103 |
|
1104 |
//check if job already aborted
|
1105 |
-
if ( ! self::get_working_data( FALSE )
|
1106 |
-
|
|
|
|
|
1107 |
|
1108 |
return FALSE;
|
1109 |
}
|
@@ -1116,8 +1119,7 @@ final class BackWPup_Job {
|
|
1116 |
$this->timestamp_last_update = microtime( TRUE );
|
1117 |
|
1118 |
//write data to file
|
1119 |
-
|
1120 |
-
file_put_contents( BackWPup::get_plugin_data( 'running_file' ), '<?php //'. serialize( $this ) );
|
1121 |
|
1122 |
return TRUE;
|
1123 |
}
|
@@ -1132,10 +1134,6 @@ final class BackWPup_Job {
|
|
1132 |
$this->step_working = 'END';
|
1133 |
$this->substeps_todo = 1;
|
1134 |
|
1135 |
-
//Back from maintenance if not
|
1136 |
-
if ( is_file( ABSPATH . '.maintenance' ) || ( defined( 'FB_WM_TEXTDOMAIN' ) && ( get_site_option( FB_WM_TEXTDOMAIN . '-msqld' ) == 1 || get_option( FB_WM_TEXTDOMAIN . '-msqld' ) == 1 ) ) )
|
1137 |
-
$this->set_maintenance_mode( FALSE );
|
1138 |
-
|
1139 |
//delete old logs
|
1140 |
if ( BackWPup_Option::get( 'cfg', 'maxlogs' ) ) {
|
1141 |
$logfilelist = array();
|
@@ -1159,7 +1157,12 @@ final class BackWPup_Job {
|
|
1159 |
}
|
1160 |
|
1161 |
//Display job working time
|
1162 |
-
|
|
|
|
|
|
|
|
|
|
|
1163 |
|
1164 |
//clean up temp
|
1165 |
if ( ! empty( $this->backup_file ) && is_file( BackWPup::get_plugin_data( 'TEMP' ) . $this->backup_file ) )
|
@@ -1173,6 +1176,7 @@ final class BackWPup_Job {
|
|
1173 |
}
|
1174 |
}
|
1175 |
//delete running file
|
|
|
1176 |
if ( is_file( BackWPup::get_plugin_data( 'running_file' ) ) )
|
1177 |
unlink( BackWPup::get_plugin_data( 'running_file' ) );
|
1178 |
|
@@ -1261,62 +1265,6 @@ final class BackWPup_Job {
|
|
1261 |
exit();
|
1262 |
}
|
1263 |
|
1264 |
-
/**
|
1265 |
-
*
|
1266 |
-
* Set blog to maintenance mode and back
|
1267 |
-
*
|
1268 |
-
* @param bool $enable set to true to enable maintenance
|
1269 |
-
*/
|
1270 |
-
public function set_maintenance_mode( $enable = FALSE ) {
|
1271 |
-
|
1272 |
-
//do not deactivate maintenance if active
|
1273 |
-
if ( $enable ) {
|
1274 |
-
$is_active = 0;
|
1275 |
-
if ( method_exists( 'WPMaintenanceMode', 'get_msqld_option' ) )
|
1276 |
-
$is_active = WPMaintenanceMode::get_msqld_option();
|
1277 |
-
if ( is_file( ABSPATH . '.maintenance' ) )
|
1278 |
-
$is_active = TRUE;
|
1279 |
-
|
1280 |
-
if ( ! empty( $is_active ) ) {
|
1281 |
-
$this->maintenance_mode = TRUE;
|
1282 |
-
$this->log( __( 'Blog is not setting to maintenance mode, because it is already active.', 'backwpup' ), E_USER_NOTICE );
|
1283 |
-
}
|
1284 |
-
}
|
1285 |
-
|
1286 |
-
//exit on not allowed
|
1287 |
-
if ( $this->maintenance_mode )
|
1288 |
-
return;
|
1289 |
-
|
1290 |
-
//Activate Maintenance mode
|
1291 |
-
if ( $enable ) {
|
1292 |
-
$this->log( __( 'Set blog into maintenance mode', 'backwpup' ), E_USER_NOTICE );
|
1293 |
-
if ( class_exists( 'WPMaintenanceMode' ) ) { //Support for WP Maintenance Mode Plugin (Frank Bueltge)
|
1294 |
-
if ( is_multisite() && is_plugin_active_for_network( FB_WM_BASENAME ) )
|
1295 |
-
update_site_option( FB_WM_TEXTDOMAIN . '-msqld', 1 );
|
1296 |
-
else
|
1297 |
-
update_option( FB_WM_TEXTDOMAIN . '-msqld', 1 );
|
1298 |
-
} else { //WP Support
|
1299 |
-
if ( FALSE === file_put_contents( ABSPATH . '.maintenance', '<?php $upgrading = ' . time() . '; ?>' ) )
|
1300 |
-
$this->log( __( 'Cannot set blog into maintenance mode! .maintenance is not writable!', 'backwpup' ), E_USER_WARNING );
|
1301 |
-
}
|
1302 |
-
|
1303 |
-
return;
|
1304 |
-
}
|
1305 |
-
|
1306 |
-
//deactivate Maintenance mode
|
1307 |
-
if ( is_file( ABSPATH . '.maintenance' ) || ( defined( 'FB_WM_TEXTDOMAIN' ) && ( get_site_option( FB_WM_TEXTDOMAIN . '-msqld' ) == 1 || get_option( FB_WM_TEXTDOMAIN . '-msqld' ) == 1 ) ) ) {
|
1308 |
-
$this->log( __( 'Set blog to normal mode', 'backwpup' ), E_USER_NOTICE );
|
1309 |
-
if ( class_exists( 'WPMaintenanceMode' ) ) { //Support for WP Maintenance Mode Plugin (Frank Bueltge)
|
1310 |
-
if ( is_multisite() && is_plugin_active_for_network( FB_WM_BASENAME ) )
|
1311 |
-
update_site_option( FB_WM_TEXTDOMAIN . '-msqld', 0 );
|
1312 |
-
else
|
1313 |
-
update_option( FB_WM_TEXTDOMAIN . '-msqld', 0 );
|
1314 |
-
} else { //WP Support
|
1315 |
-
@unlink( ABSPATH . '.maintenance' );
|
1316 |
-
}
|
1317 |
-
}
|
1318 |
-
}
|
1319 |
-
|
1320 |
/**
|
1321 |
*
|
1322 |
* Increase automatically the memory that is needed
|
59 |
*/
|
60 |
public $errors = 0;
|
61 |
/**
|
62 |
+
* @var string the last log notice message
|
63 |
*/
|
64 |
public $lastmsg = '';
|
65 |
+
/**
|
66 |
+
* @var string the last log error/waring message
|
67 |
+
*/
|
68 |
+
public $lasterrormsg = '';
|
69 |
/**
|
70 |
* @var array of steps to do
|
71 |
*/
|
134 |
* @var string path to remove from file path
|
135 |
*/
|
136 |
public $remove_path = '';
|
|
|
|
|
|
|
|
|
137 |
|
138 |
/**
|
139 |
*
|
140 |
* This starts or restarts the job working
|
141 |
*
|
142 |
+
* @param string $start_type Start types are 'runnow', 'runnowalt', 'cronrun', 'runext', 'runcli'
|
143 |
+
* @param array|int $job_settings The id of job or the settings of a job to start
|
144 |
*/
|
145 |
+
private function __construct( $start_type, $job_settings = 0 ) {
|
146 |
global $wpdb;
|
147 |
+
/* @var wpdb $wpdb */
|
148 |
+
|
|
|
|
|
|
|
|
|
|
|
149 |
//check startype
|
150 |
+
if ( ! in_array( $start_type, array( 'runnow', 'runnowalt', 'cronrun', 'runext', 'runcli' ) ) )
|
|
|
|
|
|
|
|
|
151 |
return;
|
152 |
|
153 |
if ( is_int( $job_settings ) )
|
156 |
$this->job = $job_settings;
|
157 |
else
|
158 |
return;
|
159 |
+
$this->jobstarttype = $start_type;
|
160 |
$this->start_time = current_time( 'timestamp' );
|
161 |
$this->lastmsg = '<samp>' . __( 'Starting job', 'backwpup' ) . '</samp>';
|
162 |
//set Logfile
|
168 |
BackWPup_Option::update( $this->job[ 'jobid' ], 'lastbackupdownloadurl', '' );
|
169 |
}
|
170 |
//Set needed job values
|
171 |
+
$this->timestamp_last_update = microtime( TRUE );
|
172 |
+
$this->exclude_from_backup = explode( ',', trim( $this->job[ 'fileexclude' ] ) );
|
173 |
+
$this->exclude_from_backup = array_unique( $this->exclude_from_backup );
|
174 |
if ( trailingslashit( str_replace( '\\', '/', ABSPATH ) ) != '/' and trailingslashit( str_replace( '\\', '/', ABSPATH ) ) != '' ) //create path to remove
|
175 |
+
$this->remove_path = trailingslashit( str_replace( '\\', '/', ABSPATH ) );
|
176 |
//setup job steps
|
177 |
$this->steps_data[ 'START' ][ 'CALLBACK' ] = '';
|
178 |
$this->steps_data[ 'START' ][ 'NAME' ] = __( 'Job Start', 'backwpup' );
|
179 |
$this->steps_data[ 'START' ][ 'STEP_TRY' ] = 0;
|
180 |
//ADD Job types file
|
181 |
+
/* @var $job_type_class BackWPup_JobTypes */
|
182 |
$job_need_dest = FALSE;
|
183 |
if ( $job_types = BackWPup::get_job_types() ) {
|
184 |
foreach ( $job_types as $id => $job_type_class ) {
|
213 |
$this->steps_data[ 'CREATE_ARCHIVE' ][ 'STEP_TRY' ] = 0;
|
214 |
}
|
215 |
//ADD Destinations
|
216 |
+
/* @var BackWPup_Destinations $dest_class */
|
217 |
foreach ( BackWPup::get_destinations() as $id => $dest_class ) {
|
218 |
if ( in_array( $id, $this->job[ 'destinations' ] ) && $dest_class->can_run( $this ) ) {
|
219 |
if ( $this->job[ 'backuptype' ] == 'sync' ) {
|
243 |
$this->steps_todo[] = 'END';
|
244 |
$this->steps_data[ 'END' ][ 'NAME' ] = __( 'Job End', 'backwpup' );
|
245 |
$this->steps_data[ 'END' ][ 'STEP_TRY' ] = 0;
|
|
|
|
|
246 |
//create log file
|
247 |
$fd = fopen( $this->logfile, 'w' );
|
248 |
fwrite( $fd, "<!DOCTYPE html>" . PHP_EOL . "<html lang=\"" . str_replace( '_', '-', get_locale() ) . "\">" . PHP_EOL . "<head>" . PHP_EOL );
|
249 |
fwrite( $fd, "<meta charset=\"" . get_bloginfo( 'charset' ) . "\" />" . PHP_EOL );
|
250 |
fwrite( $fd, "<title>" . sprintf( __( 'BackWPup log for %1$s from %2$s at %3$s', 'backwpup' ), $this->job[ 'name' ], date_i18n( get_option( 'date_format' ) ), date_i18n( get_option( 'time_format' ) ) ) . "</title>" . PHP_EOL );
|
251 |
fwrite( $fd, "<meta name=\"robots\" content=\"noindex, nofollow\" />" . PHP_EOL );
|
252 |
+
fwrite( $fd, "<meta name=\"copyright\" content=\"Copyright © 2012 - " . date_i18n( 'Y' ) . " Inpsyde GmbH\" />" . PHP_EOL );
|
253 |
fwrite( $fd, "<meta name=\"author\" content=\"Daniel Hüsken\" />" . PHP_EOL );
|
254 |
fwrite( $fd, "<meta name=\"generator\" content=\"BackWPup " . BackWPup::get_plugin_data( 'Version' ) . "\" />" . PHP_EOL );
|
255 |
fwrite( $fd, "<meta http-equiv=\"cache-control\" content=\"no-cache\" />" . PHP_EOL );
|
310 |
}
|
311 |
//Set start as done
|
312 |
$this->steps_done[] = 'START';
|
313 |
+
//must write working data
|
314 |
+
$this->update_working_data( TRUE );
|
315 |
}
|
316 |
|
317 |
// prevent 'clone()' from external.
|
323 |
*/
|
324 |
public function __sleep(){
|
325 |
//not saved: 'temp',
|
326 |
+
return array( 'jobstarttype', 'job', 'start_time', 'logfile', 'backup_folder', 'folder_list_file',
|
327 |
+
'backup_file', 'backup_filesize', 'pid', 'timestamp_last_update', 'warnings', 'errors', 'lastmsg', 'lasterrormsg',
|
328 |
'steps_todo', 'steps_done', 'steps_data', 'step_working', 'substeps_todo', 'substeps_done', 'step_percent',
|
329 |
'substep_percent', 'additional_files_to_backup', 'exclude_from_backup', 'count_files',
|
330 |
'count_filesize', 'count_folder', 'count_files_in_folder', 'count_filesize_in_folder', 'remove_path' );
|
351 |
*/
|
352 |
public static function get_jobrun_url( $starttype, $jobid = 0 ) {
|
353 |
|
354 |
+
|
355 |
+
$wp_admin_user = get_users( array( 'role' => 'administrator' ) ); //get a user for cookie auth
|
356 |
+
$url = site_url( 'wp-cron.php' );
|
357 |
+
$header = array();
|
358 |
+
$header[ 'Cookie' ] = LOGGED_IN_COOKIE. '='. wp_generate_auth_cookie( $wp_admin_user[ 0 ]->ID, time() + 60, 'logged_in'); // add auth cookie to header
|
359 |
+
$authurl = '';
|
360 |
+
$query_args = array( '_nonce' => substr( wp_hash( wp_nonce_tick() . 'backwup_job_run-' . $starttype, 'nonce' ), - 12, 10 ) );
|
361 |
|
362 |
if ( in_array( $starttype, array( 'restart', 'runnow', 'cronrun', 'runext' ) ) )
|
363 |
$query_args[ 'backwpup_run' ] = $starttype;
|
366 |
$query_args[ 'jobid' ] = $jobid;
|
367 |
|
368 |
if ( BackWPup_Option::get( 'cfg', 'httpauthuser' ) && BackWPup_Option::get( 'cfg', 'httpauthpassword' ) ) {
|
369 |
+
$header[ 'Authorization' ] = 'Basic ' . base64_encode( BackWPup_Option::get( 'cfg', 'httpauthuser' ) . ':' . BackWPup_Encryption::decrypt( BackWPup_Option::get( 'cfg', 'httpauthpassword' ) ) );
|
370 |
$authurl = BackWPup_Option::get( 'cfg', 'httpauthuser' ) . ':' . BackWPup_Encryption::decrypt( BackWPup_Option::get( 'cfg', 'httpauthpassword' ) ) . '@';
|
371 |
+
}
|
372 |
|
373 |
if ( $starttype == 'runext' ) {
|
374 |
$query_args[ '_nonce' ] = BackWPup_Option::get( 'cfg', 'jobrunauthkey' );
|
458 |
trigger_error( __( 'No BackWPup job running', 'backwpup' ), E_USER_ERROR );
|
459 |
wp_die( __( 'No BackWPup job running', 'backwpup' ), __( 'No BackWPup job running', 'backwpup' ), array( 'response' => 400 ) );
|
460 |
}
|
461 |
+
if ( $starttype != 'restart' && ( is_object( $backwpup_job_object ) || is_int( $backwpup_job_object ) ) ) {
|
462 |
trigger_error( __( 'A BackWPup job is already running', 'backwpup' ), E_USER_ERROR );
|
463 |
wp_die( __( 'A BackWPup job is already running', 'backwpup' ), __( 'A BackWPup job is already running', 'backwpup' ), array( 'response' => 503 ) );
|
464 |
}
|
465 |
if ( $starttype == 'restart' && is_object( $backwpup_job_object ) ) {
|
466 |
self::$instance = $backwpup_job_object;
|
467 |
}
|
468 |
+
//early write working file to prevent double run
|
469 |
+
if ( in_array( $starttype, array( 'runnow', 'runnowalt', 'runext' ) ) && ! $backwpup_job_object ) {
|
470 |
+
update_site_option( 'backwpup_working_job', (int)$jobid );
|
471 |
+
file_put_contents( BackWPup::get_plugin_data( 'running_file' ), '<?php //'. serialize( (object) array() ), LOCK_EX );
|
472 |
+
}
|
473 |
// disable user abort. wp-cron.php set it now
|
474 |
//ignore_user_abort( TRUE );
|
475 |
//close session file on server side to avoid blocking other requests
|
483 |
ob_end_flush();
|
484 |
flush();
|
485 |
//start class
|
486 |
+
if ( ! $backwpup_job_object && in_array( $starttype, array( 'runnow', 'runnowalt', 'runext' ) ) ) {
|
487 |
//schedule restart event
|
488 |
wp_schedule_single_event( time() + 60, 'backwpup_cron', array( 'id' => 'restart' ) );
|
489 |
//start job
|
531 |
if ( self::get_working_data( FALSE ) ) {
|
532 |
trigger_error( __( 'A BackWPup job is already running', 'backwpup' ), E_USER_ERROR );
|
533 |
die( __( 'A BackWPup job is already running', 'backwpup' ) );
|
534 |
+
}
|
535 |
+
//early write working file to prevent double run
|
536 |
+
update_site_option( 'backwpup_working_job', (int)$jobid );
|
537 |
+
file_put_contents( BackWPup::get_plugin_data( 'running_file' ), '<?php //'. serialize( (object) array() ), LOCK_EX );
|
538 |
//start/restart class
|
539 |
fwrite( STDOUT, __( 'Job Started' ) . PHP_EOL );
|
540 |
fwrite( STDOUT, '----------------------------------------------------------------------' . PHP_EOL );
|
590 |
return;
|
591 |
}
|
592 |
//start/restart class
|
593 |
+
if ( ! self::$instance && $jobid != 0 ) {
|
594 |
+
//early write working file to prevent double run
|
595 |
+
update_site_option( 'backwpup_working_job', (int)$jobid );
|
596 |
+
file_put_contents( BackWPup::get_plugin_data( 'running_file' ), '<?php //'. serialize( (object) array() ), LOCK_EX );
|
597 |
//schedule restart event
|
598 |
wp_schedule_single_event( time() + 60, 'backwpup_cron', array( 'id' => 'restart' ) );
|
599 |
//start job
|
609 |
*/
|
610 |
public function run() {
|
611 |
global $wpdb;
|
612 |
+
/* @var wpdb $wpdb */
|
613 |
+
|
614 |
//Check double running and inactivity
|
615 |
$job_object = self::get_working_data();
|
616 |
if ( ! $job_object )
|
646 |
@putenv( 'TMPDIR='.BackWPup::get_plugin_data( 'TEMP') );
|
647 |
}
|
648 |
//increase MySQL timeout
|
649 |
+
@ini_set( 'mysql.connect_timeout', '300' );
|
650 |
+
$wpdb->query( "SET session wait_timeout = 300" );
|
651 |
//Write Wordpress DB errors to log
|
652 |
$wpdb->suppress_errors( FALSE );
|
653 |
$wpdb->hide_errors();
|
670 |
if ( function_exists( 'apc_clear_cache' ) ) { //clear APC
|
671 |
apc_clear_cache();
|
672 |
}
|
673 |
+
if ( class_exists('W3_Plugin_TotalCacheAdmin') ) { //W3TC
|
674 |
+
$totalcacheadmin = & w3_instance('W3_Plugin_TotalCacheAdmin');
|
675 |
+
$totalcacheadmin->flush_all();
|
|
|
|
|
676 |
} elseif ( function_exists('wp_cache_clear_cache') ) { //WP Super Cache
|
677 |
wp_cache_clear_cache();
|
678 |
} elseif ( has_action('cachify_flush_cache') ) { //Cachify
|
753 |
//do things for a clean restart
|
754 |
$this->pid = 0;
|
755 |
$this->jobstarttype = 'restart';
|
|
|
756 |
$this->update_working_data( TRUE );
|
757 |
remove_action( 'shutdown', array( $this, 'shutdown' ) );
|
758 |
//do restart
|
763 |
} else {
|
764 |
self::get_jobrun_url( 'restart' );
|
765 |
}
|
766 |
+
exit();
|
|
|
767 |
}
|
768 |
|
769 |
/**
|
772 |
*
|
773 |
* @param bool $get_object is full object needed or only that it working
|
774 |
*
|
775 |
+
* @return bool|object|int BackWPup_Job Object or Bool if file not exits or job id if file cant read
|
776 |
*/
|
777 |
public static function get_working_data( $get_object = TRUE ) {
|
778 |
|
784 |
|
785 |
if ( $running_data = file_get_contents( BackWPup::get_plugin_data( 'running_file' ), FALSE, NULL, 8 ) ) {
|
786 |
$job_object = unserialize( $running_data );
|
787 |
+
if ( is_object( $job_object ) ) {
|
788 |
return $job_object;
|
789 |
+
} else {
|
790 |
+
//on defect return job id
|
791 |
+
return get_site_option( 'backwpup_working_job', 0 );
|
792 |
+
}
|
793 |
+
|
794 |
}
|
795 |
|
796 |
return FALSE;
|
829 |
$metas = (array)get_meta_tags( $logfile );
|
830 |
}
|
831 |
|
|
|
832 |
//only output needed data
|
833 |
foreach ( $usedmetas as $keyword => $field ) {
|
834 |
if ( isset( $metas[ $keyword ] ) ) {
|
843 |
if ( isset( $metas[ 'date' ] ) )
|
844 |
$joddata[ 'logtime' ] = strtotime( $metas[ 'date' ] ) + ( get_option( 'gmt_offset' ) * 3600 );
|
845 |
|
846 |
+
//use file create date if none
|
847 |
if ( empty( $joddata[ 'logtime' ] ) )
|
848 |
$joddata[ 'logtime' ] = filectime( $logfile );
|
849 |
|
945 |
}
|
946 |
|
947 |
/**
|
948 |
+
* Write messages to log file
|
|
|
949 |
*
|
950 |
* @internal param int the error number (E_USER_ERROR,E_USER_WARNING,E_USER_NOTICE, ...)
|
951 |
* @internal param string the error message
|
968 |
$args[ 1 ] = $temp;
|
969 |
}
|
970 |
|
971 |
+
//if first the message and nothing else set
|
972 |
+
if ( ! isset( $args[ 1 ] ) ) {
|
973 |
$args[ 1 ] = $args[ 0 ];
|
974 |
$args[ 0 ] = E_USER_NOTICE;
|
975 |
}
|
976 |
|
977 |
+
//json message if array or object
|
978 |
if ( is_array( $args[ 1 ] ) || is_object( $args[ 1 ] ) )
|
979 |
+
$args[ 1 ] = json_encode( $args[ 1 ] );
|
980 |
|
981 |
//if not set line and file get it
|
982 |
if ( empty( $args[ 2 ] ) || empty( $args[ 3 ] ) ) {
|
985 |
$args[ 3 ] = $debug_info[ 0 ][ 'line' ];
|
986 |
}
|
987 |
|
988 |
+
$error_or_warning = FALSE;
|
989 |
|
990 |
switch ( $args[ 0 ] ) {
|
991 |
case E_NOTICE:
|
997 |
case E_COMPILE_WARNING:
|
998 |
case E_USER_WARNING:
|
999 |
$this->warnings ++;
|
1000 |
+
$error_or_warning = TRUE;
|
1001 |
$messagetype = '<samp style="background-color:#ffc000;color:#fff">' . __( 'WARNING:', 'backwpup' ) . ' ';
|
1002 |
break;
|
1003 |
case E_ERROR:
|
1006 |
case E_COMPILE_ERROR:
|
1007 |
case E_USER_ERROR:
|
1008 |
$this->errors ++;
|
1009 |
+
$error_or_warning = TRUE;
|
1010 |
$messagetype = '<samp style="background-color:red;color:#fff">' . __( 'ERROR:', 'backwpup' ) . ' ';
|
1011 |
break;
|
1012 |
case 8192: //E_DEPRECATED comes with php 5.3
|
1034 |
//ste last Message
|
1035 |
if ( $args[ 0 ] == E_NOTICE || $args[ 0 ] == E_USER_NOTICE )
|
1036 |
$this->lastmsg = $messagetype . htmlentities( $args[ 1 ], ENT_COMPAT , get_bloginfo( 'charset' ), FALSE ) . '</samp>';
|
1037 |
+
if ( $error_or_warning )
|
1038 |
+
$this->lasterrormsg = $messagetype . htmlentities( $args[ 1 ], ENT_COMPAT , get_bloginfo( 'charset' ), FALSE ) . '</samp>';
|
1039 |
//write log file
|
1040 |
file_put_contents( $this->logfile, $timestamp . $messagetype . htmlentities( $args[ 1 ], ENT_COMPAT , get_bloginfo( 'charset' ), FALSE ) . '</samp>' . PHP_EOL, FILE_APPEND );
|
1041 |
|
1042 |
//write new log header
|
1043 |
+
if ( $error_or_warning ) {
|
1044 |
$found = 0;
|
1045 |
$fd = fopen( $this->logfile, 'r+' );
|
1046 |
+
$file_pos = ftell( $fd );
|
1047 |
while ( ! feof( $fd ) ) {
|
1048 |
$line = fgets( $fd );
|
1049 |
if ( stripos( $line, "<meta name=\"backwpup_errors\" content=\"" ) !== FALSE ) {
|
1050 |
+
fseek( $fd, $file_pos );
|
1051 |
fwrite( $fd, str_pad( "<meta name=\"backwpup_errors\" content=\"" . $this->errors . "\" />", 100 ) . PHP_EOL );
|
1052 |
$found ++;
|
1053 |
}
|
1054 |
if ( stripos( $line, "<meta name=\"backwpup_warnings\" content=\"" ) !== FALSE ) {
|
1055 |
+
fseek( $fd, $file_pos );
|
1056 |
fwrite( $fd, str_pad( "<meta name=\"backwpup_warnings\" content=\"" . $this->warnings . "\" />", 100 ) . PHP_EOL );
|
1057 |
$found ++;
|
1058 |
}
|
1059 |
if ( $found >= 2 )
|
1060 |
break;
|
1061 |
+
$file_pos = ftell( $fd );
|
1062 |
}
|
1063 |
fclose( $fd );
|
1064 |
}
|
1065 |
|
1066 |
//write working data
|
1067 |
+
$this->update_working_data( $error_or_warning );
|
1068 |
|
1069 |
//true for no more php error handling.
|
1070 |
return TRUE;
|
1075 |
* Write the Working data to display the process or that i can executes again
|
1076 |
*
|
1077 |
* @global wpdb $wpdb
|
1078 |
+
* @param bool $must_write overwrite the only ever 1 sec writing
|
1079 |
* @return bool true if working date written
|
1080 |
*/
|
1081 |
+
public function update_working_data( $must_write = FALSE ) {
|
1082 |
global $wpdb;
|
1083 |
+
/* @var wpdb $wpdb */
|
1084 |
+
|
1085 |
//to reduce server load
|
1086 |
if ( BackWPup_Option::get( 'cfg', 'jobwaittimems' ) > 0 && BackWPup_Option::get( 'cfg', 'jobwaittimems') <= 500000 )
|
1087 |
usleep( BackWPup_Option::get( 'cfg', 'jobwaittimems' ) );
|
1088 |
|
1089 |
//only run every 1 sec.
|
1090 |
+
$time_to_update = microtime( TRUE ) - $this->timestamp_last_update;
|
1091 |
+
if ( ! $must_write && $time_to_update < 1 )
|
1092 |
return TRUE;
|
1093 |
|
1094 |
//set execution time again
|
1098 |
$this->need_free_memory( '10M' );
|
1099 |
|
1100 |
//check MySQL connection to WordPress Database and reconnect if needed
|
1101 |
+
$res = $wpdb->query( 'SELECT 1' );
|
1102 |
+
if ( $res === FALSE )
|
1103 |
+
$wpdb->db_connect();
|
|
|
|
|
|
|
|
|
|
|
1104 |
|
1105 |
//check if job already aborted
|
1106 |
+
if ( ! self::get_working_data( FALSE ) ) {
|
1107 |
+
//run job end if aborted
|
1108 |
+
if ( $this->step_working != 'END' )
|
1109 |
+
$this->end();
|
1110 |
|
1111 |
return FALSE;
|
1112 |
}
|
1119 |
$this->timestamp_last_update = microtime( TRUE );
|
1120 |
|
1121 |
//write data to file
|
1122 |
+
file_put_contents( BackWPup::get_plugin_data( 'running_file' ), '<?php //'. serialize( $this ), LOCK_EX );
|
|
|
1123 |
|
1124 |
return TRUE;
|
1125 |
}
|
1134 |
$this->step_working = 'END';
|
1135 |
$this->substeps_todo = 1;
|
1136 |
|
|
|
|
|
|
|
|
|
1137 |
//delete old logs
|
1138 |
if ( BackWPup_Option::get( 'cfg', 'maxlogs' ) ) {
|
1139 |
$logfilelist = array();
|
1157 |
}
|
1158 |
|
1159 |
//Display job working time
|
1160 |
+
if ( $this->errors > 0 )
|
1161 |
+
$this->log( sprintf( __( 'Job has ended with errors in %s seconds. You must resolve the errors for correct execution.', 'backwpup' ), current_time( 'timestamp' ) - $this->start_time, E_USER_ERROE ) );
|
1162 |
+
elseif ( $this->warnings > 0 )
|
1163 |
+
$this->log( sprintf( __( 'Job has done with warnings in %s seconds. Please resolve them for correct execution.', 'backwpup' ), current_time( 'timestamp' ) - $this->start_time, E_USER_WARNING ) );
|
1164 |
+
else
|
1165 |
+
$this->log( sprintf( __( 'Job done in %s seconds.', 'backwpup' ), current_time( 'timestamp' ) - $this->start_time, E_USER_NOTICE ) );
|
1166 |
|
1167 |
//clean up temp
|
1168 |
if ( ! empty( $this->backup_file ) && is_file( BackWPup::get_plugin_data( 'TEMP' ) . $this->backup_file ) )
|
1176 |
}
|
1177 |
}
|
1178 |
//delete running file
|
1179 |
+
delete_site_option( 'backwpup_working_job' );
|
1180 |
if ( is_file( BackWPup::get_plugin_data( 'running_file' ) ) )
|
1181 |
unlink( BackWPup::get_plugin_data( 'running_file' ) );
|
1182 |
|
1265 |
exit();
|
1266 |
}
|
1267 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1268 |
/**
|
1269 |
*
|
1270 |
* Increase automatically the memory that is needed
|
inc/class-jobtype-dbcheck.php
CHANGED
@@ -23,7 +23,7 @@ class BackWPup_JobType_DBCheck extends BackWPup_JobTypes {
|
|
23 |
* @return array
|
24 |
*/
|
25 |
public function option_defaults() {
|
26 |
-
return array( 'dbcheckwponly' => TRUE, '
|
27 |
}
|
28 |
|
29 |
|
@@ -35,7 +35,7 @@ class BackWPup_JobType_DBCheck extends BackWPup_JobTypes {
|
|
35 |
<h3 class="title"><?php _e( 'Settings for database check', 'backwpup' ) ?></h3>
|
36 |
<p></p>
|
37 |
<table class="form-table">
|
38 |
-
<tr
|
39 |
<th scope="row"><?php _e( 'WordPress tables only', 'backwpup' ); ?></th>
|
40 |
<td>
|
41 |
<label for="iddbcheckwponly">
|
@@ -45,17 +45,7 @@ class BackWPup_JobType_DBCheck extends BackWPup_JobTypes {
|
|
45 |
</label>
|
46 |
</td>
|
47 |
</tr>
|
48 |
-
<tr
|
49 |
-
<th scope="row"><?php _e( 'Maintenance mode', 'backwpup' ); ?></th>
|
50 |
-
<td>
|
51 |
-
<label for="iddbcheckmaintenance">
|
52 |
-
<input class="checkbox" value="1" id="iddbcheckmaintenance"
|
53 |
-
type="checkbox" <?php checked( BackWPup_Option::get( $jobid, 'dbcheckmaintenance' ), TRUE ); ?>
|
54 |
-
name="dbcheckmaintenance" /> <?php _e( 'Activate maintenance mode during table check', 'backwpup' ); ?>
|
55 |
-
</label>
|
56 |
-
</td>
|
57 |
-
</tr>
|
58 |
-
<tr valign="top">
|
59 |
<th scope="row"><?php _e( 'Repair', 'backwpup' ); ?></th>
|
60 |
<td>
|
61 |
<label for="iddbcheckrepair">
|
@@ -75,7 +65,6 @@ class BackWPup_JobType_DBCheck extends BackWPup_JobTypes {
|
|
75 |
*/
|
76 |
public function edit_form_post_save( $jobid ) {
|
77 |
BackWPup_Option::update( $jobid, 'dbcheckwponly', ( isset( $_POST[ 'dbcheckwponly' ] ) && $_POST[ 'dbcheckwponly' ] == 1 ) ? TRUE : FALSE );
|
78 |
-
BackWPup_Option::update( $jobid, 'dbcheckmaintenance', ( isset( $_POST[ 'dbcheckmaintenance' ] ) && $_POST[ 'dbcheckmaintenance' ] == 1 ) ? TRUE : FALSE );
|
79 |
BackWPup_Option::update( $jobid, 'dbcheckrepair', ( isset( $_POST[ 'dbcheckrepair' ] ) && $_POST[ 'dbcheckrepair' ] == 1 ) ? TRUE : FALSE );
|
80 |
}
|
81 |
|
@@ -85,6 +74,7 @@ class BackWPup_JobType_DBCheck extends BackWPup_JobTypes {
|
|
85 |
*/
|
86 |
public function job_run( $job_object ) {
|
87 |
global $wpdb;
|
|
|
88 |
|
89 |
$job_object->log( sprintf( __( '%d. Trying to check database …', 'backwpup' ), $job_object->steps_data[ $job_object->step_working ][ 'STEP_TRY' ] ) );
|
90 |
if ( ! isset( $job_object->steps_data[ $job_object->step_working ][ 'DONETABLE' ] ) || ! is_array( $job_object->steps_data[ $job_object->step_working ][ 'DONETABLE' ] ) )
|
@@ -92,6 +82,7 @@ class BackWPup_JobType_DBCheck extends BackWPup_JobTypes {
|
|
92 |
|
93 |
//to check
|
94 |
$tables = array();
|
|
|
95 |
$restables = $wpdb->get_results( 'SHOW FULL TABLES FROM `' . DB_NAME . '`', ARRAY_N );
|
96 |
foreach ( $restables as $table ) {
|
97 |
if ( $job_object->job[ 'dbcheckwponly' ] && substr( $table[ 0 ], 0, strlen( $wpdb->prefix ) ) != $wpdb->prefix )
|
@@ -104,6 +95,7 @@ class BackWPup_JobType_DBCheck extends BackWPup_JobTypes {
|
|
104 |
$job_object->substeps_todo = sizeof( $tables );
|
105 |
|
106 |
//Get table status
|
|
|
107 |
$resstatus = $wpdb->get_results( "SHOW TABLE STATUS FROM `" . DB_NAME . "`", ARRAY_A );
|
108 |
foreach ( $resstatus as $tablestatus ) {
|
109 |
$status[ $tablestatus[ 'Name' ] ] = $tablestatus;
|
@@ -111,8 +103,6 @@ class BackWPup_JobType_DBCheck extends BackWPup_JobTypes {
|
|
111 |
|
112 |
//check tables
|
113 |
if ( $job_object->substeps_todo > 0 ) {
|
114 |
-
if ( ! empty( $job_object->job[ 'dbcheckmaintenance' ] ) )
|
115 |
-
$job_object->set_maintenance_mode( TRUE );
|
116 |
foreach ( $tables as $table ) {
|
117 |
if ( in_array( $table, $job_object->steps_data[ $job_object->step_working ][ 'DONETABLE' ] ) )
|
118 |
continue;
|
@@ -149,7 +139,6 @@ class BackWPup_JobType_DBCheck extends BackWPup_JobTypes {
|
|
149 |
$job_object->steps_data[ $job_object->step_working ][ 'DONETABLE' ][ ] = $table;
|
150 |
$job_object->substeps_done ++;
|
151 |
}
|
152 |
-
$job_object->set_maintenance_mode( FALSE );
|
153 |
$job_object->log( __( 'Database check done!', 'backwpup' ) );
|
154 |
}
|
155 |
else {
|
23 |
* @return array
|
24 |
*/
|
25 |
public function option_defaults() {
|
26 |
+
return array( 'dbcheckwponly' => TRUE, 'dbcheckrepair' => FALSE );
|
27 |
}
|
28 |
|
29 |
|
35 |
<h3 class="title"><?php _e( 'Settings for database check', 'backwpup' ) ?></h3>
|
36 |
<p></p>
|
37 |
<table class="form-table">
|
38 |
+
<tr>
|
39 |
<th scope="row"><?php _e( 'WordPress tables only', 'backwpup' ); ?></th>
|
40 |
<td>
|
41 |
<label for="iddbcheckwponly">
|
45 |
</label>
|
46 |
</td>
|
47 |
</tr>
|
48 |
+
<tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
<th scope="row"><?php _e( 'Repair', 'backwpup' ); ?></th>
|
50 |
<td>
|
51 |
<label for="iddbcheckrepair">
|
65 |
*/
|
66 |
public function edit_form_post_save( $jobid ) {
|
67 |
BackWPup_Option::update( $jobid, 'dbcheckwponly', ( isset( $_POST[ 'dbcheckwponly' ] ) && $_POST[ 'dbcheckwponly' ] == 1 ) ? TRUE : FALSE );
|
|
|
68 |
BackWPup_Option::update( $jobid, 'dbcheckrepair', ( isset( $_POST[ 'dbcheckrepair' ] ) && $_POST[ 'dbcheckrepair' ] == 1 ) ? TRUE : FALSE );
|
69 |
}
|
70 |
|
74 |
*/
|
75 |
public function job_run( $job_object ) {
|
76 |
global $wpdb;
|
77 |
+
/* @var wpdb $wpdb */
|
78 |
|
79 |
$job_object->log( sprintf( __( '%d. Trying to check database …', 'backwpup' ), $job_object->steps_data[ $job_object->step_working ][ 'STEP_TRY' ] ) );
|
80 |
if ( ! isset( $job_object->steps_data[ $job_object->step_working ][ 'DONETABLE' ] ) || ! is_array( $job_object->steps_data[ $job_object->step_working ][ 'DONETABLE' ] ) )
|
82 |
|
83 |
//to check
|
84 |
$tables = array();
|
85 |
+
$tablestype = array();
|
86 |
$restables = $wpdb->get_results( 'SHOW FULL TABLES FROM `' . DB_NAME . '`', ARRAY_N );
|
87 |
foreach ( $restables as $table ) {
|
88 |
if ( $job_object->job[ 'dbcheckwponly' ] && substr( $table[ 0 ], 0, strlen( $wpdb->prefix ) ) != $wpdb->prefix )
|
95 |
$job_object->substeps_todo = sizeof( $tables );
|
96 |
|
97 |
//Get table status
|
98 |
+
$status = array();
|
99 |
$resstatus = $wpdb->get_results( "SHOW TABLE STATUS FROM `" . DB_NAME . "`", ARRAY_A );
|
100 |
foreach ( $resstatus as $tablestatus ) {
|
101 |
$status[ $tablestatus[ 'Name' ] ] = $tablestatus;
|
103 |
|
104 |
//check tables
|
105 |
if ( $job_object->substeps_todo > 0 ) {
|
|
|
|
|
106 |
foreach ( $tables as $table ) {
|
107 |
if ( in_array( $table, $job_object->steps_data[ $job_object->step_working ][ 'DONETABLE' ] ) )
|
108 |
continue;
|
139 |
$job_object->steps_data[ $job_object->step_working ][ 'DONETABLE' ][ ] = $table;
|
140 |
$job_object->substeps_done ++;
|
141 |
}
|
|
|
142 |
$job_object->log( __( 'Database check done!', 'backwpup' ) );
|
143 |
}
|
144 |
else {
|
inc/class-jobtype-dbdump.php
CHANGED
@@ -33,10 +33,10 @@ class BackWPup_JobType_DBDump extends BackWPup_JobTypes {
|
|
33 |
*/
|
34 |
public function option_defaults() {
|
35 |
global $wpdb;
|
36 |
-
|
|
|
37 |
$defaults = array(
|
38 |
-
'dbdumpexclude' => array(), 'dbdumpfile' => sanitize_file_name( DB_NAME ), 'dbdumptype' => 'sql', 'dbdumpfilecompression' => ''
|
39 |
-
'dbdumpmaintenance' => FALSE
|
40 |
);
|
41 |
//set only wordpress tables as default
|
42 |
$dbtables = $wpdb->get_results( 'SHOW TABLES FROM `' . DB_NAME . '`', ARRAY_N );
|
@@ -54,13 +54,14 @@ class BackWPup_JobType_DBDump extends BackWPup_JobTypes {
|
|
54 |
*/
|
55 |
public function edit_tab( $jobid ) {
|
56 |
global $wpdb;
|
57 |
-
|
|
|
58 |
?>
|
59 |
<input name="dbdumpwpony" type="hidden" value="1" />
|
60 |
<h3 class="title"><?php _e( 'Settings for database backup', 'backwpup' ) ?></h3>
|
61 |
<p></p>
|
62 |
<table class="form-table">
|
63 |
-
<tr
|
64 |
<th scope="row"><?php _e( 'Tables to backup', 'backwpup' ); ?></th>
|
65 |
<td>
|
66 |
<input type="button" class="button-secondary" id="dball" value="<?php _e( 'all', 'backwpup' ); ?>">
|
@@ -87,15 +88,7 @@ class BackWPup_JobType_DBDump extends BackWPup_JobTypes {
|
|
87 |
?>
|
88 |
</td>
|
89 |
</tr>
|
90 |
-
<tr
|
91 |
-
<th scope="row"><?php _e( 'Maintenance mode', 'backwpup' ); ?></th>
|
92 |
-
<td>
|
93 |
-
<label for="iddbdumpmaintenance"><input class="checkbox" value="1" id="iddbdumpmaintenance"
|
94 |
-
type="checkbox" <?php checked( BackWPup_Option::get( $jobid, 'dbdumpmaintenance' ), TRUE ); ?>
|
95 |
-
name="dbdumpmaintenance" /> <?php _e( 'Activate maintenance mode on database dump', 'backwpup' ); ?></label>
|
96 |
-
</td>
|
97 |
-
</tr>
|
98 |
-
<tr valign="top">
|
99 |
<th scope="row"><label for="iddbdumpfile"><?php _e( 'Dumpfile name', 'backwpup' ) ?></label></th>
|
100 |
<td>
|
101 |
<input id="iddbdumpfile" name="dbdumpfile" type="text"
|
@@ -103,7 +96,7 @@ class BackWPup_JobType_DBDump extends BackWPup_JobTypes {
|
|
103 |
class="medium-text code"/>.sql
|
104 |
</td>
|
105 |
</tr>
|
106 |
-
<tr
|
107 |
<th scope="row"><?php _e( 'Dumpfile compression', 'backwpup' ) ?></th>
|
108 |
<td>
|
109 |
<?php
|
@@ -129,8 +122,8 @@ class BackWPup_JobType_DBDump extends BackWPup_JobTypes {
|
|
129 |
*/
|
130 |
public function edit_form_post_save( $id ) {
|
131 |
global $wpdb;
|
132 |
-
|
133 |
-
|
134 |
if ( $_POST[ 'dbdumpfilecompression' ] == '' || $_POST[ 'dbdumpfilecompression' ] == '.gz' || $_POST[ 'dbdumpfilecompression' ] == '.bz2' )
|
135 |
BackWPup_Option::update( $id, 'dbdumpfilecompression', $_POST[ 'dbdumpfilecompression' ] );
|
136 |
BackWPup_Option::update( $id, 'dbdumpfile', sanitize_file_name( $_POST[ 'dbdumpfile' ]) );
|
@@ -155,7 +148,6 @@ class BackWPup_JobType_DBDump extends BackWPup_JobTypes {
|
|
155 |
* @return bool
|
156 |
*/
|
157 |
public function job_run( $job_object ) {
|
158 |
-
global $wpdb;
|
159 |
|
160 |
$job_object->substeps_done = 0;
|
161 |
$job_object->substeps_todo = 1;
|
@@ -166,10 +158,6 @@ class BackWPup_JobType_DBDump extends BackWPup_JobTypes {
|
|
166 |
if ( empty( $job_object->temp[ 'dbdumpfile' ] ) )
|
167 |
$job_object->temp[ 'dbdumpfile' ] = $job_object->generate_filename( $job_object->job[ 'dbdumpfile' ], 'sql' ) . $job_object->job[ 'dbdumpfilecompression' ];
|
168 |
|
169 |
-
//Set maintenance
|
170 |
-
if ( ! empty( $job_object->job[ 'dbdumpmaintenance'] ) )
|
171 |
-
$job_object->set_maintenance_mode( TRUE );
|
172 |
-
|
173 |
try {
|
174 |
|
175 |
//Connect to Database
|
@@ -190,8 +178,6 @@ class BackWPup_JobType_DBDump extends BackWPup_JobTypes {
|
|
190 |
if ( $job_object->substeps_todo == 0 ) {
|
191 |
$job_object->log( __( 'No tables to dump.', 'backwpup' ), E_USER_WARNING );
|
192 |
unset( $sql_dump );
|
193 |
-
$job_object->set_maintenance_mode( FALSE );
|
194 |
-
|
195 |
return TRUE;
|
196 |
}
|
197 |
|
@@ -206,11 +192,9 @@ class BackWPup_JobType_DBDump extends BackWPup_JobTypes {
|
|
206 |
//dump footer
|
207 |
$sql_dump->dump_footer();
|
208 |
unset( $sql_dump );
|
209 |
-
$job_object->set_maintenance_mode( FALSE );
|
210 |
|
211 |
} catch ( Exception $e ) {
|
212 |
$job_object->log( $e->getMessage(), E_USER_ERROR, $e->getFile(), $e->getLine() );
|
213 |
-
$job_object->set_maintenance_mode( FALSE );
|
214 |
unset( $sql_dump );
|
215 |
return FALSE;
|
216 |
}
|
33 |
*/
|
34 |
public function option_defaults() {
|
35 |
global $wpdb;
|
36 |
+
/* @var wpdb $wpdb */
|
37 |
+
|
38 |
$defaults = array(
|
39 |
+
'dbdumpexclude' => array(), 'dbdumpfile' => sanitize_file_name( DB_NAME ), 'dbdumptype' => 'sql', 'dbdumpfilecompression' => ''
|
|
|
40 |
);
|
41 |
//set only wordpress tables as default
|
42 |
$dbtables = $wpdb->get_results( 'SHOW TABLES FROM `' . DB_NAME . '`', ARRAY_N );
|
54 |
*/
|
55 |
public function edit_tab( $jobid ) {
|
56 |
global $wpdb;
|
57 |
+
/* @var wpdb $wpdb */
|
58 |
+
|
59 |
?>
|
60 |
<input name="dbdumpwpony" type="hidden" value="1" />
|
61 |
<h3 class="title"><?php _e( 'Settings for database backup', 'backwpup' ) ?></h3>
|
62 |
<p></p>
|
63 |
<table class="form-table">
|
64 |
+
<tr>
|
65 |
<th scope="row"><?php _e( 'Tables to backup', 'backwpup' ); ?></th>
|
66 |
<td>
|
67 |
<input type="button" class="button-secondary" id="dball" value="<?php _e( 'all', 'backwpup' ); ?>">
|
88 |
?>
|
89 |
</td>
|
90 |
</tr>
|
91 |
+
<tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
<th scope="row"><label for="iddbdumpfile"><?php _e( 'Dumpfile name', 'backwpup' ) ?></label></th>
|
93 |
<td>
|
94 |
<input id="iddbdumpfile" name="dbdumpfile" type="text"
|
96 |
class="medium-text code"/>.sql
|
97 |
</td>
|
98 |
</tr>
|
99 |
+
<tr>
|
100 |
<th scope="row"><?php _e( 'Dumpfile compression', 'backwpup' ) ?></th>
|
101 |
<td>
|
102 |
<?php
|
122 |
*/
|
123 |
public function edit_form_post_save( $id ) {
|
124 |
global $wpdb;
|
125 |
+
/* @var wpdb $wpdb */
|
126 |
+
|
127 |
if ( $_POST[ 'dbdumpfilecompression' ] == '' || $_POST[ 'dbdumpfilecompression' ] == '.gz' || $_POST[ 'dbdumpfilecompression' ] == '.bz2' )
|
128 |
BackWPup_Option::update( $id, 'dbdumpfilecompression', $_POST[ 'dbdumpfilecompression' ] );
|
129 |
BackWPup_Option::update( $id, 'dbdumpfile', sanitize_file_name( $_POST[ 'dbdumpfile' ]) );
|
148 |
* @return bool
|
149 |
*/
|
150 |
public function job_run( $job_object ) {
|
|
|
151 |
|
152 |
$job_object->substeps_done = 0;
|
153 |
$job_object->substeps_todo = 1;
|
158 |
if ( empty( $job_object->temp[ 'dbdumpfile' ] ) )
|
159 |
$job_object->temp[ 'dbdumpfile' ] = $job_object->generate_filename( $job_object->job[ 'dbdumpfile' ], 'sql' ) . $job_object->job[ 'dbdumpfilecompression' ];
|
160 |
|
|
|
|
|
|
|
|
|
161 |
try {
|
162 |
|
163 |
//Connect to Database
|
178 |
if ( $job_object->substeps_todo == 0 ) {
|
179 |
$job_object->log( __( 'No tables to dump.', 'backwpup' ), E_USER_WARNING );
|
180 |
unset( $sql_dump );
|
|
|
|
|
181 |
return TRUE;
|
182 |
}
|
183 |
|
192 |
//dump footer
|
193 |
$sql_dump->dump_footer();
|
194 |
unset( $sql_dump );
|
|
|
195 |
|
196 |
} catch ( Exception $e ) {
|
197 |
$job_object->log( $e->getMessage(), E_USER_ERROR, $e->getFile(), $e->getLine() );
|
|
|
198 |
unset( $sql_dump );
|
199 |
return FALSE;
|
200 |
}
|
inc/class-jobtype-dboptimize.php
CHANGED
@@ -24,7 +24,7 @@ class BackWPup_JobType_DBOptimize extends BackWPup_JobTypes {
|
|
24 |
*/
|
25 |
public function option_defaults() {
|
26 |
|
27 |
-
return array( 'dboptimizewponly' => TRUE, 'dboptimizemyisam' => TRUE, 'dboptimizeinnodb' => TRUE
|
28 |
}
|
29 |
|
30 |
|
@@ -36,7 +36,7 @@ class BackWPup_JobType_DBOptimize extends BackWPup_JobTypes {
|
|
36 |
<h3 class="title"><?php _e( 'Settings for database optimization', 'backwpup' ) ?></h3>
|
37 |
<p></p>
|
38 |
<table class="form-table">
|
39 |
-
<tr
|
40 |
<th scope="row"><?php _e( 'WordPress tables only', 'backwpup' ); ?></th>
|
41 |
<td>
|
42 |
<label for="iddboptimizewponly">
|
@@ -46,18 +46,7 @@ class BackWPup_JobType_DBOptimize extends BackWPup_JobTypes {
|
|
46 |
</label>
|
47 |
</td>
|
48 |
</tr>
|
49 |
-
<tr
|
50 |
-
<th scope="row"><?php _e( 'Maintenance mode', 'backwpup' ); ?></th>
|
51 |
-
<td>
|
52 |
-
<label for="iddboptimizemaintenance">
|
53 |
-
<input class="checkbox" value="1" id="iddboptimizemaintenance"
|
54 |
-
type="checkbox" <?php checked( BackWPup_Option::get( $jobid, 'dboptimizemaintenance' ), TRUE ); ?>
|
55 |
-
name="dboptimizemaintenance" /> <?php _e( 'Activate maintenance mode during table optimize', 'backwpup' ); ?>
|
56 |
-
</label>
|
57 |
-
</td>
|
58 |
-
</tr>
|
59 |
-
|
60 |
-
<tr valign="top">
|
61 |
<th scope="row"><?php _e( 'Table types to optimize', 'backwpup' ); ?></th>
|
62 |
<td>
|
63 |
<fieldset>
|
@@ -86,7 +75,6 @@ class BackWPup_JobType_DBOptimize extends BackWPup_JobTypes {
|
|
86 |
public function edit_form_post_save( $jobid ) {
|
87 |
|
88 |
BackWPup_Option::update( $jobid, 'dboptimizewponly', ( isset( $_POST[ 'dboptimizewponly' ] ) && $_POST[ 'dboptimizewponly' ] == 1 ) ? TRUE : FALSE );
|
89 |
-
BackWPup_Option::update( $jobid, 'dboptimizemaintenance', ( isset( $_POST[ 'dboptimizemaintenance' ] ) && $_POST[ 'dboptimizemaintenance' ] == 1 ) ? TRUE : FALSE );
|
90 |
BackWPup_Option::update( $jobid, 'dboptimizemyisam', ( isset( $_POST[ 'dboptimizemyisam' ] ) && $_POST[ 'dboptimizemyisam' ] == 1 ) ? TRUE : FALSE );
|
91 |
BackWPup_Option::update( $jobid, 'dboptimizeinnodb', ( isset( $_POST[ 'dboptimizeinnodb' ] ) && $_POST[ 'dboptimizeinnodb' ] == 1 ) ? TRUE : FALSE );
|
92 |
}
|
@@ -97,13 +85,15 @@ class BackWPup_JobType_DBOptimize extends BackWPup_JobTypes {
|
|
97 |
*/
|
98 |
public function job_run( $job_object ) {
|
99 |
global $wpdb;
|
100 |
-
|
|
|
101 |
$job_object->log( sprintf( __( '%d. Trying to optimize database …', 'backwpup' ), $job_object->steps_data[ $job_object->step_working ][ 'STEP_TRY' ] ) );
|
102 |
if ( ! isset( $job_object->steps_data[ $job_object->step_working ][ 'DONETABLE' ] ) || ! is_array( $job_object->steps_data[ $job_object->step_working ][ 'DONETABLE' ] ) )
|
103 |
$job_object->steps_data[ $job_object->step_working ][ 'DONETABLE' ] = array();
|
104 |
|
105 |
//tables to optimize
|
106 |
$tables = array();
|
|
|
107 |
$restables = $wpdb->get_results( 'SHOW FULL TABLES FROM `' . DB_NAME . '`', ARRAY_N );
|
108 |
foreach ( $restables as $table ) {
|
109 |
if ( $job_object->job[ 'dboptimizewponly' ] && substr( $table[ 0 ], 0, strlen( $wpdb->prefix ) ) != $wpdb->prefix )
|
@@ -116,13 +106,12 @@ class BackWPup_JobType_DBOptimize extends BackWPup_JobTypes {
|
|
116 |
|
117 |
//Get table status
|
118 |
$resstatus = $wpdb->get_results( "SHOW TABLE STATUS FROM `" . DB_NAME . "`", ARRAY_A );
|
|
|
119 |
foreach ( $resstatus as $tablestatus ) {
|
120 |
$status[ $tablestatus[ 'Name' ] ] = $tablestatus;
|
121 |
}
|
122 |
|
123 |
if ( $job_object->substeps_todo > 0 ) {
|
124 |
-
if ( ! empty( $job_object->job[ 'dboptimizemaintenance' ] ) )
|
125 |
-
$job_object->set_maintenance_mode( TRUE );
|
126 |
foreach ( $tables as $table ) {
|
127 |
if ( in_array( $table, $job_object->steps_data[ $job_object->step_working ][ 'DONETABLE' ] ) )
|
128 |
continue;
|
@@ -152,7 +141,6 @@ class BackWPup_JobType_DBOptimize extends BackWPup_JobTypes {
|
|
152 |
$job_object->substeps_done ++;
|
153 |
}
|
154 |
$job_object->log( __( 'Database optimization done!', 'backwpup' ) );
|
155 |
-
$job_object->set_maintenance_mode( FALSE );
|
156 |
}
|
157 |
else {
|
158 |
$job_object->log( __( 'No tables to optimize.', 'backwpup' ), E_USER_WARNING );
|
24 |
*/
|
25 |
public function option_defaults() {
|
26 |
|
27 |
+
return array( 'dboptimizewponly' => TRUE, 'dboptimizemyisam' => TRUE, 'dboptimizeinnodb' => TRUE );
|
28 |
}
|
29 |
|
30 |
|
36 |
<h3 class="title"><?php _e( 'Settings for database optimization', 'backwpup' ) ?></h3>
|
37 |
<p></p>
|
38 |
<table class="form-table">
|
39 |
+
<tr>
|
40 |
<th scope="row"><?php _e( 'WordPress tables only', 'backwpup' ); ?></th>
|
41 |
<td>
|
42 |
<label for="iddboptimizewponly">
|
46 |
</label>
|
47 |
</td>
|
48 |
</tr>
|
49 |
+
<tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
<th scope="row"><?php _e( 'Table types to optimize', 'backwpup' ); ?></th>
|
51 |
<td>
|
52 |
<fieldset>
|
75 |
public function edit_form_post_save( $jobid ) {
|
76 |
|
77 |
BackWPup_Option::update( $jobid, 'dboptimizewponly', ( isset( $_POST[ 'dboptimizewponly' ] ) && $_POST[ 'dboptimizewponly' ] == 1 ) ? TRUE : FALSE );
|
|
|
78 |
BackWPup_Option::update( $jobid, 'dboptimizemyisam', ( isset( $_POST[ 'dboptimizemyisam' ] ) && $_POST[ 'dboptimizemyisam' ] == 1 ) ? TRUE : FALSE );
|
79 |
BackWPup_Option::update( $jobid, 'dboptimizeinnodb', ( isset( $_POST[ 'dboptimizeinnodb' ] ) && $_POST[ 'dboptimizeinnodb' ] == 1 ) ? TRUE : FALSE );
|
80 |
}
|
85 |
*/
|
86 |
public function job_run( $job_object ) {
|
87 |
global $wpdb;
|
88 |
+
/* @var wpdb $wpdb */
|
89 |
+
|
90 |
$job_object->log( sprintf( __( '%d. Trying to optimize database …', 'backwpup' ), $job_object->steps_data[ $job_object->step_working ][ 'STEP_TRY' ] ) );
|
91 |
if ( ! isset( $job_object->steps_data[ $job_object->step_working ][ 'DONETABLE' ] ) || ! is_array( $job_object->steps_data[ $job_object->step_working ][ 'DONETABLE' ] ) )
|
92 |
$job_object->steps_data[ $job_object->step_working ][ 'DONETABLE' ] = array();
|
93 |
|
94 |
//tables to optimize
|
95 |
$tables = array();
|
96 |
+
$tablestype = array();
|
97 |
$restables = $wpdb->get_results( 'SHOW FULL TABLES FROM `' . DB_NAME . '`', ARRAY_N );
|
98 |
foreach ( $restables as $table ) {
|
99 |
if ( $job_object->job[ 'dboptimizewponly' ] && substr( $table[ 0 ], 0, strlen( $wpdb->prefix ) ) != $wpdb->prefix )
|
106 |
|
107 |
//Get table status
|
108 |
$resstatus = $wpdb->get_results( "SHOW TABLE STATUS FROM `" . DB_NAME . "`", ARRAY_A );
|
109 |
+
$status = array();
|
110 |
foreach ( $resstatus as $tablestatus ) {
|
111 |
$status[ $tablestatus[ 'Name' ] ] = $tablestatus;
|
112 |
}
|
113 |
|
114 |
if ( $job_object->substeps_todo > 0 ) {
|
|
|
|
|
115 |
foreach ( $tables as $table ) {
|
116 |
if ( in_array( $table, $job_object->steps_data[ $job_object->step_working ][ 'DONETABLE' ] ) )
|
117 |
continue;
|
141 |
$job_object->substeps_done ++;
|
142 |
}
|
143 |
$job_object->log( __( 'Database optimization done!', 'backwpup' ) );
|
|
|
144 |
}
|
145 |
else {
|
146 |
$job_object->log( __( 'No tables to optimize.', 'backwpup' ), E_USER_WARNING );
|
inc/class-jobtype-file.php
CHANGED
@@ -60,7 +60,7 @@ class BackWPup_JobType_File extends BackWPup_JobTypes {
|
|
60 |
<h3 class="title"><?php _e( 'Folders to backup', 'backwpup' ) ?></h3>
|
61 |
<p></p>
|
62 |
<table class="form-table">
|
63 |
-
<tr
|
64 |
<th scope="row"><label for="idbackuproot"><?php _e( 'Backup root folder', 'backwpup' ); ?></label></th>
|
65 |
<td>
|
66 |
<?php
|
@@ -87,7 +87,7 @@ class BackWPup_JobType_File extends BackWPup_JobTypes {
|
|
87 |
</fieldset>
|
88 |
</td>
|
89 |
</tr>
|
90 |
-
<tr
|
91 |
<th scope="row"><label for="idbackupcontent"><?php _e( 'Backup content folder', 'backwpup' ); ?></label></th>
|
92 |
<td>
|
93 |
<?php
|
@@ -114,7 +114,7 @@ class BackWPup_JobType_File extends BackWPup_JobTypes {
|
|
114 |
</fieldset>
|
115 |
</td>
|
116 |
</tr>
|
117 |
-
<tr
|
118 |
<th scope="row"><label for="idbackupplugins"><?php _e( 'Backup plugins', 'backwpup' ); ?></label></th>
|
119 |
<td>
|
120 |
<?php
|
@@ -141,7 +141,7 @@ class BackWPup_JobType_File extends BackWPup_JobTypes {
|
|
141 |
</fieldset>
|
142 |
</td>
|
143 |
</tr>
|
144 |
-
<tr
|
145 |
<th scope="row"><label for="idbackupthemes"><?php _e( 'Backup themes', 'backwpup' ); ?></label></th>
|
146 |
<td>
|
147 |
<?php
|
@@ -168,7 +168,7 @@ class BackWPup_JobType_File extends BackWPup_JobTypes {
|
|
168 |
</fieldset>
|
169 |
</td>
|
170 |
</tr>
|
171 |
-
<tr
|
172 |
<th scope="row"><label for="idbackupuploads"><?php _e( 'Backup uploads folder', 'backwpup' ); ?></label></th>
|
173 |
<td>
|
174 |
<?php
|
@@ -195,7 +195,7 @@ class BackWPup_JobType_File extends BackWPup_JobTypes {
|
|
195 |
</fieldset>
|
196 |
</td>
|
197 |
</tr>
|
198 |
-
<tr
|
199 |
<th scope="row"><label for="dirinclude"><?php _e( 'Extra folders to backup', 'backwpup' ); ?></label> <?php BackWPup_Help::tip( __( 'Separate folder names with a line-break or a comma. Folders must be set with their absolute path!', 'backwpup' ) )?></th>
|
200 |
<td>
|
201 |
<textarea name="dirinclude" id="dirinclude" class="text code" rows="7" cols="50"><?php echo BackWPup_Option::get( $main, 'dirinclude' ); ?></textarea>
|
@@ -206,7 +206,7 @@ class BackWPup_JobType_File extends BackWPup_JobTypes {
|
|
206 |
<h3 class="title"><?php _e( 'Exclude from backup', 'backwpup' ) ?></h3>
|
207 |
<p></p>
|
208 |
<table class="form-table">
|
209 |
-
<tr
|
210 |
<th scope="row"><?php _e( 'Thumbnails in uploads', 'backwpup' ); ?></th>
|
211 |
<td>
|
212 |
<label for="idbackupexcludethumbs"><input class="checkbox"
|
@@ -214,7 +214,7 @@ class BackWPup_JobType_File extends BackWPup_JobTypes {
|
|
214 |
name="backupexcludethumbs" id="idbackupexcludethumbs" value="1" /> <?php _e( 'Don\'t backup thumbnails from the site\'s uploads folder.', 'backwpup' ); BackWPup_Help::add_tab( __( 'All images with -???x???. will be excluded. Use a plugin like Regenerate Thumbnails to rebuild them after a restore.', 'backwpup' ) );?></label>
|
215 |
</td>
|
216 |
</tr>
|
217 |
-
<tr
|
218 |
<th scope="row"><label for="idfileexclude"><?php _e( 'Exclude files/folders from backup', 'backwpup' ); ?></label> <?php BackWPup_Help::tip( __( 'Separate file / folder name parts with a line-break or a comma. For example /logs/,.log,.tmp', 'backwpup' ) )?></th>
|
219 |
<td>
|
220 |
<textarea name="fileexclude" id="idfileexclude" class="text code" rows="7" cols="50"><?php echo BackWPup_Option::get( $main, 'fileexclude' ); ?></textarea>
|
@@ -225,7 +225,7 @@ class BackWPup_JobType_File extends BackWPup_JobTypes {
|
|
225 |
<h3 class="title"><?php _e( 'Special option', 'backwpup' ) ?></h3>
|
226 |
<p></p>
|
227 |
<table class="form-table">
|
228 |
-
<tr
|
229 |
<th scope="row"><?php _e( 'Include special files', 'backwpup' ); ?></th>
|
230 |
<td>
|
231 |
<label for="idbackupspecialfiles"><input class="checkbox" id="idbackupspecialfiles"
|
60 |
<h3 class="title"><?php _e( 'Folders to backup', 'backwpup' ) ?></h3>
|
61 |
<p></p>
|
62 |
<table class="form-table">
|
63 |
+
<tr>
|
64 |
<th scope="row"><label for="idbackuproot"><?php _e( 'Backup root folder', 'backwpup' ); ?></label></th>
|
65 |
<td>
|
66 |
<?php
|
87 |
</fieldset>
|
88 |
</td>
|
89 |
</tr>
|
90 |
+
<tr>
|
91 |
<th scope="row"><label for="idbackupcontent"><?php _e( 'Backup content folder', 'backwpup' ); ?></label></th>
|
92 |
<td>
|
93 |
<?php
|
114 |
</fieldset>
|
115 |
</td>
|
116 |
</tr>
|
117 |
+
<tr>
|
118 |
<th scope="row"><label for="idbackupplugins"><?php _e( 'Backup plugins', 'backwpup' ); ?></label></th>
|
119 |
<td>
|
120 |
<?php
|
141 |
</fieldset>
|
142 |
</td>
|
143 |
</tr>
|
144 |
+
<tr>
|
145 |
<th scope="row"><label for="idbackupthemes"><?php _e( 'Backup themes', 'backwpup' ); ?></label></th>
|
146 |
<td>
|
147 |
<?php
|
168 |
</fieldset>
|
169 |
</td>
|
170 |
</tr>
|
171 |
+
<tr>
|
172 |
<th scope="row"><label for="idbackupuploads"><?php _e( 'Backup uploads folder', 'backwpup' ); ?></label></th>
|
173 |
<td>
|
174 |
<?php
|
195 |
</fieldset>
|
196 |
</td>
|
197 |
</tr>
|
198 |
+
<tr>
|
199 |
<th scope="row"><label for="dirinclude"><?php _e( 'Extra folders to backup', 'backwpup' ); ?></label> <?php BackWPup_Help::tip( __( 'Separate folder names with a line-break or a comma. Folders must be set with their absolute path!', 'backwpup' ) )?></th>
|
200 |
<td>
|
201 |
<textarea name="dirinclude" id="dirinclude" class="text code" rows="7" cols="50"><?php echo BackWPup_Option::get( $main, 'dirinclude' ); ?></textarea>
|
206 |
<h3 class="title"><?php _e( 'Exclude from backup', 'backwpup' ) ?></h3>
|
207 |
<p></p>
|
208 |
<table class="form-table">
|
209 |
+
<tr>
|
210 |
<th scope="row"><?php _e( 'Thumbnails in uploads', 'backwpup' ); ?></th>
|
211 |
<td>
|
212 |
<label for="idbackupexcludethumbs"><input class="checkbox"
|
214 |
name="backupexcludethumbs" id="idbackupexcludethumbs" value="1" /> <?php _e( 'Don\'t backup thumbnails from the site\'s uploads folder.', 'backwpup' ); BackWPup_Help::add_tab( __( 'All images with -???x???. will be excluded. Use a plugin like Regenerate Thumbnails to rebuild them after a restore.', 'backwpup' ) );?></label>
|
215 |
</td>
|
216 |
</tr>
|
217 |
+
<tr>
|
218 |
<th scope="row"><label for="idfileexclude"><?php _e( 'Exclude files/folders from backup', 'backwpup' ); ?></label> <?php BackWPup_Help::tip( __( 'Separate file / folder name parts with a line-break or a comma. For example /logs/,.log,.tmp', 'backwpup' ) )?></th>
|
219 |
<td>
|
220 |
<textarea name="fileexclude" id="idfileexclude" class="text code" rows="7" cols="50"><?php echo BackWPup_Option::get( $main, 'fileexclude' ); ?></textarea>
|
225 |
<h3 class="title"><?php _e( 'Special option', 'backwpup' ) ?></h3>
|
226 |
<p></p>
|
227 |
<table class="form-table">
|
228 |
+
<tr>
|
229 |
<th scope="row"><?php _e( 'Include special files', 'backwpup' ); ?></th>
|
230 |
<td>
|
231 |
<label for="idbackupspecialfiles"><input class="checkbox" id="idbackupspecialfiles"
|
inc/class-jobtype-wpexp.php
CHANGED
@@ -42,7 +42,7 @@ class BackWPup_JobType_WPEXP extends BackWPup_JobTypes {
|
|
42 |
public function edit_tab( $jobid ) {
|
43 |
?>
|
44 |
<table class="form-table">
|
45 |
-
<tr
|
46 |
<th scope="row"><?php _e( 'Items to export', 'backwpup' ) ?></th>
|
47 |
<td>
|
48 |
<p><label for="idwpexportcontent-all"><input type="radio" name="wpexportcontent" id="idwpexportcontent-all" value="all" <?php checked( BackWPup_Option::get( $jobid, 'wpexportcontent' ), 'all' ); ?> /> <?php _e( 'All content', 'backwpup' ); ?></label></p>
|
@@ -55,7 +55,7 @@ class BackWPup_JobType_WPEXP extends BackWPup_JobTypes {
|
|
55 |
<?php } ?>
|
56 |
</td>
|
57 |
</tr>
|
58 |
-
<tr
|
59 |
<th scope="row"><label for="idwpexportfile"><?php _e( 'XML Export file name', 'backwpup' ) ?></label></th>
|
60 |
<td>
|
61 |
<input name="wpexportfile" type="text" id="idwpexportfile"
|
@@ -63,7 +63,7 @@ class BackWPup_JobType_WPEXP extends BackWPup_JobTypes {
|
|
63 |
class="medium-text code"/>.xml
|
64 |
</td>
|
65 |
</tr>
|
66 |
-
<tr
|
67 |
<th scope="row"><?php _e( 'File compression', 'backwpup' ) ?></th>
|
68 |
<td>
|
69 |
<?php
|
@@ -115,8 +115,8 @@ class BackWPup_JobType_WPEXP extends BackWPup_JobTypes {
|
|
115 |
'content' => $job_object->job[ 'wpexportcontent' ]
|
116 |
);
|
117 |
@export_wp( $args ); //WP export
|
118 |
-
ob_flush(); //send rest of data
|
119 |
-
ob_end_clean(); //End output buffering
|
120 |
|
121 |
//add XML file to backup files
|
122 |
if ( is_readable( BackWPup::get_plugin_data( 'TEMP' ) . $job_object->temp[ 'wpexportfile' ] ) ) {
|
42 |
public function edit_tab( $jobid ) {
|
43 |
?>
|
44 |
<table class="form-table">
|
45 |
+
<tr>
|
46 |
<th scope="row"><?php _e( 'Items to export', 'backwpup' ) ?></th>
|
47 |
<td>
|
48 |
<p><label for="idwpexportcontent-all"><input type="radio" name="wpexportcontent" id="idwpexportcontent-all" value="all" <?php checked( BackWPup_Option::get( $jobid, 'wpexportcontent' ), 'all' ); ?> /> <?php _e( 'All content', 'backwpup' ); ?></label></p>
|
55 |
<?php } ?>
|
56 |
</td>
|
57 |
</tr>
|
58 |
+
<tr>
|
59 |
<th scope="row"><label for="idwpexportfile"><?php _e( 'XML Export file name', 'backwpup' ) ?></label></th>
|
60 |
<td>
|
61 |
<input name="wpexportfile" type="text" id="idwpexportfile"
|
63 |
class="medium-text code"/>.xml
|
64 |
</td>
|
65 |
</tr>
|
66 |
+
<tr>
|
67 |
<th scope="row"><?php _e( 'File compression', 'backwpup' ) ?></th>
|
68 |
<td>
|
69 |
<?php
|
115 |
'content' => $job_object->job[ 'wpexportcontent' ]
|
116 |
);
|
117 |
@export_wp( $args ); //WP export
|
118 |
+
@ob_flush(); //send rest of data
|
119 |
+
@ob_end_clean(); //End output buffering
|
120 |
|
121 |
//add XML file to backup files
|
122 |
if ( is_readable( BackWPup::get_plugin_data( 'TEMP' ) . $job_object->temp[ 'wpexportfile' ] ) ) {
|
inc/class-jobtype-wpplugin.php
CHANGED
@@ -41,7 +41,7 @@ class BackWPup_JobType_WPPlugin extends BackWPup_JobTypes {
|
|
41 |
public function edit_tab( $jobid ) {
|
42 |
?>
|
43 |
<table class="form-table">
|
44 |
-
<tr
|
45 |
<th scope="row"><label for="idpluginlistfile"><?php _e( 'Plugin list file name', 'backwpup' ) ?></label></th>
|
46 |
<td>
|
47 |
<input name="pluginlistfile" type="text" id="idpluginlistfile"
|
@@ -49,7 +49,7 @@ class BackWPup_JobType_WPPlugin extends BackWPup_JobTypes {
|
|
49 |
class="medium-text code"/>.txt
|
50 |
</td>
|
51 |
</tr>
|
52 |
-
<tr
|
53 |
<th scope="row"><?php _e( 'File compression', 'backwpup' ) ?></th>
|
54 |
<td>
|
55 |
<?php
|
41 |
public function edit_tab( $jobid ) {
|
42 |
?>
|
43 |
<table class="form-table">
|
44 |
+
<tr>
|
45 |
<th scope="row"><label for="idpluginlistfile"><?php _e( 'Plugin list file name', 'backwpup' ) ?></label></th>
|
46 |
<td>
|
47 |
<input name="pluginlistfile" type="text" id="idpluginlistfile"
|
49 |
class="medium-text code"/>.txt
|
50 |
</td>
|
51 |
</tr>
|
52 |
+
<tr>
|
53 |
<th scope="row"><?php _e( 'File compression', 'backwpup' ) ?></th>
|
54 |
<td>
|
55 |
<?php
|
inc/class-mysqldump.php
CHANGED
@@ -127,6 +127,7 @@ class BackWPup_MySQLDump {
|
|
127 |
|
128 |
//get table names and types from Database
|
129 |
$res = $this->mysqli->query( 'SHOW FULL TABLES FROM `' . $this->dbname . '`' );
|
|
|
130 |
if ( $this->mysqli->error )
|
131 |
throw new BackWPup_MySQLDump_Exception( sprintf( __( 'Database error %1$s for query %2$s', 'backwpup' ), $this->mysqli->error, 'SHOW FULL TABLES FROM `' . $this->dbname . '`' ) );
|
132 |
while ( $table = $res->fetch_array( MYSQLI_NUM ) ) {
|
@@ -137,6 +138,7 @@ class BackWPup_MySQLDump {
|
|
137 |
|
138 |
//get table info
|
139 |
$res = $this->mysqli->query( "SHOW TABLE STATUS FROM `" . $this->dbname . "`" );
|
|
|
140 |
if ( $this->mysqli->error )
|
141 |
throw new BackWPup_MySQLDump_Exception( sprintf( __( 'Database error %1$s for query %2$s', 'backwpup' ), $this->mysqli->error, "SHOW TABLE STATUS FROM `" .$this->dbname . "`" ) );
|
142 |
while ( $tablestatus = $res->fetch_assoc() ) {
|
@@ -171,6 +173,7 @@ class BackWPup_MySQLDump {
|
|
171 |
|
172 |
// get sql timezone
|
173 |
$res = $this->mysqli->query( "SELECT @@time_zone" );
|
|
|
174 |
$mysqltimezone = $res->fetch_row();
|
175 |
$mysqltimezone = $mysqltimezone[0];
|
176 |
$res->close();
|
@@ -214,6 +217,7 @@ class BackWPup_MySQLDump {
|
|
214 |
|
215 |
//dump Functions
|
216 |
$res = $this->mysqli->query( "SHOW FUNCTION STATUS" );
|
|
|
217 |
if ( $this->mysqli->error ) {
|
218 |
trigger_error( sprintf( __( 'Database error %1$s for query %2$s', 'backwpup' ), $this->mysqli->error, "SHOW FUNCTION STATUS" ), E_USER_WARNING );
|
219 |
} else {
|
@@ -226,6 +230,7 @@ class BackWPup_MySQLDump {
|
|
226 |
$create .= "/*!40101 SET character_set_client = '" . $this->mysqli->character_set_name() . "' */;\n";
|
227 |
//Dump the view structure
|
228 |
$res2 = $this->mysqli->query( "SHOW CREATE FUNCTION `" . $function_status[ 'Db' ] . "`.`" . $function_status[ 'Name' ] . "`" );
|
|
|
229 |
if ( $this->mysqli->error )
|
230 |
trigger_error( sprintf( __( 'Database error %1$s for query %2$s', 'backwpup' ), $this->mysqli->error, "SHOW CREATE FUNCTION `" . $function_status[ 'Db' ] . "`.`" . $function_status[ 'Name' ] . "`" ), E_USER_WARNING );
|
231 |
$create_function = $res2->fetch_assoc();
|
@@ -239,6 +244,7 @@ class BackWPup_MySQLDump {
|
|
239 |
|
240 |
//dump Procedures
|
241 |
$res = $this->mysqli->query( "SHOW PROCEDURE STATUS" );
|
|
|
242 |
if ( $this->mysqli->error ) {
|
243 |
trigger_error( sprintf( __( 'Database error %1$s for query %2$s', 'backwpup' ), $this->mysqli->error, "SHOW PROCEDURE STATUS" ), E_USER_WARNING );
|
244 |
} else {
|
@@ -251,6 +257,7 @@ class BackWPup_MySQLDump {
|
|
251 |
$create .= "/*!40101 SET character_set_client = '" . $this->mysqli->character_set_name() . "' */;\n";
|
252 |
//Dump the view structure
|
253 |
$res2 = $this->mysqli->query( "SHOW CREATE PROCEDURE `" . $procedure_status[ 'Db' ] . "`.`" . $procedure_status[ 'Name' ] . "`" );
|
|
|
254 |
if ( $this->mysqli->error )
|
255 |
trigger_error( sprintf( __( 'Database error %1$s for query %2$s', 'backwpup' ), $this->mysqli->error, "SHOW CREATE PROCEDURE `" . $procedure_status[ 'Db' ] . "`.`" . $procedure_status[ 'Name' ] . "`" ), E_USER_WARNING );
|
256 |
$create_procedure = $res2->fetch_assoc();
|
@@ -290,6 +297,7 @@ class BackWPup_MySQLDump {
|
|
290 |
$tablecreate .= "/*!40101 SET character_set_client = '" . $this->mysqli->character_set_name() . "' */;\n";
|
291 |
//Dump the view structure
|
292 |
$res = $this->mysqli->query( "SHOW CREATE VIEW `" . $table . "`" );
|
|
|
293 |
if ( $this->mysqli->error )
|
294 |
trigger_error( sprintf( __( 'Database error %1$s for query %2$s', 'backwpup' ), $this->mysqli->error, "SHOW CREATE VIEW `" . $table . "`" ), E_USER_WARNING );
|
295 |
$createview = $res->fetch_assoc();
|
@@ -311,6 +319,7 @@ class BackWPup_MySQLDump {
|
|
311 |
$tablecreate .= "/*!40101 SET character_set_client = '" . $this->mysqli->character_set_name() . "' */;\n";
|
312 |
//Dump the table structure
|
313 |
$res = $this->mysqli->query( "SHOW CREATE TABLE `" . $table . "`" );
|
|
|
314 |
if ( $this->mysqli->error )
|
315 |
trigger_error( sprintf( __( 'Database error %1$s for query %2$s', 'backwpup' ), $this->mysqli->error, "SHOW CREATE TABLE `" . $table . "`" ), E_USER_WARNING );
|
316 |
$createtable = $res->fetch_assoc();
|
@@ -325,6 +334,7 @@ class BackWPup_MySQLDump {
|
|
325 |
|
326 |
//get data from table
|
327 |
$res = $this->mysqli->query( "SELECT * FROM `" . $table . "`", MYSQLI_USE_RESULT );
|
|
|
328 |
if ( $this->mysqli->error )
|
329 |
trigger_error( sprintf( __( 'Database error %1$s for query %2$s', 'backwpup' ), $this->mysqli->error, "SELECT * FROM `" . $table . "`" ), E_USER_WARNING );
|
330 |
|
127 |
|
128 |
//get table names and types from Database
|
129 |
$res = $this->mysqli->query( 'SHOW FULL TABLES FROM `' . $this->dbname . '`' );
|
130 |
+
$GLOBALS[ 'wpdb' ]->num_queries ++;
|
131 |
if ( $this->mysqli->error )
|
132 |
throw new BackWPup_MySQLDump_Exception( sprintf( __( 'Database error %1$s for query %2$s', 'backwpup' ), $this->mysqli->error, 'SHOW FULL TABLES FROM `' . $this->dbname . '`' ) );
|
133 |
while ( $table = $res->fetch_array( MYSQLI_NUM ) ) {
|
138 |
|
139 |
//get table info
|
140 |
$res = $this->mysqli->query( "SHOW TABLE STATUS FROM `" . $this->dbname . "`" );
|
141 |
+
$GLOBALS[ 'wpdb' ]->num_queries ++;
|
142 |
if ( $this->mysqli->error )
|
143 |
throw new BackWPup_MySQLDump_Exception( sprintf( __( 'Database error %1$s for query %2$s', 'backwpup' ), $this->mysqli->error, "SHOW TABLE STATUS FROM `" .$this->dbname . "`" ) );
|
144 |
while ( $tablestatus = $res->fetch_assoc() ) {
|
173 |
|
174 |
// get sql timezone
|
175 |
$res = $this->mysqli->query( "SELECT @@time_zone" );
|
176 |
+
$GLOBALS[ 'wpdb' ]->num_queries ++;
|
177 |
$mysqltimezone = $res->fetch_row();
|
178 |
$mysqltimezone = $mysqltimezone[0];
|
179 |
$res->close();
|
217 |
|
218 |
//dump Functions
|
219 |
$res = $this->mysqli->query( "SHOW FUNCTION STATUS" );
|
220 |
+
$GLOBALS[ 'wpdb' ]->num_queries ++;
|
221 |
if ( $this->mysqli->error ) {
|
222 |
trigger_error( sprintf( __( 'Database error %1$s for query %2$s', 'backwpup' ), $this->mysqli->error, "SHOW FUNCTION STATUS" ), E_USER_WARNING );
|
223 |
} else {
|
230 |
$create .= "/*!40101 SET character_set_client = '" . $this->mysqli->character_set_name() . "' */;\n";
|
231 |
//Dump the view structure
|
232 |
$res2 = $this->mysqli->query( "SHOW CREATE FUNCTION `" . $function_status[ 'Db' ] . "`.`" . $function_status[ 'Name' ] . "`" );
|
233 |
+
$GLOBALS[ 'wpdb' ]->num_queries ++;
|
234 |
if ( $this->mysqli->error )
|
235 |
trigger_error( sprintf( __( 'Database error %1$s for query %2$s', 'backwpup' ), $this->mysqli->error, "SHOW CREATE FUNCTION `" . $function_status[ 'Db' ] . "`.`" . $function_status[ 'Name' ] . "`" ), E_USER_WARNING );
|
236 |
$create_function = $res2->fetch_assoc();
|
244 |
|
245 |
//dump Procedures
|
246 |
$res = $this->mysqli->query( "SHOW PROCEDURE STATUS" );
|
247 |
+
$GLOBALS[ 'wpdb' ]->num_queries ++;
|
248 |
if ( $this->mysqli->error ) {
|
249 |
trigger_error( sprintf( __( 'Database error %1$s for query %2$s', 'backwpup' ), $this->mysqli->error, "SHOW PROCEDURE STATUS" ), E_USER_WARNING );
|
250 |
} else {
|
257 |
$create .= "/*!40101 SET character_set_client = '" . $this->mysqli->character_set_name() . "' */;\n";
|
258 |
//Dump the view structure
|
259 |
$res2 = $this->mysqli->query( "SHOW CREATE PROCEDURE `" . $procedure_status[ 'Db' ] . "`.`" . $procedure_status[ 'Name' ] . "`" );
|
260 |
+
$GLOBALS[ 'wpdb' ]->num_queries ++;
|
261 |
if ( $this->mysqli->error )
|
262 |
trigger_error( sprintf( __( 'Database error %1$s for query %2$s', 'backwpup' ), $this->mysqli->error, "SHOW CREATE PROCEDURE `" . $procedure_status[ 'Db' ] . "`.`" . $procedure_status[ 'Name' ] . "`" ), E_USER_WARNING );
|
263 |
$create_procedure = $res2->fetch_assoc();
|
297 |
$tablecreate .= "/*!40101 SET character_set_client = '" . $this->mysqli->character_set_name() . "' */;\n";
|
298 |
//Dump the view structure
|
299 |
$res = $this->mysqli->query( "SHOW CREATE VIEW `" . $table . "`" );
|
300 |
+
$GLOBALS[ 'wpdb' ]->num_queries ++;
|
301 |
if ( $this->mysqli->error )
|
302 |
trigger_error( sprintf( __( 'Database error %1$s for query %2$s', 'backwpup' ), $this->mysqli->error, "SHOW CREATE VIEW `" . $table . "`" ), E_USER_WARNING );
|
303 |
$createview = $res->fetch_assoc();
|
319 |
$tablecreate .= "/*!40101 SET character_set_client = '" . $this->mysqli->character_set_name() . "' */;\n";
|
320 |
//Dump the table structure
|
321 |
$res = $this->mysqli->query( "SHOW CREATE TABLE `" . $table . "`" );
|
322 |
+
$GLOBALS[ 'wpdb' ]->num_queries ++;
|
323 |
if ( $this->mysqli->error )
|
324 |
trigger_error( sprintf( __( 'Database error %1$s for query %2$s', 'backwpup' ), $this->mysqli->error, "SHOW CREATE TABLE `" . $table . "`" ), E_USER_WARNING );
|
325 |
$createtable = $res->fetch_assoc();
|
334 |
|
335 |
//get data from table
|
336 |
$res = $this->mysqli->query( "SELECT * FROM `" . $table . "`", MYSQLI_USE_RESULT );
|
337 |
+
$GLOBALS[ 'wpdb' ]->num_queries ++;
|
338 |
if ( $this->mysqli->error )
|
339 |
trigger_error( sprintf( __( 'Database error %1$s for query %2$s', 'backwpup' ), $this->mysqli->error, "SELECT * FROM `" . $table . "`" ), E_USER_WARNING );
|
340 |
|
inc/class-page-backups.php
CHANGED
@@ -130,12 +130,6 @@ class BackWPup_Page_Backups extends WP_List_Table {
|
|
130 |
}
|
131 |
}
|
132 |
|
133 |
-
//by page
|
134 |
-
$start = intval( ( $this->get_pagenum() - 1 ) * $per_page );
|
135 |
-
$end = $start + $per_page;
|
136 |
-
if ( $end > count( $this->items ) )
|
137 |
-
$end = count( $this->items );
|
138 |
-
|
139 |
$this->set_pagination_args( array(
|
140 |
'total_items' => count( $this->items ),
|
141 |
'per_page' => $per_page,
|
130 |
}
|
131 |
}
|
132 |
|
|
|
|
|
|
|
|
|
|
|
|
|
133 |
$this->set_pagination_args( array(
|
134 |
'total_items' => count( $this->items ),
|
135 |
'per_page' => $per_page,
|
inc/class-page-backwpup.php
CHANGED
@@ -96,7 +96,8 @@ class BackWPup_Page_BackWPup {
|
|
96 |
<?php }
|
97 |
|
98 |
if ( class_exists( 'BackWPup_Features' ) ) {
|
99 |
-
|
|
|
100 |
foreach ( $wizards as $wizard_class ) {
|
101 |
//check permissions
|
102 |
if ( ! current_user_can( $wizard_class->info[ 'cap' ] ) )
|
@@ -239,17 +240,17 @@ class BackWPup_Page_BackWPup {
|
|
239 |
</thead>
|
240 |
<?php
|
241 |
//get next jobs
|
242 |
-
$job_object = BackWPup_Job::get_working_data();
|
243 |
$mainsactive = BackWPup_Option::get_job_ids( 'activetype', 'wpcron' );
|
244 |
sort( $mainsactive );
|
245 |
$alternate = TRUE;
|
246 |
// add working job if it not in active jobs
|
247 |
-
|
248 |
-
|
|
|
249 |
foreach ( $mainsactive as $jobid ) {
|
250 |
$name = BackWPup_Option::get( $jobid, 'name' );
|
251 |
-
if (
|
252 |
-
$runtime = current_time( 'timestamp' ) - $
|
253 |
if ( ! $alternate ) {
|
254 |
echo '<tr>';
|
255 |
$alternate = TRUE;
|
@@ -278,7 +279,7 @@ class BackWPup_Page_BackWPup {
|
|
278 |
echo '<td><a href="' . wp_nonce_url( network_admin_url( 'admin.php' ) . '?page=backwpupeditjob&jobid=' . $jobid, 'edit-job' ) . '" title="' . esc_attr( __( 'Edit Job', 'backwpup' ) ) . '">' . $name . '</a></td></tr>';
|
279 |
}
|
280 |
}
|
281 |
-
if ( empty( $mainsactive ) and ! $
|
282 |
echo '<tr><td colspan="2"><i>' . __( 'none', 'backwpup' ) . '</i></td></tr>';
|
283 |
}
|
284 |
?>
|
96 |
<?php }
|
97 |
|
98 |
if ( class_exists( 'BackWPup_Features' ) ) {
|
99 |
+
/* @var BackWPup_Wizards $wizard_class */
|
100 |
+
|
101 |
foreach ( $wizards as $wizard_class ) {
|
102 |
//check permissions
|
103 |
if ( ! current_user_can( $wizard_class->info[ 'cap' ] ) )
|
240 |
</thead>
|
241 |
<?php
|
242 |
//get next jobs
|
|
|
243 |
$mainsactive = BackWPup_Option::get_job_ids( 'activetype', 'wpcron' );
|
244 |
sort( $mainsactive );
|
245 |
$alternate = TRUE;
|
246 |
// add working job if it not in active jobs
|
247 |
+
$active_jobid = get_site_option( 'backwpup_working_job' );
|
248 |
+
if ( $active_jobid && ! in_array( $active_jobid, $mainsactive ) )
|
249 |
+
$mainsactive[ ] = $active_jobid;
|
250 |
foreach ( $mainsactive as $jobid ) {
|
251 |
$name = BackWPup_Option::get( $jobid, 'name' );
|
252 |
+
if ( ! empty( $active_jobid ) && $active_jobid == $jobid ) {
|
253 |
+
$runtime = current_time( 'timestamp' ) - BackWPup_Option::get( $active_jobid, 'lastrun' );
|
254 |
if ( ! $alternate ) {
|
255 |
echo '<tr>';
|
256 |
$alternate = TRUE;
|
279 |
echo '<td><a href="' . wp_nonce_url( network_admin_url( 'admin.php' ) . '?page=backwpupeditjob&jobid=' . $jobid, 'edit-job' ) . '" title="' . esc_attr( __( 'Edit Job', 'backwpup' ) ) . '">' . $name . '</a></td></tr>';
|
280 |
}
|
281 |
}
|
282 |
+
if ( empty( $mainsactive ) and ! $active_jobid ) {
|
283 |
echo '<tr><td colspan="2"><i>' . __( 'none', 'backwpup' ) . '</i></td></tr>';
|
284 |
}
|
285 |
?>
|
inc/class-page-editjob.php
CHANGED
@@ -58,7 +58,8 @@ class BackWPup_Page_Editjob {
|
|
58 |
} else {
|
59 |
$_POST[ 'type' ]= array();
|
60 |
}
|
61 |
-
//test if
|
|
|
62 |
$makes_file = FALSE;
|
63 |
foreach ( $job_types as $type_id => $job_type) {
|
64 |
if ( in_array( $type_id, $_POST[ 'type' ] ) ) {
|
@@ -416,7 +417,7 @@ class BackWPup_Page_Editjob {
|
|
416 |
<h3 class="title"><?php _e( 'Job Name', 'backwpup' ) ?></h3>
|
417 |
<p></p>
|
418 |
<table class="form-table">
|
419 |
-
<tr
|
420 |
<th scope="row"><label for="name"><?php _e( 'Please name this job.', 'backwpup' ) ?></label></th>
|
421 |
<td>
|
422 |
<input name="name" type="text" id="name"
|
@@ -428,7 +429,7 @@ class BackWPup_Page_Editjob {
|
|
428 |
<h3 class="title"><?php _e( 'Job Tasks', 'backwpup' ) ?></h3>
|
429 |
<p></p>
|
430 |
<table class="form-table">
|
431 |
-
<tr
|
432 |
<th scope="row"><?php _e( 'This job is a …', 'backwpup' ) ?></th>
|
433 |
<td>
|
434 |
<fieldset>
|
@@ -452,7 +453,7 @@ class BackWPup_Page_Editjob {
|
|
452 |
<p class="hasdests"></p>
|
453 |
<table class="form-table hasdests">
|
454 |
<?php if ( class_exists( 'BackWPup_Features', FALSE ) ) { ?>
|
455 |
-
<tr
|
456 |
<th scope="row"><?php _e( 'Backup type', 'backwpup' ); ?></th>
|
457 |
<td>
|
458 |
<fieldset>
|
@@ -470,7 +471,7 @@ class BackWPup_Page_Editjob {
|
|
470 |
</td>
|
471 |
</tr>
|
472 |
<?php } ?>
|
473 |
-
<tr
|
474 |
<th scope="row"><label for="archivename"><?php _e( 'Archive name', 'backwpup' ) ?></label></th>
|
475 |
<td>
|
476 |
<input name="archivename" type="text" id="archivename"
|
@@ -510,7 +511,7 @@ class BackWPup_Page_Editjob {
|
|
510 |
?>
|
511 |
</td>
|
512 |
</tr>
|
513 |
-
<tr
|
514 |
<th scope="row"><?php _e( 'Archive Format', 'backwpup' ); ?></th>
|
515 |
<td>
|
516 |
<fieldset>
|
@@ -537,7 +538,7 @@ class BackWPup_Page_Editjob {
|
|
537 |
<h3 class="title hasdests"><?php _e( 'Job Destination', 'backwpup' ) ?></h3>
|
538 |
<p class="hasdests"></p>
|
539 |
<table class="form-table hasdests">
|
540 |
-
<tr
|
541 |
<th scope="row"><?php _e( 'Where should your backup file be stored?', 'backwpup' ) ?></th>
|
542 |
<td>
|
543 |
<fieldset>
|
@@ -560,7 +561,7 @@ class BackWPup_Page_Editjob {
|
|
560 |
<h3 class="title"><?php _e( 'Log Files', 'backwpup' ) ?></h3>
|
561 |
<p></p>
|
562 |
<table class="form-table">
|
563 |
-
<tr
|
564 |
<th scope="row"><label for="mailaddresslog"><?php _e( 'Send log to e-mail address', 'backwpup' ) ?></label></th>
|
565 |
<td>
|
566 |
<input name="mailaddresslog" type="text" id="mailaddresslog"
|
@@ -568,7 +569,7 @@ class BackWPup_Page_Editjob {
|
|
568 |
class="regular-text" /><?php BackWPup_Help::tip( __( 'Leave empty to not have log sent.', 'backwpup' ) ); ?>
|
569 |
</td>
|
570 |
</tr>
|
571 |
-
<tr
|
572 |
<th scope="row"><label for="mailaddresssenderlog"><?php _e( 'E-Mail FROM field', 'backwpup' ) ?></label></th>
|
573 |
<td>
|
574 |
<input name="mailaddresssenderlog" type="text" id="mailaddresssenderlog"
|
@@ -576,7 +577,7 @@ class BackWPup_Page_Editjob {
|
|
576 |
class="regular-text" /><?php BackWPup_Help::tip( __( 'E-Mail "From" field (Name < you@your-email-address.tld >)', 'backwpup' ) ); ?>
|
577 |
</td>
|
578 |
</tr>
|
579 |
-
<tr
|
580 |
<th scope="row"><?php _e( 'Errors only', 'backwpup' ); ?></th>
|
581 |
<td>
|
582 |
<label for="idmailerroronly">
|
@@ -596,7 +597,7 @@ class BackWPup_Page_Editjob {
|
|
596 |
<h3 class="title"><?php _e( 'Job Schedule', 'backwpup' ) ?></h3>
|
597 |
<p></p>
|
598 |
<table class="form-table">
|
599 |
-
<tr
|
600 |
<th scope="row"><?php _e( 'Start job', 'backwpup' ); ?></th>
|
601 |
<td>
|
602 |
<fieldset>
|
@@ -623,7 +624,7 @@ class BackWPup_Page_Editjob {
|
|
623 |
</fieldset>
|
624 |
</td>
|
625 |
</tr>
|
626 |
-
<tr
|
627 |
<th scope="row"><?php _e( 'Start job with CLI', 'backwpup' ); ?></th>
|
628 |
<td>
|
629 |
<?php
|
@@ -636,7 +637,7 @@ class BackWPup_Page_Editjob {
|
|
636 |
<h3 class="title wpcron"><?php _e( 'Schedule execution time', 'backwpup' ) ?></h3>
|
637 |
<?php BackWPup_Page_Editjob::ajax_cron_text( array( 'cronstamp' => BackWPup_Option::get( $jobid, 'cron' ), 'crontype' => BackWPup_Option::get( $jobid, 'cronselect' ) ) ); ?>
|
638 |
<table class="form-table wpcron">
|
639 |
-
<tr
|
640 |
<th scope="row"><?php _e( 'Scheduler type', 'backwpup' ); ?></th>
|
641 |
<td>
|
642 |
<fieldset>
|
@@ -677,7 +678,7 @@ class BackWPup_Page_Editjob {
|
|
677 |
else
|
678 |
$wday = explode( ',', $cronstr[ 'wday' ] );
|
679 |
?>
|
680 |
-
<tr
|
681 |
<th scope="row"><?php _e( 'Scheduler', 'backwpup' ); ?></th>
|
682 |
<td>
|
683 |
<table id="wpcronbasic">
|
@@ -745,7 +746,7 @@ class BackWPup_Page_Editjob {
|
|
745 |
</table>
|
746 |
</td>
|
747 |
</tr>
|
748 |
-
<tr
|
749 |
<th scope="row"><?php _e( 'Scheduler', 'backwpup' ); ?></th>
|
750 |
<td>
|
751 |
<div id="cron-min-box">
|
58 |
} else {
|
59 |
$_POST[ 'type' ]= array();
|
60 |
}
|
61 |
+
//test if job type makes backup
|
62 |
+
/* @var BackWPup_JobTypes $job_type */
|
63 |
$makes_file = FALSE;
|
64 |
foreach ( $job_types as $type_id => $job_type) {
|
65 |
if ( in_array( $type_id, $_POST[ 'type' ] ) ) {
|
417 |
<h3 class="title"><?php _e( 'Job Name', 'backwpup' ) ?></h3>
|
418 |
<p></p>
|
419 |
<table class="form-table">
|
420 |
+
<tr>
|
421 |
<th scope="row"><label for="name"><?php _e( 'Please name this job.', 'backwpup' ) ?></label></th>
|
422 |
<td>
|
423 |
<input name="name" type="text" id="name"
|
429 |
<h3 class="title"><?php _e( 'Job Tasks', 'backwpup' ) ?></h3>
|
430 |
<p></p>
|
431 |
<table class="form-table">
|
432 |
+
<tr>
|
433 |
<th scope="row"><?php _e( 'This job is a …', 'backwpup' ) ?></th>
|
434 |
<td>
|
435 |
<fieldset>
|
453 |
<p class="hasdests"></p>
|
454 |
<table class="form-table hasdests">
|
455 |
<?php if ( class_exists( 'BackWPup_Features', FALSE ) ) { ?>
|
456 |
+
<tr>
|
457 |
<th scope="row"><?php _e( 'Backup type', 'backwpup' ); ?></th>
|
458 |
<td>
|
459 |
<fieldset>
|
471 |
</td>
|
472 |
</tr>
|
473 |
<?php } ?>
|
474 |
+
<tr class="nosync">
|
475 |
<th scope="row"><label for="archivename"><?php _e( 'Archive name', 'backwpup' ) ?></label></th>
|
476 |
<td>
|
477 |
<input name="archivename" type="text" id="archivename"
|
511 |
?>
|
512 |
</td>
|
513 |
</tr>
|
514 |
+
<tr class="nosync">
|
515 |
<th scope="row"><?php _e( 'Archive Format', 'backwpup' ); ?></th>
|
516 |
<td>
|
517 |
<fieldset>
|
538 |
<h3 class="title hasdests"><?php _e( 'Job Destination', 'backwpup' ) ?></h3>
|
539 |
<p class="hasdests"></p>
|
540 |
<table class="form-table hasdests">
|
541 |
+
<tr>
|
542 |
<th scope="row"><?php _e( 'Where should your backup file be stored?', 'backwpup' ) ?></th>
|
543 |
<td>
|
544 |
<fieldset>
|
561 |
<h3 class="title"><?php _e( 'Log Files', 'backwpup' ) ?></h3>
|
562 |
<p></p>
|
563 |
<table class="form-table">
|
564 |
+
<tr>
|
565 |
<th scope="row"><label for="mailaddresslog"><?php _e( 'Send log to e-mail address', 'backwpup' ) ?></label></th>
|
566 |
<td>
|
567 |
<input name="mailaddresslog" type="text" id="mailaddresslog"
|
569 |
class="regular-text" /><?php BackWPup_Help::tip( __( 'Leave empty to not have log sent.', 'backwpup' ) ); ?>
|
570 |
</td>
|
571 |
</tr>
|
572 |
+
<tr>
|
573 |
<th scope="row"><label for="mailaddresssenderlog"><?php _e( 'E-Mail FROM field', 'backwpup' ) ?></label></th>
|
574 |
<td>
|
575 |
<input name="mailaddresssenderlog" type="text" id="mailaddresssenderlog"
|
577 |
class="regular-text" /><?php BackWPup_Help::tip( __( 'E-Mail "From" field (Name < you@your-email-address.tld >)', 'backwpup' ) ); ?>
|
578 |
</td>
|
579 |
</tr>
|
580 |
+
<tr>
|
581 |
<th scope="row"><?php _e( 'Errors only', 'backwpup' ); ?></th>
|
582 |
<td>
|
583 |
<label for="idmailerroronly">
|
597 |
<h3 class="title"><?php _e( 'Job Schedule', 'backwpup' ) ?></h3>
|
598 |
<p></p>
|
599 |
<table class="form-table">
|
600 |
+
<tr>
|
601 |
<th scope="row"><?php _e( 'Start job', 'backwpup' ); ?></th>
|
602 |
<td>
|
603 |
<fieldset>
|
624 |
</fieldset>
|
625 |
</td>
|
626 |
</tr>
|
627 |
+
<tr>
|
628 |
<th scope="row"><?php _e( 'Start job with CLI', 'backwpup' ); ?></th>
|
629 |
<td>
|
630 |
<?php
|
637 |
<h3 class="title wpcron"><?php _e( 'Schedule execution time', 'backwpup' ) ?></h3>
|
638 |
<?php BackWPup_Page_Editjob::ajax_cron_text( array( 'cronstamp' => BackWPup_Option::get( $jobid, 'cron' ), 'crontype' => BackWPup_Option::get( $jobid, 'cronselect' ) ) ); ?>
|
639 |
<table class="form-table wpcron">
|
640 |
+
<tr>
|
641 |
<th scope="row"><?php _e( 'Scheduler type', 'backwpup' ); ?></th>
|
642 |
<td>
|
643 |
<fieldset>
|
678 |
else
|
679 |
$wday = explode( ',', $cronstr[ 'wday' ] );
|
680 |
?>
|
681 |
+
<tr class="wpcronbasic"<?php if ( BackWPup_Option::get( $jobid, 'cronselect' ) != 'basic' ) echo ' style="display:none;"';?>>
|
682 |
<th scope="row"><?php _e( 'Scheduler', 'backwpup' ); ?></th>
|
683 |
<td>
|
684 |
<table id="wpcronbasic">
|
746 |
</table>
|
747 |
</td>
|
748 |
</tr>
|
749 |
+
<tr class="wpcronadvanced"<?php if ( BackWPup_Option::get( $jobid, 'cronselect' ) != 'advanced' ) echo ' style="display:none;"';?>>
|
750 |
<th scope="row"><?php _e( 'Scheduler', 'backwpup' ); ?></th>
|
751 |
<td>
|
752 |
<div id="cron-min-box">
|
inc/class-page-jobs.php
CHANGED
@@ -343,12 +343,13 @@ class BackWPup_Page_Jobs extends WP_List_Table {
|
|
343 |
}
|
344 |
}
|
345 |
//check sever callback
|
|
|
346 |
$raw_response = wp_remote_get( site_url( 'wp-cron.php?backwpup_run=test' ), array(
|
347 |
'blocking' => TRUE,
|
348 |
'sslverify' => FALSE,
|
349 |
'timeout' => 15,
|
350 |
'redirection' => 0,
|
351 |
-
'headers' => array( 'Authorization' => 'Basic ' . base64_encode( BackWPup_Option::get( 'cfg', 'httpauthuser' ) . ':' . BackWPup_Encryption::decrypt( BackWPup_Option::get( 'cfg', 'httpauthpassword' ) ) ) ),
|
352 |
'user-agent' => BackWPup::get_plugin_data( 'user-agent' ) ) );
|
353 |
$test_result = '';
|
354 |
if ( is_wp_error( $raw_response ) )
|
@@ -361,20 +362,25 @@ class BackWPup_Page_Jobs extends WP_List_Table {
|
|
361 |
//only start job if messages empty
|
362 |
$log_messages = BackWPup_Admin::get_message();
|
363 |
if ( empty ( $log_messages ) ) {
|
364 |
-
$last_log = BackWPup_Option::get( $_GET[ 'jobid' ], 'logfile', NULL, FALSE );
|
365 |
BackWPup_Admin::message( sprintf( __( 'Job "%s" started.', 'backwpup' ), esc_attr( BackWPup_Option::get( $_GET[ 'jobid' ], 'name' ) ) ) );
|
366 |
-
BackWPup_Job::get_jobrun_url( 'runnow', $_GET[ 'jobid' ] );
|
367 |
-
|
|
|
368 |
$i=0;
|
369 |
-
|
370 |
-
|
|
|
371 |
clearstatcache();
|
372 |
-
|
373 |
-
|
|
|
374 |
break;
|
375 |
$i++;
|
376 |
}
|
377 |
-
|
|
|
|
|
|
|
378 |
}
|
379 |
}
|
380 |
break;
|
@@ -385,7 +391,10 @@ class BackWPup_Page_Jobs extends WP_List_Table {
|
|
385 |
$job_object = BackWPup_Job::get_working_data();
|
386 |
if ( ! $job_object )
|
387 |
break;
|
|
|
388 |
unlink( BackWPup::get_plugin_data( 'running_file' ) );
|
|
|
|
|
389 |
//remove restart cron
|
390 |
wp_clear_scheduled_hook( 'backwpup_cron', array( 'id' => 'restart' ) );
|
391 |
//add log entry
|
@@ -462,7 +471,7 @@ class BackWPup_Page_Jobs extends WP_List_Table {
|
|
462 |
echo '<h2>' . esc_html( sprintf( __( '%s Jobs', 'backwpup' ), BackWPup::get_plugin_data( 'name' ) ) ) . ' <a href="' . wp_nonce_url( network_admin_url( 'admin.php' ) . '?page=backwpupeditjob', 'edit-job' ) . '" class="button add-new-h2">' . esc_html__( 'Add New', 'backwpup' ) . '</a></h2>';
|
463 |
BackWPup_Admin::display_messages();
|
464 |
$job_object = BackWPup_Job::get_working_data();
|
465 |
-
if ( current_user_can( 'backwpup_jobs_start' ) &&
|
466 |
echo '<div id="runningjob">';
|
467 |
//read existing logfile
|
468 |
$logfiledata = file_get_contents( $job_object->logfile, FALSE, NULL, 0 );
|
@@ -479,13 +488,13 @@ class BackWPup_Page_Jobs extends WP_List_Table {
|
|
479 |
echo '<div id="runniginfos">';
|
480 |
echo '<h2 id="runningtitle">' . sprintf( __('Job currently running: %s','backwpup'), $job_object->job[ 'name' ] ) . '</h2>';
|
481 |
echo '<span id="warningsid">' . __( 'Warnings:', 'backwpup' ) . ' <span id="warnings">' . $job_object->warnings . '</span></span>';
|
482 |
-
echo '<span id="errorid">' . __( 'Errors:', 'backwpup' ) . ' <span id="errors">' . $job_object->errors . '</span></span>';
|
483 |
echo '<div class="infobuttons"><a href="#TB_inline?height=440&width=630&inlineId=tb-showworking" id="showworkingbutton" class="thickbox" title="' . __( 'Working job log', 'backwpup') . '">' . __( 'Display working log', 'backwpup' ) . '</a>';
|
484 |
echo '<a href="' . wp_nonce_url( network_admin_url( 'admin.php' ) . '?page=backwpupjobs&action=abort', 'abort-job' ) . '" id="abortbutton" class="backwpup-fancybox">' . __( 'Abort', 'backwpup' ) . '</a>';
|
485 |
echo '<a href="#" id="showworkingclose" title="' . __( 'Close working screen', 'backwpup') .'" style="display:none" >' . __( 'close', 'backwpup' ) . '</a></div>';
|
486 |
echo '</div>';
|
487 |
echo '<input type="hidden" name="logpos" id="logpos" value="' . strlen( $logfiledata ) . '">';
|
488 |
-
|
489 |
echo '<div class="progressbar"><div id="progressstep" style="width:' . $job_object->step_percent . '%;">' . $job_object->step_percent . '%</div></div>';
|
490 |
echo '<div id="onstep"><samp>' . $job_object->steps_data[ $job_object->step_working ][ 'NAME' ] . '</samp></div>';
|
491 |
echo '<div class="progressbar"><div id="progresssteps" style="width:' . $job_object->substep_percent . '%;">' . $job_object->substep_percent . '%</div></div>';
|
@@ -551,6 +560,9 @@ class BackWPup_Page_Jobs extends WP_List_Table {
|
|
551 |
if ( rundata.last_msg ) {
|
552 |
$('#lastmsg').replaceWith('<div id="lastmsg">' + rundata.last_msg + '</div>');
|
553 |
}
|
|
|
|
|
|
|
554 |
if ( rundata.job_done == 1 ) {
|
555 |
$("#abortbutton").remove();
|
556 |
$("#backwpup-adminbar-running").remove();
|
@@ -600,7 +612,10 @@ class BackWPup_Page_Jobs extends WP_List_Table {
|
|
600 |
if ( is_file( $logfile ) ) {
|
601 |
$job_object = BackWPup_Job::get_working_data();
|
602 |
$done = 0;
|
603 |
-
if (
|
|
|
|
|
|
|
604 |
$warnings = $job_object->warnings;
|
605 |
$errors = $job_object->errors;
|
606 |
$step_percent = $job_object->step_percent;
|
@@ -608,6 +623,7 @@ class BackWPup_Page_Jobs extends WP_List_Table {
|
|
608 |
$runtime = current_time( 'timestamp' ) - $job_object->start_time;
|
609 |
$onstep = $job_object->steps_data[ $job_object->step_working ][ 'NAME' ];
|
610 |
$lastmsg = $job_object->lastmsg;
|
|
|
611 |
}
|
612 |
else {
|
613 |
$logheader = BackWPup_Job::read_logheader( $logfile );
|
@@ -617,7 +633,13 @@ class BackWPup_Page_Jobs extends WP_List_Table {
|
|
617 |
$step_percent = 100;
|
618 |
$substep_percent = 100;
|
619 |
$onstep = __( 'Job end' , 'backwpup' );
|
620 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
621 |
}
|
622 |
|
623 |
if ( '.gz' == substr( $logfile, -3 ) )
|
@@ -654,7 +676,8 @@ class BackWPup_Page_Jobs extends WP_List_Table {
|
|
654 |
'step_percent' => $step_percent,
|
655 |
'on_step' => $onstep,
|
656 |
'last_msg' => $lastmsg,
|
657 |
-
'
|
|
|
658 |
'job_done' => $done
|
659 |
) );
|
660 |
}
|
343 |
}
|
344 |
}
|
345 |
//check sever callback
|
346 |
+
$wp_admin_user = get_users( array( 'role' => 'administrator' ) );
|
347 |
$raw_response = wp_remote_get( site_url( 'wp-cron.php?backwpup_run=test' ), array(
|
348 |
'blocking' => TRUE,
|
349 |
'sslverify' => FALSE,
|
350 |
'timeout' => 15,
|
351 |
'redirection' => 0,
|
352 |
+
'headers' => array( 'Authorization' => 'Basic ' . base64_encode( BackWPup_Option::get( 'cfg', 'httpauthuser' ) . ':' . BackWPup_Encryption::decrypt( BackWPup_Option::get( 'cfg', 'httpauthpassword' ) ) ), 'Cookie' => LOGGED_IN_COOKIE. '='. wp_generate_auth_cookie( $wp_admin_user[ 0 ]->ID, time() + 60, 'logged_in') ),
|
353 |
'user-agent' => BackWPup::get_plugin_data( 'user-agent' ) ) );
|
354 |
$test_result = '';
|
355 |
if ( is_wp_error( $raw_response ) )
|
362 |
//only start job if messages empty
|
363 |
$log_messages = BackWPup_Admin::get_message();
|
364 |
if ( empty ( $log_messages ) ) {
|
|
|
365 |
BackWPup_Admin::message( sprintf( __( 'Job "%s" started.', 'backwpup' ), esc_attr( BackWPup_Option::get( $_GET[ 'jobid' ], 'name' ) ) ) );
|
366 |
+
BackWPup_Job::get_jobrun_url( 'runnow', $_GET[ 'jobid' ] );
|
367 |
+
usleep( 250000 ); //wait a quarter second
|
368 |
+
//sleep as long as job not started
|
369 |
$i=0;
|
370 |
+
$job_object = BackWPup_Job::get_working_data( TRUE );
|
371 |
+
while ( empty( $job_object->logfile ) ) {
|
372 |
+
usleep( 250000 ); //wait a quarter second for net try
|
373 |
clearstatcache();
|
374 |
+
$job_object = BackWPup_Job::get_working_data( TRUE );
|
375 |
+
//wait maximal 10 sec.
|
376 |
+
if ( $i >= 40 )
|
377 |
break;
|
378 |
$i++;
|
379 |
}
|
380 |
+
if ( ! empty( $job_object->logfile ) )
|
381 |
+
self::$logfile = $job_object->logfile;
|
382 |
+
else
|
383 |
+
self::$logfile = BackWPup_Option::get( $_GET[ 'jobid' ], 'logfile', NULL, FALSE );
|
384 |
}
|
385 |
}
|
386 |
break;
|
391 |
$job_object = BackWPup_Job::get_working_data();
|
392 |
if ( ! $job_object )
|
393 |
break;
|
394 |
+
delete_site_option( 'backwpup_working_job' );
|
395 |
unlink( BackWPup::get_plugin_data( 'running_file' ) );
|
396 |
+
if ( ! is_object( $job_object ) )
|
397 |
+
break;
|
398 |
//remove restart cron
|
399 |
wp_clear_scheduled_hook( 'backwpup_cron', array( 'id' => 'restart' ) );
|
400 |
//add log entry
|
471 |
echo '<h2>' . esc_html( sprintf( __( '%s Jobs', 'backwpup' ), BackWPup::get_plugin_data( 'name' ) ) ) . ' <a href="' . wp_nonce_url( network_admin_url( 'admin.php' ) . '?page=backwpupeditjob', 'edit-job' ) . '" class="button add-new-h2">' . esc_html__( 'Add New', 'backwpup' ) . '</a></h2>';
|
472 |
BackWPup_Admin::display_messages();
|
473 |
$job_object = BackWPup_Job::get_working_data();
|
474 |
+
if ( current_user_can( 'backwpup_jobs_start' ) && ! empty( $job_object->logfile ) ) {
|
475 |
echo '<div id="runningjob">';
|
476 |
//read existing logfile
|
477 |
$logfiledata = file_get_contents( $job_object->logfile, FALSE, NULL, 0 );
|
488 |
echo '<div id="runniginfos">';
|
489 |
echo '<h2 id="runningtitle">' . sprintf( __('Job currently running: %s','backwpup'), $job_object->job[ 'name' ] ) . '</h2>';
|
490 |
echo '<span id="warningsid">' . __( 'Warnings:', 'backwpup' ) . ' <span id="warnings">' . $job_object->warnings . '</span></span>';
|
491 |
+
echo '<span id="errorid">' . __( 'Errors:', 'backwpup' ) . ' <span id="errors">' . $job_object->errors . '</span></span>';
|
492 |
echo '<div class="infobuttons"><a href="#TB_inline?height=440&width=630&inlineId=tb-showworking" id="showworkingbutton" class="thickbox" title="' . __( 'Working job log', 'backwpup') . '">' . __( 'Display working log', 'backwpup' ) . '</a>';
|
493 |
echo '<a href="' . wp_nonce_url( network_admin_url( 'admin.php' ) . '?page=backwpupjobs&action=abort', 'abort-job' ) . '" id="abortbutton" class="backwpup-fancybox">' . __( 'Abort', 'backwpup' ) . '</a>';
|
494 |
echo '<a href="#" id="showworkingclose" title="' . __( 'Close working screen', 'backwpup') .'" style="display:none" >' . __( 'close', 'backwpup' ) . '</a></div>';
|
495 |
echo '</div>';
|
496 |
echo '<input type="hidden" name="logpos" id="logpos" value="' . strlen( $logfiledata ) . '">';
|
497 |
+
echo '<div id="lasterrormsg"></div>';
|
498 |
echo '<div class="progressbar"><div id="progressstep" style="width:' . $job_object->step_percent . '%;">' . $job_object->step_percent . '%</div></div>';
|
499 |
echo '<div id="onstep"><samp>' . $job_object->steps_data[ $job_object->step_working ][ 'NAME' ] . '</samp></div>';
|
500 |
echo '<div class="progressbar"><div id="progresssteps" style="width:' . $job_object->substep_percent . '%;">' . $job_object->substep_percent . '%</div></div>';
|
560 |
if ( rundata.last_msg ) {
|
561 |
$('#lastmsg').replaceWith('<div id="lastmsg">' + rundata.last_msg + '</div>');
|
562 |
}
|
563 |
+
if ( rundata.last_error_msg ) {
|
564 |
+
$('#lasterrormsg').replaceWith('<div id="lasterrormsg">' + rundata.last_error_msg + '</div>');
|
565 |
+
}
|
566 |
if ( rundata.job_done == 1 ) {
|
567 |
$("#abortbutton").remove();
|
568 |
$("#backwpup-adminbar-running").remove();
|
612 |
if ( is_file( $logfile ) ) {
|
613 |
$job_object = BackWPup_Job::get_working_data();
|
614 |
$done = 0;
|
615 |
+
if ( $job_object ) {
|
616 |
+
if ( ! is_object( $job_object ) ) {
|
617 |
+
die();
|
618 |
+
}
|
619 |
$warnings = $job_object->warnings;
|
620 |
$errors = $job_object->errors;
|
621 |
$step_percent = $job_object->step_percent;
|
623 |
$runtime = current_time( 'timestamp' ) - $job_object->start_time;
|
624 |
$onstep = $job_object->steps_data[ $job_object->step_working ][ 'NAME' ];
|
625 |
$lastmsg = $job_object->lastmsg;
|
626 |
+
$lasterrormsg = $job_object->lasterrormsg;
|
627 |
}
|
628 |
else {
|
629 |
$logheader = BackWPup_Job::read_logheader( $logfile );
|
633 |
$step_percent = 100;
|
634 |
$substep_percent = 100;
|
635 |
$onstep = __( 'Job end' , 'backwpup' );
|
636 |
+
if ( $errors > 0 )
|
637 |
+
$lastmsg = '<samp style="background-color:red;color:#fff">' . __( 'ERROR:', 'backwpup' ) . ' ' . sprintf( __( 'Job has ended with errors in %s seconds. You must resolve the errors for correct execution.', 'backwpup' ), $logheader[ 'runtime' ] ) . '</samp>';
|
638 |
+
elseif ( $warnings > 0 )
|
639 |
+
$lastmsg = '<samp style="background-color:#ffc000;color:#fff">' . __( 'WARNING:', 'backwpup' ) . ' ' . sprintf( __( 'Job has done with warnings in %s seconds. Please resolve them for correct execution.', 'backwpup' ), $logheader[ 'runtime' ] ) . '</samp>';
|
640 |
+
else
|
641 |
+
$lastmsg = '<samp>' . sprintf( __( 'Job done in %s seconds.', 'backwpup' ), $logheader[ 'runtime' ] ) . '</samp>';
|
642 |
+
$lasterrormsg = '';
|
643 |
}
|
644 |
|
645 |
if ( '.gz' == substr( $logfile, -3 ) )
|
676 |
'step_percent' => $step_percent,
|
677 |
'on_step' => $onstep,
|
678 |
'last_msg' => $lastmsg,
|
679 |
+
'last_error_msg' => $lasterrormsg,
|
680 |
+
'sub_step_percent'=> $substep_percent,
|
681 |
'job_done' => $done
|
682 |
) );
|
683 |
}
|
inc/class-page-settings.php
CHANGED
@@ -120,7 +120,7 @@ class BackWPup_Page_Settings {
|
|
120 |
<h3 class="title"><?php _e( 'Display Settings', 'backwpup' ); ?></h3>
|
121 |
<p><?php _e( 'Do you want to see BackWPup in the WordPress admin bar?', 'backwpup' ); ?></p>
|
122 |
<table class="form-table">
|
123 |
-
<tr
|
124 |
<th scope="row"><?php _e( 'Admin bar', 'backwpup' ); ?></th>
|
125 |
<td>
|
126 |
<fieldset>
|
@@ -133,7 +133,7 @@ class BackWPup_Page_Settings {
|
|
133 |
</fieldset>
|
134 |
</td>
|
135 |
</tr>
|
136 |
-
<tr
|
137 |
<th scope="row"><?php _e( 'Folder sizes', 'backwpup' ); ?></th>
|
138 |
<td>
|
139 |
<fieldset>
|
@@ -150,7 +150,7 @@ class BackWPup_Page_Settings {
|
|
150 |
<h3 class="title"><?php _e( 'Security', 'backwpup' ); ?></h3>
|
151 |
<p><?php _e( 'Security option for BackWPup', 'backwpup' ); ?></p>
|
152 |
<table class="form-table">
|
153 |
-
<tr
|
154 |
<th scope="row"><?php _e( 'Protect folders', 'backwpup' ); ?></th>
|
155 |
<td>
|
156 |
<fieldset>
|
@@ -174,7 +174,7 @@ class BackWPup_Page_Settings {
|
|
174 |
|
175 |
<p><?php _e( 'Every time BackWPup runs a backup job a log file is being generated. Choose where to store your log files and how many of them.', 'backwpup' ); ?></p>
|
176 |
<table class="form-table">
|
177 |
-
<tr
|
178 |
<th scope="row"><label for="logfolder"><?php _e( 'Log file folder', 'backwpup' ); ?></label></th>
|
179 |
<td>
|
180 |
<input name="logfolder" type="text" id="logfolder"
|
@@ -182,7 +182,7 @@ class BackWPup_Page_Settings {
|
|
182 |
class="regular-text code"/>
|
183 |
</td>
|
184 |
</tr>
|
185 |
-
<tr
|
186 |
<th scope="row"><label for="maxlogs"><?php _e( 'Maximum number of log files in folder', 'backwpup' ); ?></label>
|
187 |
</th>
|
188 |
<td>
|
@@ -191,7 +191,7 @@ class BackWPup_Page_Settings {
|
|
191 |
<?php BackWPup_Help::tip( __( 'Oldest files will be deleted first.', 'backwpup' ) ); ?>
|
192 |
</td>
|
193 |
</tr>
|
194 |
-
<tr
|
195 |
<th scope="row"><?php _e( 'Compression', 'backwpup' ); ?></th>
|
196 |
<td>
|
197 |
<fieldset>
|
@@ -211,7 +211,7 @@ class BackWPup_Page_Settings {
|
|
211 |
|
212 |
<p><?php _e( 'There are a couple of general options for backup jobs. Set them here.', 'backwpup' ); ?></p>
|
213 |
<table class="form-table">
|
214 |
-
<tr
|
215 |
<th scope="row">
|
216 |
<label for="jobstepretry"><?php _e( "Maximum number of retries for job steps", 'backwpup' ); ?></label></th>
|
217 |
<td>
|
@@ -220,7 +220,7 @@ class BackWPup_Page_Settings {
|
|
220 |
class="small-text code" />
|
221 |
</td>
|
222 |
</tr>
|
223 |
-
<tr
|
224 |
<th scope="row"><?php _e( 'Restart on every main step', 'backwpup' ); ?></th>
|
225 |
<td>
|
226 |
<fieldset>
|
@@ -235,7 +235,7 @@ class BackWPup_Page_Settings {
|
|
235 |
</fieldset>
|
236 |
</td>
|
237 |
</tr>
|
238 |
-
<tr
|
239 |
<th scope="row"><?php _e( 'Restart on archive creation', 'backwpup' ); ?></th>
|
240 |
<td>
|
241 |
<fieldset>
|
@@ -250,7 +250,7 @@ class BackWPup_Page_Settings {
|
|
250 |
</fieldset>
|
251 |
</td>
|
252 |
</tr>
|
253 |
-
<tr
|
254 |
<th scope="row"><?php _e( 'Method for creating ZIP archive', 'backwpup' ); ?></th>
|
255 |
<td>
|
256 |
<fieldset>
|
@@ -267,7 +267,7 @@ class BackWPup_Page_Settings {
|
|
267 |
</fieldset>
|
268 |
</td>
|
269 |
</tr>
|
270 |
-
<tr
|
271 |
<th scope="row">
|
272 |
<label for="jobrunauthkey"><?php _e( 'Key to start jobs externally with an URL', 'backwpup' ); ?></label>
|
273 |
</th>
|
@@ -277,7 +277,7 @@ class BackWPup_Page_Settings {
|
|
277 |
<?php BackWPup_Help::tip( __( 'empty = deactivated. Will be used to protect job starts from unauthorized persons.', 'backwpup' ) ); ?>
|
278 |
</td>
|
279 |
</tr>
|
280 |
-
<tr
|
281 |
<th scope="row"><?php _e( 'No translation', 'backwpup' ); ?></th>
|
282 |
<td>
|
283 |
<fieldset>
|
@@ -291,7 +291,7 @@ class BackWPup_Page_Settings {
|
|
291 |
</fieldset>
|
292 |
</td>
|
293 |
</tr>
|
294 |
-
<tr
|
295 |
<th scope="row"><?php _e( 'Reduce server load', 'backwpup' ); ?></th>
|
296 |
<td>
|
297 |
<fieldset>
|
@@ -318,7 +318,7 @@ class BackWPup_Page_Settings {
|
|
318 |
<h3 class="title"><?php _e( 'Authentication', 'backwpup' ); ?></h3>
|
319 |
<p><?php _e( 'Is your blog protected with HTTP basic authentication (.htaccess)? Then please set the username and password for authentication here.', 'backwpup' ); ?></p>
|
320 |
<table class="form-table">
|
321 |
-
<tr
|
322 |
<th scope="row"><label for="httpauthuser"><?php _e( 'Username:', 'backwpup' ); ?></label></th>
|
323 |
<td>
|
324 |
<input name="httpauthuser" type="text" id="httpauthuser"
|
@@ -326,7 +326,7 @@ class BackWPup_Page_Settings {
|
|
326 |
class="regular-text" autocomplete="off" />
|
327 |
</td>
|
328 |
</tr>
|
329 |
-
<tr
|
330 |
<th scope="row"><label for="httpauthpassword"><?php _e( 'Password:', 'backwpup' ); ?></label></th>
|
331 |
<td>
|
332 |
<input name="httpauthpassword" type="password" id="httpauthpassword"
|
@@ -365,12 +365,13 @@ class BackWPup_Page_Settings {
|
|
365 |
echo '<tr title=""><td>' . __( 'cURL version', 'backwpup' ) . '</td><td>' . __( 'unavailable', 'backwpup' ) . '</td></tr>';
|
366 |
}
|
367 |
//response test
|
|
|
368 |
$raw_response = wp_remote_get( site_url( 'wp-cron.php?backwpup_run=test' ), array(
|
369 |
'blocking' => TRUE,
|
370 |
'sslverify' => FALSE,
|
371 |
'timeout' => 15,
|
372 |
'redirection' => 0,
|
373 |
-
'headers' => array( 'Authorization' => 'Basic ' . base64_encode( BackWPup_Option::get( 'cfg', 'httpauthuser' ) . ':' . BackWPup_Encryption::decrypt( BackWPup_Option::get( 'cfg', 'httpauthpassword' ) ) ) ),
|
374 |
'user-agent' => BackWPup::get_plugin_data( 'user-agent' ) ) );
|
375 |
echo '<tr><td>' . __( 'Server self connect:', 'backwpup' ) . '</td><td>';
|
376 |
$test_result = '';
|
120 |
<h3 class="title"><?php _e( 'Display Settings', 'backwpup' ); ?></h3>
|
121 |
<p><?php _e( 'Do you want to see BackWPup in the WordPress admin bar?', 'backwpup' ); ?></p>
|
122 |
<table class="form-table">
|
123 |
+
<tr>
|
124 |
<th scope="row"><?php _e( 'Admin bar', 'backwpup' ); ?></th>
|
125 |
<td>
|
126 |
<fieldset>
|
133 |
</fieldset>
|
134 |
</td>
|
135 |
</tr>
|
136 |
+
<tr>
|
137 |
<th scope="row"><?php _e( 'Folder sizes', 'backwpup' ); ?></th>
|
138 |
<td>
|
139 |
<fieldset>
|
150 |
<h3 class="title"><?php _e( 'Security', 'backwpup' ); ?></h3>
|
151 |
<p><?php _e( 'Security option for BackWPup', 'backwpup' ); ?></p>
|
152 |
<table class="form-table">
|
153 |
+
<tr>
|
154 |
<th scope="row"><?php _e( 'Protect folders', 'backwpup' ); ?></th>
|
155 |
<td>
|
156 |
<fieldset>
|
174 |
|
175 |
<p><?php _e( 'Every time BackWPup runs a backup job a log file is being generated. Choose where to store your log files and how many of them.', 'backwpup' ); ?></p>
|
176 |
<table class="form-table">
|
177 |
+
<tr>
|
178 |
<th scope="row"><label for="logfolder"><?php _e( 'Log file folder', 'backwpup' ); ?></label></th>
|
179 |
<td>
|
180 |
<input name="logfolder" type="text" id="logfolder"
|
182 |
class="regular-text code"/>
|
183 |
</td>
|
184 |
</tr>
|
185 |
+
<tr>
|
186 |
<th scope="row"><label for="maxlogs"><?php _e( 'Maximum number of log files in folder', 'backwpup' ); ?></label>
|
187 |
</th>
|
188 |
<td>
|
191 |
<?php BackWPup_Help::tip( __( 'Oldest files will be deleted first.', 'backwpup' ) ); ?>
|
192 |
</td>
|
193 |
</tr>
|
194 |
+
<tr>
|
195 |
<th scope="row"><?php _e( 'Compression', 'backwpup' ); ?></th>
|
196 |
<td>
|
197 |
<fieldset>
|
211 |
|
212 |
<p><?php _e( 'There are a couple of general options for backup jobs. Set them here.', 'backwpup' ); ?></p>
|
213 |
<table class="form-table">
|
214 |
+
<tr>
|
215 |
<th scope="row">
|
216 |
<label for="jobstepretry"><?php _e( "Maximum number of retries for job steps", 'backwpup' ); ?></label></th>
|
217 |
<td>
|
220 |
class="small-text code" />
|
221 |
</td>
|
222 |
</tr>
|
223 |
+
<tr>
|
224 |
<th scope="row"><?php _e( 'Restart on every main step', 'backwpup' ); ?></th>
|
225 |
<td>
|
226 |
<fieldset>
|
235 |
</fieldset>
|
236 |
</td>
|
237 |
</tr>
|
238 |
+
<tr>
|
239 |
<th scope="row"><?php _e( 'Restart on archive creation', 'backwpup' ); ?></th>
|
240 |
<td>
|
241 |
<fieldset>
|
250 |
</fieldset>
|
251 |
</td>
|
252 |
</tr>
|
253 |
+
<tr>
|
254 |
<th scope="row"><?php _e( 'Method for creating ZIP archive', 'backwpup' ); ?></th>
|
255 |
<td>
|
256 |
<fieldset>
|
267 |
</fieldset>
|
268 |
</td>
|
269 |
</tr>
|
270 |
+
<tr>
|
271 |
<th scope="row">
|
272 |
<label for="jobrunauthkey"><?php _e( 'Key to start jobs externally with an URL', 'backwpup' ); ?></label>
|
273 |
</th>
|
277 |
<?php BackWPup_Help::tip( __( 'empty = deactivated. Will be used to protect job starts from unauthorized persons.', 'backwpup' ) ); ?>
|
278 |
</td>
|
279 |
</tr>
|
280 |
+
<tr>
|
281 |
<th scope="row"><?php _e( 'No translation', 'backwpup' ); ?></th>
|
282 |
<td>
|
283 |
<fieldset>
|
291 |
</fieldset>
|
292 |
</td>
|
293 |
</tr>
|
294 |
+
<tr>
|
295 |
<th scope="row"><?php _e( 'Reduce server load', 'backwpup' ); ?></th>
|
296 |
<td>
|
297 |
<fieldset>
|
318 |
<h3 class="title"><?php _e( 'Authentication', 'backwpup' ); ?></h3>
|
319 |
<p><?php _e( 'Is your blog protected with HTTP basic authentication (.htaccess)? Then please set the username and password for authentication here.', 'backwpup' ); ?></p>
|
320 |
<table class="form-table">
|
321 |
+
<tr>
|
322 |
<th scope="row"><label for="httpauthuser"><?php _e( 'Username:', 'backwpup' ); ?></label></th>
|
323 |
<td>
|
324 |
<input name="httpauthuser" type="text" id="httpauthuser"
|
326 |
class="regular-text" autocomplete="off" />
|
327 |
</td>
|
328 |
</tr>
|
329 |
+
<tr>
|
330 |
<th scope="row"><label for="httpauthpassword"><?php _e( 'Password:', 'backwpup' ); ?></label></th>
|
331 |
<td>
|
332 |
<input name="httpauthpassword" type="password" id="httpauthpassword"
|
365 |
echo '<tr title=""><td>' . __( 'cURL version', 'backwpup' ) . '</td><td>' . __( 'unavailable', 'backwpup' ) . '</td></tr>';
|
366 |
}
|
367 |
//response test
|
368 |
+
$wp_admin_user = get_users( array( 'role' => 'administrator' ) );
|
369 |
$raw_response = wp_remote_get( site_url( 'wp-cron.php?backwpup_run=test' ), array(
|
370 |
'blocking' => TRUE,
|
371 |
'sslverify' => FALSE,
|
372 |
'timeout' => 15,
|
373 |
'redirection' => 0,
|
374 |
+
'headers' => array( 'Authorization' => 'Basic ' . base64_encode( BackWPup_Option::get( 'cfg', 'httpauthuser' ) . ':' . BackWPup_Encryption::decrypt( BackWPup_Option::get( 'cfg', 'httpauthpassword' ) ) ), 'Cookie' => LOGGED_IN_COOKIE. '='. wp_generate_auth_cookie( $wp_admin_user[ 0 ]->ID, time() + 60, 'logged_in') ),
|
375 |
'user-agent' => BackWPup::get_plugin_data( 'user-agent' ) ) );
|
376 |
echo '<tr><td>' . __( 'Server self connect:', 'backwpup' ) . '</td><td>';
|
377 |
$test_result = '';
|
inc/class-wp-cli.php
CHANGED
@@ -38,8 +38,13 @@ class BackWPup_WP_CLI extends WP_CLI_Command {
|
|
38 |
$job_object = BackWPup_Job::get_working_data();
|
39 |
if ( ! $job_object )
|
40 |
WP_CLI::error( __( 'Nothing to abort!', 'backwpup' ) );
|
41 |
-
|
|
|
42 |
unlink( BackWPup::get_plugin_data( 'running_file' ) );
|
|
|
|
|
|
|
|
|
43 |
//remove restart cron
|
44 |
wp_clear_scheduled_hook( 'backwpup_cron', array( 'id' => 'restart' ) );
|
45 |
//add log entry
|
@@ -106,6 +111,8 @@ class BackWPup_WP_CLI extends WP_CLI_Command {
|
|
106 |
$job_object = BackWPup_Job::get_working_data();
|
107 |
if ( ! $job_object )
|
108 |
WP_CLI::error( __( 'No job running', 'backwpup' ) );
|
|
|
|
|
109 |
WP_CLI::line( __('Running job', 'backwpup' ) );
|
110 |
WP_CLI::line( '----------------------------------------------------------------------' );
|
111 |
WP_CLI::line( sprintf( __( 'ID: %1$d Name: %2$s', 'backwpup' ), $job_object->job[ 'jobid' ], $job_object->job[ 'name' ] ) );
|
38 |
$job_object = BackWPup_Job::get_working_data();
|
39 |
if ( ! $job_object )
|
40 |
WP_CLI::error( __( 'Nothing to abort!', 'backwpup' ) );
|
41 |
+
|
42 |
+
delete_site_option( 'backwpup_working_job' );
|
43 |
unlink( BackWPup::get_plugin_data( 'running_file' ) );
|
44 |
+
|
45 |
+
if ( ! is_object( $job_object ) )
|
46 |
+
WP_CLI::error( __( 'Running file can\'t read. tra again.', 'backwpup' ) );
|
47 |
+
|
48 |
//remove restart cron
|
49 |
wp_clear_scheduled_hook( 'backwpup_cron', array( 'id' => 'restart' ) );
|
50 |
//add log entry
|
111 |
$job_object = BackWPup_Job::get_working_data();
|
112 |
if ( ! $job_object )
|
113 |
WP_CLI::error( __( 'No job running', 'backwpup' ) );
|
114 |
+
if ( ! is_object( $job_object ) )
|
115 |
+
WP_CLI::error( __( 'Running file can\'t read. tra again.', 'backwpup' ) );
|
116 |
WP_CLI::line( __('Running job', 'backwpup' ) );
|
117 |
WP_CLI::line( '----------------------------------------------------------------------' );
|
118 |
WP_CLI::line( sprintf( __( 'ID: %1$d Name: %2$s', 'backwpup' ), $job_object->job[ 'jobid' ], $job_object->job[ 'name' ] ) );
|
languages/backwpup-de_DE.mo
CHANGED
Binary file
|
languages/backwpup-de_DE.po
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
-
"Project-Id-Version: BackWPup Pro v3.0.
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
"POT-Creation-Date: 2013-02-06 17:42+0100\n"
|
6 |
-
"PO-Revision-Date: 2013-04-
|
7 |
"Last-Translator: Frank Bueltge <frank@bueltge.de>\n"
|
8 |
"Language-Team: INPSYDE <info@inpsyde.com>\n"
|
9 |
"MIME-Version: 1.0\n"
|
@@ -20,39 +20,39 @@ msgstr ""
|
|
20 |
"X-Poedit-SearchPath-0: ..\n"
|
21 |
"X-Textdomain-Support: yes"
|
22 |
|
23 |
-
#: inc/class-admin.php:
|
24 |
#: inc/features/class-documentation.php:150
|
25 |
#: inc/features/class-features.php:149
|
26 |
#@ backwpup
|
27 |
msgid "Documentation"
|
28 |
msgstr "Dokumentation"
|
29 |
|
30 |
-
#: inc/class-admin.php:
|
31 |
#@ backwpup
|
32 |
msgid "BackWPup Dashboard"
|
33 |
msgstr "BackWPup Dashboard"
|
34 |
|
35 |
-
#: inc/class-admin.php:
|
36 |
#@ backwpup
|
37 |
msgid "Dashboard"
|
38 |
msgstr "Dashboard"
|
39 |
|
40 |
-
#: inc/class-admin.php:
|
41 |
-
#: inc/class-adminbar.php:
|
42 |
#: inc/class-page-settings.php:103
|
43 |
#@ backwpup
|
44 |
#@ backwpupadminbar
|
45 |
msgid "Jobs"
|
46 |
msgstr "Aufträge"
|
47 |
|
48 |
-
#: inc/class-admin.php:
|
49 |
#@ backwpup
|
50 |
msgid "Add New Job"
|
51 |
msgstr "Neuer Auftrag"
|
52 |
|
53 |
-
#: inc/class-admin.php:
|
54 |
-
#: inc/class-adminbar.php:
|
55 |
-
#: inc/class-page-backups.php:
|
56 |
#: inc/class-page-logs.php:281
|
57 |
#: inc/class-page-settings.php:103
|
58 |
#@ backwpup
|
@@ -60,81 +60,82 @@ msgstr "Neuer Auftrag"
|
|
60 |
msgid "Logs"
|
61 |
msgstr "Protokolle"
|
62 |
|
63 |
-
#: inc/class-admin.php:
|
64 |
-
#: inc/class-adminbar.php:
|
65 |
#@ backwpup
|
66 |
#@ backwpupadminbar
|
67 |
msgid "Backups"
|
68 |
msgstr "Datensicherungen"
|
69 |
|
70 |
-
#: inc/class-admin.php:
|
71 |
#@ backwpup
|
72 |
msgid "Settings"
|
73 |
msgstr "Einstellungen"
|
74 |
|
75 |
-
#: inc/class-admin.php:
|
76 |
#@ backwpup
|
77 |
msgid "Jobs overview"
|
78 |
msgstr "Auftragsübersicht"
|
79 |
|
80 |
-
#: inc/class-admin.php:
|
81 |
#: inc/class-page-jobs.php:134
|
82 |
#@ backwpup
|
83 |
msgid "Run now"
|
84 |
msgstr "Jetzt starten"
|
85 |
|
86 |
-
#: inc/class-admin.php:
|
87 |
#, php-format
|
88 |
#@ backwpup
|
89 |
msgid "version %s"
|
90 |
msgstr "Version %s"
|
91 |
|
92 |
-
#: inc/class-adminbar.php:
|
93 |
#@ backwpupadminbar
|
94 |
msgid "BackWPup"
|
95 |
msgstr "BackWPup"
|
96 |
|
97 |
-
#: inc/class-adminbar.php:
|
98 |
#@ backwpupadminbar
|
99 |
msgid "Abort!"
|
100 |
msgstr "Abbrechen!"
|
101 |
|
102 |
-
#: inc/class-adminbar.php:
|
103 |
-
#: inc/class-page-jobs.php:
|
104 |
#@ backwpupadminbar
|
105 |
#@ backwpup
|
106 |
msgid "Add New"
|
107 |
msgstr "Neuer Auftrag"
|
108 |
|
109 |
#: inc/features/class-features.php:135
|
110 |
-
#: inc/features/class-features.php:
|
111 |
#@ backwpup
|
112 |
#@ backwpupadminbar
|
113 |
msgid "Wizards"
|
114 |
msgstr "Assistenten"
|
115 |
|
116 |
-
#: inc/class-adminbar.php:
|
117 |
#@ backwpupadminbar
|
118 |
msgid "Run Now"
|
119 |
msgstr "Jetzt starten"
|
120 |
|
121 |
#: inc/class-cron.php:53
|
122 |
-
#: inc/class-job.php:
|
123 |
-
#: inc/class-page-jobs.php:
|
124 |
-
#: inc/class-
|
|
|
125 |
#@ backwpup
|
126 |
msgid "ERROR:"
|
127 |
msgstr "FEHLER:"
|
128 |
|
129 |
#: inc/class-cron.php:84
|
130 |
-
#: inc/class-job.php:
|
131 |
#, php-format
|
132 |
#@ backwpup
|
133 |
msgid "[%3$s] BackWPup log %1$s: %2$s"
|
134 |
msgstr "[%3$s] BackWPup Log %1$s: %2$s"
|
135 |
|
136 |
#: inc/class-cron.php:84
|
137 |
-
#: inc/class-job.php:
|
138 |
#@ backwpup
|
139 |
msgid "ERROR"
|
140 |
msgstr "FEHLER"
|
@@ -150,85 +151,82 @@ msgstr "Dropbox"
|
|
150 |
msgid "Backup to Dropbox"
|
151 |
msgstr "Datensicherung in die Dropbox"
|
152 |
|
153 |
-
#: inc/class-destination-dropbox.php:
|
154 |
-
#: inc/features/class-destination-dropbox-pro.php:
|
155 |
#@ backwpup
|
156 |
msgid "Dropbox authentication complete!"
|
157 |
msgstr "Dropbox-Authentifizierung vollständig!"
|
158 |
|
159 |
-
#: inc/class-destination-dropbox.php:
|
160 |
-
#: inc/class-destination-dropbox.php:
|
161 |
-
#: inc/class-destination-dropbox.php:
|
162 |
-
#: inc/class-destination-dropbox.php:
|
163 |
-
#: inc/
|
164 |
-
#: inc/features/class-destination-dropbox-pro.php:
|
165 |
-
#: inc/features/class-destination-dropbox-pro.php:
|
|
|
166 |
#, php-format
|
167 |
#@ backwpup
|
168 |
msgid "Dropbox API: %s"
|
169 |
msgstr "Dropbox-API: %s"
|
170 |
|
171 |
-
#: inc/
|
172 |
-
#@ backwpup
|
173 |
-
msgid "Wrong token for Dropbox authentication received!"
|
174 |
-
msgstr "Falschen Token für die Dropbox-Authentifizierung erhalten!"
|
175 |
-
|
176 |
-
#: inc/class-destination-dropbox.php:105
|
177 |
#@ backwpup
|
178 |
msgid "Login"
|
179 |
msgstr "Anmelden"
|
180 |
|
181 |
-
#: inc/class-destination-dropbox.php:
|
182 |
-
#: inc/features/class-destination-dropbox-pro.php:
|
183 |
#@ backwpup
|
184 |
msgid "Authenticate"
|
185 |
msgstr "Authentifizieren"
|
186 |
|
187 |
-
#: inc/class-destination-dropbox.php:
|
188 |
-
#: inc/features/class-destination-dropbox-pro.php:
|
189 |
#@ backwpup
|
190 |
msgid "Not authenticated!"
|
191 |
msgstr "Nicht authentifiziert!"
|
192 |
|
193 |
-
#: inc/class-destination-dropbox.php:
|
194 |
-
#: inc/features/class-destination-dropbox-pro.php:
|
195 |
#@ backwpup
|
196 |
msgid "Create Account"
|
197 |
msgstr "Konto erstellen"
|
198 |
|
199 |
-
#: inc/class-destination-dropbox.php:
|
200 |
#: inc/class-destination-sugarsync.php:63
|
201 |
-
#: inc/features/class-destination-dropbox-pro.php:
|
202 |
#: inc/features/class-destination-sugarsync-pro.php:29
|
203 |
#@ backwpup
|
204 |
msgid "Authenticated!"
|
205 |
msgstr "Authentifiziert!"
|
206 |
|
207 |
-
#: inc/class-destination-dropbox.php:
|
208 |
#@ backwpup
|
209 |
msgid "Reauthenticate (Sandbox)"
|
210 |
msgstr "Neu authentifizieren (Sandbox)"
|
211 |
|
212 |
-
#: inc/class-destination-dropbox.php:
|
213 |
#@ backwpup
|
214 |
msgid "Reauthenticate (full Dropbox)"
|
215 |
msgstr "Neu authentifizieren (volle Dropbox)"
|
216 |
|
217 |
-
#: inc/class-destination-dropbox.php:
|
218 |
#: inc/class-destination-folder.php:41
|
219 |
#: inc/class-destination-ftp.php:67
|
220 |
#: inc/class-destination-msazure.php:86
|
|
|
221 |
#: inc/class-destination-sugarsync.php:100
|
222 |
#@ backwpup
|
223 |
msgid "Backup settings"
|
224 |
msgstr "Backup-Einstellungen"
|
225 |
|
226 |
-
#: inc/class-destination-dropbox.php:
|
227 |
#@ backwpup
|
228 |
msgid "Folder in Dropbox"
|
229 |
msgstr "Ordner in Dropbox"
|
230 |
|
231 |
-
#: inc/class-destination-dropbox.php:
|
232 |
#: inc/class-destination-folder.php:51
|
233 |
#: inc/class-destination-ftp.php:77
|
234 |
#: inc/class-destination-sugarsync.php:110
|
@@ -236,77 +234,77 @@ msgstr "Ordner in Dropbox"
|
|
236 |
msgid "File Deletion"
|
237 |
msgstr "Dateilöschung"
|
238 |
|
239 |
-
#: inc/class-destination-dropbox.php:
|
240 |
#: inc/class-destination-folder.php:57
|
241 |
#: inc/class-destination-msazure.php:102
|
242 |
-
#: inc/class-destination-rsc.php:
|
243 |
#: inc/class-destination-s3-v1.php:172
|
244 |
#: inc/class-destination-s3.php:177
|
245 |
#: inc/class-destination-sugarsync.php:116
|
246 |
-
#: inc/features/class-destination-dropbox-pro.php:
|
247 |
#: inc/features/class-destination-folder-pro.php:27
|
248 |
#: inc/features/class-destination-msazure-pro.php:32
|
249 |
#: inc/features/class-destination-rsc-pro.php:56
|
250 |
#: inc/features/class-destination-s3-pro.php:64
|
251 |
-
#: inc/features/class-destination-s3-v1-pro.php:
|
252 |
#@ backwpup
|
253 |
msgid "Number of files to keep in folder."
|
254 |
msgstr "Anzahl der Dateien, die im Ordner behalten werden"
|
255 |
|
256 |
-
#: inc/class-destination-dropbox.php:
|
257 |
#: inc/class-destination-folder.php:57
|
258 |
#: inc/class-destination-ftp.php:83
|
259 |
#: inc/class-destination-msazure.php:102
|
260 |
-
#: inc/class-destination-rsc.php:
|
261 |
#: inc/class-destination-s3-v1.php:172
|
262 |
#: inc/class-destination-s3.php:177
|
263 |
#: inc/class-destination-sugarsync.php:116
|
264 |
-
#: inc/features/class-destination-dropbox-pro.php:
|
265 |
#: inc/features/class-destination-folder-pro.php:27
|
266 |
#: inc/features/class-destination-msazure-pro.php:32
|
267 |
#: inc/features/class-destination-rsc-pro.php:56
|
268 |
#: inc/features/class-destination-s3-pro.php:64
|
269 |
-
#: inc/features/class-destination-s3-v1-pro.php:
|
270 |
#@ backwpup
|
271 |
msgid "Oldest files will be deleted first. 0 = no deletion"
|
272 |
msgstr "Älteste Dateien werden als erstes gelöscht. 0 = keine Löschung"
|
273 |
|
274 |
-
#: inc/class-destination-dropbox.php:
|
275 |
#: inc/class-destination-folder.php:61
|
276 |
#: inc/class-destination-ftp.php:87
|
277 |
#: inc/class-destination-msazure.php:106
|
278 |
-
#: inc/class-destination-rsc.php:
|
279 |
#: inc/class-destination-s3-v1.php:176
|
280 |
#: inc/class-destination-s3.php:181
|
281 |
#: inc/class-destination-sugarsync.php:120
|
282 |
-
#: inc/features/class-destination-dropbox-pro.php:
|
283 |
#: inc/features/class-destination-folder-pro.php:32
|
284 |
#: inc/features/class-destination-ftp-pro.php:42
|
285 |
#: inc/features/class-destination-msazure-pro.php:37
|
286 |
#: inc/features/class-destination-rsc-pro.php:61
|
287 |
#: inc/features/class-destination-s3-pro.php:69
|
288 |
-
#: inc/features/class-destination-s3-v1-pro.php:
|
289 |
#: inc/features/class-destination-sugarsync-pro.php:65
|
290 |
#@ backwpup
|
291 |
msgid "Do not delete files while syncing to destination!"
|
292 |
msgstr "Keine Dateien im Sync-Zielverzeichnis löschen!"
|
293 |
|
294 |
-
#: inc/class-destination-dropbox.php:
|
295 |
-
#: inc/class-destination-msazure.php:
|
296 |
#: inc/class-destination-sugarsync.php:272
|
297 |
#, php-format
|
298 |
#@ backwpup
|
299 |
msgid "Backup transferred to %s"
|
300 |
msgstr "Datensicherung übertragen zu %s"
|
301 |
|
302 |
-
#: inc/class-destination-dropbox.php:
|
303 |
#, php-format
|
304 |
#@ backwpup
|
305 |
msgid "Error on transfer backup to Dropbox: %s"
|
306 |
msgstr "Fehler beim Transfer des Backups zur Dropbox: %s"
|
307 |
|
308 |
#: inc/class-destination-folder.php:13
|
309 |
-
#: inc/class-page-backups.php:
|
310 |
#@ backwpup
|
311 |
msgid "Folder"
|
312 |
msgstr "Ordner"
|
@@ -316,7 +314,7 @@ msgstr "Ordner"
|
|
316 |
msgid "Backup to Folder"
|
317 |
msgstr "Datensicherung in Ordner"
|
318 |
|
319 |
-
#: inc/class-destination-folder.php:
|
320 |
#, php-format
|
321 |
#@ backwpup
|
322 |
msgid "One backup file deleted"
|
@@ -334,12 +332,12 @@ msgstr "FTP"
|
|
334 |
msgid "Backup to FTP"
|
335 |
msgstr "Backup zu FTP"
|
336 |
|
337 |
-
#: inc/features/class-jobtype-dbdump-pro.php:
|
338 |
#@ backwpup
|
339 |
msgid "Host:"
|
340 |
msgstr "Host (Server):"
|
341 |
|
342 |
-
#: inc/class-destination-email.php:
|
343 |
#: inc/class-destination-ftp.php:46
|
344 |
#: inc/features/class-destination-ftp-pro.php:17
|
345 |
#@ backwpup
|
@@ -347,7 +345,7 @@ msgid "Port:"
|
|
347 |
msgstr "Port:"
|
348 |
|
349 |
#: inc/class-destination-ftp.php:52
|
350 |
-
#: inc/class-destination-rsc.php:
|
351 |
#@ backwpup
|
352 |
msgid "Username"
|
353 |
msgstr "Benutzername"
|
@@ -470,69 +468,69 @@ msgstr "Sendmail"
|
|
470 |
msgid "SMTP"
|
471 |
msgstr "SMTP"
|
472 |
|
473 |
-
#: inc/class-destination-email.php:
|
474 |
#@ backwpup
|
475 |
msgid "Sendmail path"
|
476 |
msgstr "Sendmail Pfad"
|
477 |
|
478 |
-
#: inc/class-destination-email.php:
|
479 |
#@ backwpup
|
480 |
msgid "SMTP host name"
|
481 |
msgstr "SMTP Hostname"
|
482 |
|
483 |
-
#: inc/class-destination-email.php:
|
484 |
#@ backwpup
|
485 |
msgid "SMTP secure connection"
|
486 |
msgstr "SMTP Sichere Verbindung"
|
487 |
|
488 |
-
#: inc/class-destination-email.php:
|
489 |
#: inc/class-destination-s3-v1.php:189
|
490 |
#: inc/class-destination-s3.php:205
|
491 |
-
#: inc/class-jobtype-dbdump.php:
|
492 |
-
#: inc/class-jobtype-dbdump.php:
|
493 |
#: inc/class-jobtype-wpexp.php:70
|
494 |
#: inc/class-jobtype-wpplugin.php:56
|
495 |
-
#: inc/class-page-backwpup.php:
|
496 |
-
#: inc/class-page-backwpup.php:
|
497 |
-
#: inc/features/class-jobtype-dbdump-pro.php:
|
498 |
-
#: inc/features/class-jobtype-dbdump-pro.php:
|
499 |
#@ backwpup
|
500 |
msgid "none"
|
501 |
msgstr "nichts"
|
502 |
|
503 |
-
#: inc/class-destination-email.php:
|
504 |
#@ backwpup
|
505 |
msgid "SSL"
|
506 |
msgstr "SSL"
|
507 |
|
508 |
-
#: inc/class-destination-email.php:
|
509 |
#@ backwpup
|
510 |
msgid "TLS"
|
511 |
msgstr "TLS"
|
512 |
|
513 |
-
#: inc/class-destination-email.php:
|
514 |
#@ backwpup
|
515 |
msgid "SMTP username"
|
516 |
msgstr "SMTP Benutzername"
|
517 |
|
518 |
-
#: inc/class-destination-email.php:
|
519 |
#@ backwpup
|
520 |
msgid "SMTP password"
|
521 |
msgstr "SMTP Passwort"
|
522 |
|
523 |
-
#: inc/class-destination-email.php:
|
524 |
#, php-format
|
525 |
#@ backwpup
|
526 |
msgid "BackWPup archive from %1$s: %2$s"
|
527 |
msgstr "BackWPup-Archiv vom %1$s: %2$s"
|
528 |
|
529 |
-
#: inc/class-destination-email.php:
|
530 |
#, php-format
|
531 |
#@ backwpup
|
532 |
msgid "Backup archive: %s"
|
533 |
msgstr "Datensicherungsarchiv: %s"
|
534 |
|
535 |
-
#: inc/class-destination-email.php:
|
536 |
#@ backwpup
|
537 |
msgid "BackWPup archive sending TEST Message"
|
538 |
msgstr "BackWPup Archiv TEST Nachricht senden"
|
@@ -568,13 +566,13 @@ msgid "Blob container"
|
|
568 |
msgstr "Blob Container"
|
569 |
|
570 |
#: inc/class-destination-msazure.php:67
|
571 |
-
#: inc/class-destination-rsc.php:
|
572 |
#@ backwpup
|
573 |
msgid "Container selection"
|
574 |
msgstr "Container Auswahl"
|
575 |
|
576 |
#: inc/class-destination-msazure.php:79
|
577 |
-
#: inc/class-destination-rsc.php:
|
578 |
#@ backwpup
|
579 |
msgid "Create a new container"
|
580 |
msgstr "Neuen Container erstellen"
|
@@ -585,42 +583,42 @@ msgid "Folder in container"
|
|
585 |
msgstr "Ordner im Container"
|
586 |
|
587 |
#: inc/class-destination-msazure.php:96
|
588 |
-
#: inc/class-destination-rsc.php:
|
589 |
#: inc/class-destination-s3-v1.php:166
|
590 |
#: inc/class-destination-s3.php:171
|
591 |
#@ backwpup
|
592 |
msgid "File deletion"
|
593 |
msgstr "Datei Löschung"
|
594 |
|
595 |
-
#: inc/class-destination-msazure.php:
|
596 |
#: inc/features/class-destination-msazure-pro.php:70
|
597 |
#, php-format
|
598 |
#@ backwpup
|
599 |
msgid "MS Azure container \"%s\" created."
|
600 |
msgstr "MS Azure Container \"%s\" erstellt."
|
601 |
|
602 |
-
#: inc/class-destination-msazure.php:
|
603 |
#: inc/features/class-destination-msazure-pro.php:73
|
604 |
#, php-format
|
605 |
#@ backwpup
|
606 |
msgid "MS Azure container create: %s"
|
607 |
msgstr "MS Azure Container erstellen: %s"
|
608 |
|
609 |
-
#: inc/class-destination-msazure.php:
|
610 |
#: inc/features/class-destination-msazure-pro.php:108
|
611 |
#, php-format
|
612 |
#@ backwpup
|
613 |
msgid "MS Azure container \"%s\" does not exist!"
|
614 |
msgstr "MS Azure Container \"%s\" existiert nicht!"
|
615 |
|
616 |
-
#: inc/class-destination-msazure.php:
|
617 |
#: inc/features/class-destination-msazure-pro.php:112
|
618 |
#, php-format
|
619 |
#@ backwpup
|
620 |
msgid "Connected to MS Azure container \"%s\"."
|
621 |
msgstr "Verbunden mit MS Azure container \"%s\""
|
622 |
|
623 |
-
#: inc/class-destination-msazure.php:
|
624 |
#, php-format
|
625 |
#@ backwpup
|
626 |
msgid "One file deleted on Microsoft Azure container."
|
@@ -628,119 +626,118 @@ msgid_plural "%d files deleted on Microsoft Azure container."
|
|
628 |
msgstr[0] "Eine Datei im Microsoft-Azure-Container gelöscht"
|
629 |
msgstr[1] "%d Dateien im Microsoft-Azure-Container gelöscht"
|
630 |
|
631 |
-
#: inc/class-destination-msazure.php:
|
632 |
#: inc/features/class-destination-msazure-pro.php:172
|
633 |
#, php-format
|
634 |
#@ backwpup
|
635 |
msgid "Microsoft Azure API: %s"
|
636 |
msgstr "Microsoft Azure API: %s"
|
637 |
|
638 |
-
#: inc/class-destination-rsc.php:
|
639 |
#@ backwpup
|
640 |
msgid "RSC"
|
641 |
msgstr "RSC"
|
642 |
|
643 |
-
#: inc/class-destination-rsc.php:
|
644 |
#: inc/class-page-about.php:238
|
645 |
#@ backwpup
|
646 |
msgid "Backup to Rackspace Cloud Files"
|
647 |
msgstr "Datensicherung in die Rackspace Cloud"
|
648 |
|
649 |
-
#: inc/class-destination-rsc.php:
|
650 |
#@ backwpup
|
651 |
msgid "Rack Space Cloud Keys"
|
652 |
msgstr "Rack Space Cloud Keys"
|
653 |
|
654 |
-
#: inc/class-destination-rsc.php:
|
655 |
#@ backwpup
|
656 |
msgid "API Key"
|
657 |
msgstr "API Key"
|
658 |
|
659 |
-
#: inc/class-destination-rsc.php:
|
660 |
#@ backwpup
|
661 |
msgid "Select region"
|
662 |
msgstr "Wähle Region"
|
663 |
|
664 |
-
#: inc/class-destination-rsc.php:67
|
665 |
#: inc/class-destination-rsc.php:69
|
|
|
666 |
#: inc/features/class-destination-rsc-pro.php:34
|
667 |
#@ backwpup
|
668 |
msgid "Rackspace Cloud Files Region"
|
669 |
msgstr "Rackspace Cloud Verzeichnis"
|
670 |
|
671 |
-
#: inc/class-destination-rsc.php:
|
672 |
#: inc/features/class-destination-rsc-pro.php:35
|
673 |
#@ backwpup
|
674 |
msgid "Dallas (DFW)"
|
675 |
msgstr "Dallas (DFW)"
|
676 |
|
677 |
-
#: inc/class-destination-rsc.php:
|
678 |
#: inc/features/class-destination-rsc-pro.php:36
|
679 |
#@ backwpup
|
680 |
msgid "Chicago (ORD)"
|
681 |
msgstr "Chicago (ORD)"
|
682 |
|
683 |
-
#: inc/class-destination-rsc.php:95
|
684 |
#: inc/class-destination-s3-v1.php:156
|
685 |
#: inc/class-destination-s3.php:161
|
686 |
#@ backwpup
|
687 |
msgid "S3 Backup settings"
|
688 |
msgstr "S3 Backup Einstellungen"
|
689 |
|
690 |
-
#: inc/class-destination-rsc.php:
|
691 |
#: inc/class-destination-s3-v1.php:160
|
692 |
#: inc/class-destination-s3.php:165
|
693 |
#@ backwpup
|
694 |
msgid "Folder in bucket"
|
695 |
msgstr "Ordner im Bucket"
|
696 |
|
697 |
-
#: inc/class-destination-rsc.php:
|
698 |
#: inc/features/class-destination-rsc-pro.php:100
|
699 |
#, php-format
|
700 |
#@ backwpup
|
701 |
msgid "Rackspace Cloud container \"%s\" created."
|
702 |
msgstr "Rackspace Cloud Container \"%s\" erstellt."
|
703 |
|
704 |
-
#: inc/class-destination-rsc.php:
|
705 |
-
#: inc/class-destination-rsc.php:
|
706 |
-
#: inc/class-destination-rsc.php:
|
707 |
-
#: inc/class-destination-rsc.php:
|
708 |
#: inc/features/class-destination-rsc-pro.php:104
|
709 |
#: inc/features/class-destination-rsc-pro.php:147
|
710 |
-
#: inc/features/class-destination-rsc-pro.php:
|
711 |
#, php-format
|
712 |
#@ backwpup
|
713 |
msgid "Rackspace Cloud API: %s"
|
714 |
msgstr "Rackspace Cloud API: %s"
|
715 |
|
716 |
-
#: inc/class-destination-rsc.php:
|
717 |
#, php-format
|
718 |
#@ backwpup
|
719 |
msgid "%d. Trying to send backup file to Rackspace cloud …"
|
720 |
msgstr "%d. Versuche, ein Backup zur Rackspace Cloud zu senden …"
|
721 |
|
722 |
-
#: inc/class-destination-rsc.php:
|
723 |
#, php-format
|
724 |
#@ backwpup
|
725 |
msgid "Connected to Rackspace cloud files container %s"
|
726 |
msgstr "Verbunden mit Rackspace Cloud Container %s"
|
727 |
|
728 |
-
#: inc/class-destination-rsc.php:
|
729 |
#@ backwpup
|
730 |
msgid "Upload to Rackspace cloud started …"
|
731 |
msgstr "Upload zur Rackspace Cloud nun gestartet …"
|
732 |
|
733 |
-
#: inc/class-destination-rsc.php:
|
734 |
#@ backwpup
|
735 |
msgid "Backup File transferred to RSC://"
|
736 |
msgstr "Datensicherungsdatei übertragen zu RSC://"
|
737 |
|
738 |
-
#: inc/class-destination-rsc.php:
|
739 |
#@ backwpup
|
740 |
msgid "Cannot transfer backup to Rackspace cloud."
|
741 |
msgstr "Kann das Backup nicht zur Rackspace Cloud transferieren"
|
742 |
|
743 |
-
#: inc/class-destination-rsc.php:
|
744 |
#, php-format
|
745 |
#@ backwpup
|
746 |
msgid "One file deleted on Rackspace cloud container."
|
@@ -748,7 +745,7 @@ msgid_plural "%d files deleted on Rackspace cloud container."
|
|
748 |
msgstr[0] "Eine Datei im Rackspace-Container gelöscht"
|
749 |
msgstr[1] "%d Dateien im Rackspace-Container gelöscht"
|
750 |
|
751 |
-
#: inc/class-destination-rsc.php:
|
752 |
#@ backwpup
|
753 |
msgid "Missing API Key!"
|
754 |
msgstr "API-Schlüssel wird fehlt!"
|
@@ -770,7 +767,7 @@ msgstr "Wähle einen S3 Service"
|
|
770 |
#: inc/class-destination-s3-v1.php:90
|
771 |
#: inc/class-destination-s3.php:95
|
772 |
#: inc/features/class-destination-s3-pro.php:23
|
773 |
-
#: inc/features/class-destination-s3-v1-pro.php:
|
774 |
#@ backwpup
|
775 |
msgid "Amazon S3 Region"
|
776 |
msgstr "Amazon S3 Region"
|
@@ -778,7 +775,7 @@ msgstr "Amazon S3 Region"
|
|
778 |
#: inc/class-destination-s3-v1.php:91
|
779 |
#: inc/class-destination-s3.php:96
|
780 |
#: inc/features/class-destination-s3-pro.php:24
|
781 |
-
#: inc/features/class-destination-s3-v1-pro.php:
|
782 |
#@ backwpup
|
783 |
msgid "Amazon S3: US Standard"
|
784 |
msgstr "Amazon S3: US Standard"
|
@@ -786,7 +783,7 @@ msgstr "Amazon S3: US Standard"
|
|
786 |
#: inc/class-destination-s3-v1.php:92
|
787 |
#: inc/class-destination-s3.php:97
|
788 |
#: inc/features/class-destination-s3-pro.php:25
|
789 |
-
#: inc/features/class-destination-s3-v1-pro.php:
|
790 |
#@ backwpup
|
791 |
msgid "Amazon S3: US West (Northern California)"
|
792 |
msgstr "Amazon S3: US West (Northern California)"
|
@@ -794,7 +791,7 @@ msgstr "Amazon S3: US West (Northern California)"
|
|
794 |
#: inc/class-destination-s3-v1.php:93
|
795 |
#: inc/class-destination-s3.php:98
|
796 |
#: inc/features/class-destination-s3-pro.php:26
|
797 |
-
#: inc/features/class-destination-s3-v1-pro.php:
|
798 |
#@ backwpup
|
799 |
msgid "Amazon S3: US West (Oregon)"
|
800 |
msgstr "Amazon S3: US West (Oregon)"
|
@@ -802,7 +799,7 @@ msgstr "Amazon S3: US West (Oregon)"
|
|
802 |
#: inc/class-destination-s3-v1.php:94
|
803 |
#: inc/class-destination-s3.php:99
|
804 |
#: inc/features/class-destination-s3-pro.php:27
|
805 |
-
#: inc/features/class-destination-s3-v1-pro.php:
|
806 |
#@ backwpup
|
807 |
msgid "Amazon S3: EU (Ireland)"
|
808 |
msgstr "Amazon S3: EU (Ireland)"
|
@@ -810,7 +807,7 @@ msgstr "Amazon S3: EU (Ireland)"
|
|
810 |
#: inc/class-destination-s3-v1.php:95
|
811 |
#: inc/class-destination-s3.php:100
|
812 |
#: inc/features/class-destination-s3-pro.php:28
|
813 |
-
#: inc/features/class-destination-s3-v1-pro.php:
|
814 |
#@ backwpup
|
815 |
msgid "Amazon S3: Asia Pacific (Tokyo)"
|
816 |
msgstr "Amazon S3: Asia Pacific (Tokyo)"
|
@@ -818,7 +815,7 @@ msgstr "Amazon S3: Asia Pacific (Tokyo)"
|
|
818 |
#: inc/class-destination-s3-v1.php:96
|
819 |
#: inc/class-destination-s3.php:101
|
820 |
#: inc/features/class-destination-s3-pro.php:29
|
821 |
-
#: inc/features/class-destination-s3-v1-pro.php:
|
822 |
#@ backwpup
|
823 |
msgid "Amazon S3: Asia Pacific (Singapore)"
|
824 |
msgstr "Amazon S3: Asia Pacific (Singapore)"
|
@@ -826,7 +823,7 @@ msgstr "Amazon S3: Asia Pacific (Singapore)"
|
|
826 |
#: inc/class-destination-s3-v1.php:97
|
827 |
#: inc/class-destination-s3.php:102
|
828 |
#: inc/features/class-destination-s3-pro.php:30
|
829 |
-
#: inc/features/class-destination-s3-v1-pro.php:
|
830 |
#@ backwpup
|
831 |
msgid "Amazon S3: Asia Pacific (Sydney)"
|
832 |
msgstr "Amazon S3: Asia Pacific (Sydney)"
|
@@ -834,7 +831,7 @@ msgstr "Amazon S3: Asia Pacific (Sydney)"
|
|
834 |
#: inc/class-destination-s3-v1.php:98
|
835 |
#: inc/class-destination-s3.php:103
|
836 |
#: inc/features/class-destination-s3-pro.php:31
|
837 |
-
#: inc/features/class-destination-s3-v1-pro.php:
|
838 |
#@ backwpup
|
839 |
msgid "Amazon S3: South America (Sao Paulo)"
|
840 |
msgstr "Amazon S3: South America (Sao Paulo)"
|
@@ -842,7 +839,7 @@ msgstr "Amazon S3: South America (Sao Paulo)"
|
|
842 |
#: inc/class-destination-s3-v1.php:99
|
843 |
#: inc/class-destination-s3.php:104
|
844 |
#: inc/features/class-destination-s3-pro.php:32
|
845 |
-
#: inc/features/class-destination-s3-v1-pro.php:
|
846 |
#@ backwpup
|
847 |
msgid "Google Storage (Interoperable Access)"
|
848 |
msgstr "Google Storage (Interoperable Access)"
|
@@ -850,7 +847,7 @@ msgstr "Google Storage (Interoperable Access)"
|
|
850 |
#: inc/class-destination-s3-v1.php:100
|
851 |
#: inc/class-destination-s3.php:105
|
852 |
#: inc/features/class-destination-s3-pro.php:33
|
853 |
-
#: inc/features/class-destination-s3-v1-pro.php:
|
854 |
#@ backwpup
|
855 |
msgid "Hosteurope Cloud Storage"
|
856 |
msgstr "Hosteurope Cloud Storage"
|
@@ -858,7 +855,7 @@ msgstr "Hosteurope Cloud Storage"
|
|
858 |
#: inc/class-destination-s3-v1.php:101
|
859 |
#: inc/class-destination-s3.php:106
|
860 |
#: inc/features/class-destination-s3-pro.php:34
|
861 |
-
#: inc/features/class-destination-s3-v1-pro.php:
|
862 |
#@ backwpup
|
863 |
msgid "Dream Host Cloud Storage"
|
864 |
msgstr "Dream Host Cloud Storage"
|
@@ -940,7 +937,7 @@ msgstr "Speicher Dateien Server Side Encrypted (AES256)"
|
|
940 |
#: inc/class-destination-s3-v1.php:260
|
941 |
#: inc/class-destination-s3.php:271
|
942 |
#: inc/features/class-destination-s3-pro.php:126
|
943 |
-
#: inc/features/class-destination-s3-v1-pro.php:
|
944 |
#, php-format
|
945 |
#@ backwpup
|
946 |
msgid "Bucket %1$s created in %2$s."
|
@@ -949,7 +946,7 @@ msgstr "Bucket %1$s in %2$s erstellt."
|
|
949 |
#: inc/class-destination-s3-v1.php:262
|
950 |
#: inc/class-destination-s3.php:273
|
951 |
#: inc/features/class-destination-s3-pro.php:128
|
952 |
-
#: inc/features/class-destination-s3-v1-pro.php:
|
953 |
#, php-format
|
954 |
#@ backwpup
|
955 |
msgid "Bucket %s could not be created."
|
@@ -970,8 +967,8 @@ msgstr "%s ist kein gültiger Bucket Name"
|
|
970 |
#: inc/class-destination-s3.php:451
|
971 |
#: inc/class-destination-s3.php:472
|
972 |
#: inc/class-destination-s3.php:531
|
973 |
-
#: inc/features/class-destination-s3-pro.php:
|
974 |
-
#: inc/features/class-destination-s3-v1-pro.php:
|
975 |
#, php-format
|
976 |
#@ backwpup
|
977 |
msgid "S3 Service API: %s"
|
@@ -980,7 +977,7 @@ msgstr "S3 Service API: %s"
|
|
980 |
#: inc/class-destination-s3-v1.php:398
|
981 |
#: inc/class-destination-s3.php:395
|
982 |
#: inc/features/class-destination-s3-pro.php:167
|
983 |
-
#: inc/features/class-destination-s3-v1-pro.php:
|
984 |
#, php-format
|
985 |
#@ backwpup
|
986 |
msgid "S3 Bucket \"%s\" does not exist!"
|
@@ -1016,7 +1013,7 @@ msgid_plural "%d files deleted on S3 Bucket"
|
|
1016 |
msgstr[0] "Eine Datei im S3-Bucket gelöscht"
|
1017 |
msgstr[1] "%d Dateien im S3-Bucket gelöscht"
|
1018 |
|
1019 |
-
#: inc/class-destination-msazure.php:
|
1020 |
#: inc/class-destination-s3-v1.php:587
|
1021 |
#: inc/class-destination-s3.php:628
|
1022 |
#@ backwpup
|
@@ -1062,7 +1059,7 @@ msgstr "Authentifizierung"
|
|
1062 |
#: inc/class-page-settings.php:330
|
1063 |
#: inc/features/class-destination-ftp-pro.php:25
|
1064 |
#: inc/features/class-destination-sugarsync-pro.php:17
|
1065 |
-
#: inc/features/class-jobtype-dbdump-pro.php:
|
1066 |
#@ backwpup
|
1067 |
msgid "Password:"
|
1068 |
msgstr "Passwort:"
|
@@ -1118,7 +1115,7 @@ msgstr[1] "%d Dateien im SugarSync-Ordner gelöscht"
|
|
1118 |
msgid "SugarSync API: %s"
|
1119 |
msgstr "SugarSync API: %s"
|
1120 |
|
1121 |
-
#: inc/class-page-settings.php:
|
1122 |
#@ backwpup
|
1123 |
msgid "Response Test O.K."
|
1124 |
msgstr "Response Test O.K."
|
@@ -1143,109 +1140,109 @@ msgstr "Für weitere Informationen:"
|
|
1143 |
msgid "News"
|
1144 |
msgstr "Neuigkeiten"
|
1145 |
|
1146 |
-
#: inc/class-install.php:
|
1147 |
#@ backwpup
|
1148 |
msgid "BackWPup Admin"
|
1149 |
msgstr "BackWPup Admin"
|
1150 |
|
1151 |
-
#: inc/class-install.php:
|
1152 |
#@ backwpup
|
1153 |
msgid "BackWPup jobs checker"
|
1154 |
msgstr "BackWPup Auftragsprüfung"
|
1155 |
|
1156 |
-
#: inc/class-install.php:
|
1157 |
#@ backwpup
|
1158 |
msgid "BackWPup jobs helper"
|
1159 |
msgstr "BackWPup Auftragshelfer"
|
1160 |
|
1161 |
-
#: inc/class-job.php:
|
1162 |
#@ backwpup
|
1163 |
msgid "Starting job"
|
1164 |
msgstr "Auftrag starten"
|
1165 |
|
1166 |
-
#: inc/class-job.php:
|
1167 |
#@ backwpup
|
1168 |
msgid "Creates archive"
|
1169 |
msgstr "erstellt Archiv"
|
1170 |
|
1171 |
-
#: inc/class-job.php:
|
1172 |
#@ backwpup
|
1173 |
msgid "Job End"
|
1174 |
msgstr "Auftragsende"
|
1175 |
|
1176 |
-
#: inc/class-job.php:
|
1177 |
#, php-format
|
1178 |
#@ backwpup
|
1179 |
msgid "BackWPup log for %1$s from %2$s at %3$s"
|
1180 |
msgstr "BackWPup-Protokoll für %1$s von %2$s am %3$s"
|
1181 |
|
1182 |
-
#: inc/class-job.php:
|
1183 |
#@ backwpup
|
1184 |
msgid "[INFO] This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions."
|
1185 |
msgstr "[INFO] Dieses Programm leistet ABSOLUT KEINE GEWÄHR. Dies ist eine freie Software und es steht frei, diese unter gleichen Konditionen weiterzuentwickeln."
|
1186 |
|
1187 |
-
#: inc/class-job.php:
|
1188 |
#, php-format
|
1189 |
#@ backwpup
|
1190 |
msgid "[INFO] BackWPup job: %1$s; %2$s"
|
1191 |
msgstr "[INFO] BackWPup-Auftrag: %1$s; %2$s"
|
1192 |
|
1193 |
-
#: inc/class-job.php:
|
1194 |
#@ backwpup
|
1195 |
msgid "[INFO] BackWPup cron:"
|
1196 |
msgstr "[INFO] BackWPup Cron:"
|
1197 |
|
1198 |
-
#: inc/class-job.php:
|
1199 |
#@ backwpup
|
1200 |
msgid "[INFO] BackWPup job started from wp-cron"
|
1201 |
msgstr "[INFO] BackWPup-Auftrag wurde per wp-cron gestartet"
|
1202 |
|
1203 |
-
#: inc/class-job.php:
|
1204 |
#@ backwpup
|
1205 |
msgid "[INFO] BackWPup job started manually"
|
1206 |
msgstr "[INFO] BackWPup-Auftrag wurde manuell gestartet"
|
1207 |
|
1208 |
-
#: inc/class-job.php:
|
1209 |
#@ backwpup
|
1210 |
msgid "[INFO] BackWPup job started from external url"
|
1211 |
msgstr "[INFO] BackWPup Auftrag wurde von externer URL gestartet"
|
1212 |
|
1213 |
-
#: inc/class-job.php:
|
1214 |
#@ backwpup
|
1215 |
msgid "[INFO] PHP ver.:"
|
1216 |
msgstr "[INFO] PHP ver.:"
|
1217 |
|
1218 |
-
#: inc/class-job.php:
|
1219 |
#, php-format
|
1220 |
#@ backwpup
|
1221 |
msgid "[INFO] MySQL ver.: %s"
|
1222 |
msgstr "[INFO] MySQL ver.: %s"
|
1223 |
|
1224 |
-
#: inc/class-job.php:
|
1225 |
#, php-format
|
1226 |
#@ backwpup
|
1227 |
msgid "[INFO] curl ver.: %1$s; %2$s"
|
1228 |
msgstr "[INFO] curl ver.: %1$s; %2$s"
|
1229 |
|
1230 |
-
#: inc/class-job.php:
|
1231 |
#, php-format
|
1232 |
#@ backwpup
|
1233 |
msgid "[INFO] Temp folder is: %s"
|
1234 |
msgstr "[INFO] Temp Ordner ist: %s"
|
1235 |
|
1236 |
-
#: inc/class-job.php:
|
1237 |
#, php-format
|
1238 |
#@ backwpup
|
1239 |
msgid "[INFO] Logfile folder is: %s"
|
1240 |
msgstr "[INFO] Logdatei Ordner ist: %s"
|
1241 |
|
1242 |
-
#: inc/class-job.php:
|
1243 |
#, php-format
|
1244 |
#@ backwpup
|
1245 |
msgid "[INFO] Backup type is: %s"
|
1246 |
msgstr "[INFO] Backup Typ ist: %s"
|
1247 |
|
1248 |
-
#: inc/class-job.php:
|
1249 |
#, php-format
|
1250 |
#@ backwpup
|
1251 |
msgid "[INFO] Backup file is: %s"
|
@@ -1253,25 +1250,25 @@ msgstr "[INFO] Backup Datei ist: %s"
|
|
1253 |
|
1254 |
#: inc/class-job.php:438
|
1255 |
#: inc/class-job.php:439
|
1256 |
-
#: inc/class-job.php:
|
1257 |
-
#: inc/class-job.php:
|
1258 |
-
#: inc/class-job.php:
|
1259 |
#@ backwpup
|
1260 |
msgid "Wrong BackWPup JobID"
|
1261 |
msgstr "Falsche BackWPup JobID"
|
1262 |
|
1263 |
#: inc/class-job.php:443
|
1264 |
#: inc/class-job.php:444
|
1265 |
-
#: inc/class-job.php:
|
1266 |
-
#: inc/class-job.php:
|
1267 |
#@ backwpup
|
1268 |
msgid "Log folder does not exist or is not writable for BackWPup"
|
1269 |
msgstr "Log-Ordner existiert nicht oder ist nicht beschreibbar für BackWPup"
|
1270 |
|
1271 |
#: inc/class-job.php:447
|
1272 |
#: inc/class-job.php:448
|
1273 |
-
#: inc/class-job.php:
|
1274 |
-
#: inc/class-job.php:
|
1275 |
#@ backwpup
|
1276 |
msgid "Temp folder does not exist or is not writable for BackWPup"
|
1277 |
msgstr "Temp Ordner existiert nicht oder ist nicht beschreibbar für BackWPup!"
|
@@ -1284,78 +1281,79 @@ msgstr "Kein aktiver BackWPup-Auftrag"
|
|
1284 |
|
1285 |
#: inc/class-job.php:462
|
1286 |
#: inc/class-job.php:463
|
1287 |
-
#: inc/class-job.php:
|
1288 |
-
#: inc/class-job.php:
|
1289 |
-
#: inc/class-job.php:
|
1290 |
#@ backwpup
|
1291 |
msgid "A BackWPup job is already running"
|
1292 |
msgstr "Es läuft bereits ein BackWPup-Auftrag"
|
1293 |
|
1294 |
-
#: inc/class-job.php:
|
1295 |
#@ backwpup
|
1296 |
msgid "Log folder does not exist or is not writable"
|
1297 |
msgstr "Log-Ordner existiert nicht oder ist nicht beschreibbar"
|
1298 |
|
1299 |
-
#: inc/class-job.php:
|
1300 |
#@ backwpup
|
1301 |
msgid "Temp folder does not exist or is not writable"
|
1302 |
msgstr "Temp Ordner existiert nicht oder ist nicht beschreibbar"
|
1303 |
|
1304 |
-
#: inc/class-job.php:
|
1305 |
#@ backwpup
|
1306 |
msgid "Job restart due to inactivity for more than 5 minutes."
|
1307 |
msgstr "Auftrag durch Inaktivität von mehr als 5 Minuten neu gestartet"
|
1308 |
|
1309 |
-
#: inc/class-job.php:
|
1310 |
#@ backwpup
|
1311 |
msgid "Step aborted: too many attempts!"
|
1312 |
msgstr "Schritt abgebrochen durch zu viele Versuche!"
|
1313 |
|
1314 |
-
#: inc/class-job.php:
|
1315 |
#, php-format
|
1316 |
#@ backwpup
|
1317 |
msgid "Please use another folder: %1$s"
|
1318 |
msgstr "Bitte einen anderen Ordner auswählen: %1$s"
|
1319 |
|
1320 |
-
#: inc/class-job.php:
|
1321 |
#, php-format
|
1322 |
#@ backwpup
|
1323 |
msgid "Cannot create folder: %1$s"
|
1324 |
msgstr "Kann keinen Ordner erstellen: %1$s"
|
1325 |
|
1326 |
-
#: inc/class-job.php:
|
1327 |
#, php-format
|
1328 |
#@ backwpup
|
1329 |
msgid "Folder \"%1$s\" is not writable"
|
1330 |
msgstr "Ordner \"%1$s\" ist nicht beschreibbar"
|
1331 |
|
1332 |
-
#: inc/class-job.php:
|
1333 |
#, php-format
|
1334 |
#@ backwpup
|
1335 |
msgid "Exception caught in %1$s: %2$s"
|
1336 |
msgstr "Ausnahme eingefangen in %1$s: %2$s"
|
1337 |
|
1338 |
-
#: inc/class-job.php:
|
|
|
1339 |
#@ backwpup
|
1340 |
msgid "WARNING:"
|
1341 |
msgstr "WARNUNG:"
|
1342 |
|
1343 |
-
#: inc/class-job.php:
|
1344 |
#@ backwpup
|
1345 |
msgid "DEPRECATED:"
|
1346 |
msgstr "ABGELEHNT:"
|
1347 |
|
1348 |
-
#: inc/class-job.php:
|
1349 |
#@ backwpup
|
1350 |
msgid "STRICT NOTICE:"
|
1351 |
msgstr "EXAKTE NOTIZ:"
|
1352 |
|
1353 |
-
#: inc/class-job.php:
|
1354 |
#@ backwpup
|
1355 |
msgid "RECOVERABLE ERROR:"
|
1356 |
msgstr "WIEDERHERSTELLUNGS FEHLER:"
|
1357 |
|
1358 |
-
#: inc/class-job.php:
|
1359 |
#, php-format
|
1360 |
#@ backwpup
|
1361 |
msgid "One old log deleted"
|
@@ -1363,199 +1361,185 @@ msgid_plural "%d old logs deleted"
|
|
1363 |
msgstr[0] "Eine alte Log-Datei gelöscht"
|
1364 |
msgstr[1] "%d alte Log-Dateien gelöscht"
|
1365 |
|
1366 |
-
#: inc/class-job.php:
|
|
|
1367 |
#, php-format
|
1368 |
#@ backwpup
|
1369 |
msgid "Job done in %s seconds."
|
1370 |
msgstr "Auftrag erledigt in %s Sekunden."
|
1371 |
|
1372 |
-
#: inc/class-job.php:
|
1373 |
#@ backwpup
|
1374 |
msgid "SUCCESSFUL"
|
1375 |
msgstr "ERFOLGREICH"
|
1376 |
|
1377 |
-
#: inc/class-job.php:
|
1378 |
#@ backwpup
|
1379 |
msgid "WARNING"
|
1380 |
msgstr "WARNUNG"
|
1381 |
|
1382 |
-
#: inc/class-job.php:
|
1383 |
-
#@ backwpup
|
1384 |
-
msgid "Set blog into maintenance mode"
|
1385 |
-
msgstr "Webseite / Blog in den Wartungsmodus versetzen"
|
1386 |
-
|
1387 |
-
#: inc/class-job.php:1293
|
1388 |
-
#@ backwpup
|
1389 |
-
msgid "Cannot set blog into maintenance mode! .maintenance is not writable!"
|
1390 |
-
msgstr "Die Webseite kann nicht in den Wartungsmodus gesetzt werden! Das Root-Verzeichnis ist nicht beschreibbar!"
|
1391 |
-
|
1392 |
-
#: inc/class-job.php:1301
|
1393 |
-
#@ backwpup
|
1394 |
-
msgid "Set blog to normal mode"
|
1395 |
-
msgstr "Setze Webseite / Blog zurück in den Normalmodus"
|
1396 |
-
|
1397 |
-
#: inc/class-job.php:1624
|
1398 |
#, php-format
|
1399 |
#@ backwpup
|
1400 |
msgid "File \"%s\" is not readable!"
|
1401 |
msgstr "Datei \"%s\" ist nicht lesbar!"
|
1402 |
|
1403 |
-
#: inc/class-job.php:
|
1404 |
#, php-format
|
1405 |
#@ backwpup
|
1406 |
msgid "Link \"%s\" not followed."
|
1407 |
msgstr "Link \"%s\" wird nicht gefolgt"
|
1408 |
|
1409 |
-
#: inc/class-create-archive.php:
|
1410 |
-
#: inc/class-create-archive.php:
|
1411 |
#, php-format
|
1412 |
#@ backwpup
|
1413 |
msgid "Cannot add \"%s\" to zip archive!"
|
1414 |
msgstr "\"%s\" kann dem ZIP-Archiv nicht hinzugefügt werden!"
|
1415 |
|
1416 |
-
#: inc/class-create-archive.php:
|
1417 |
#@ backwpup
|
1418 |
msgid "(ER_MULTIDISK) Multi-disk zip archives not supported"
|
1419 |
msgstr "(ER_MULTIDISK) Multi-Disk .zip Archive werden nicht unterstützt"
|
1420 |
|
1421 |
-
#: inc/class-create-archive.php:
|
1422 |
#@ backwpup
|
1423 |
msgid "(ER_RENAME) Renaming temporary file failed"
|
1424 |
msgstr "(ER_RENAME) Umbenennen der temporärern Dateien gescheitert."
|
1425 |
|
1426 |
-
#: inc/class-create-archive.php:
|
1427 |
#@ backwpup
|
1428 |
msgid "(ER_CLOSE) Closing zip archive failed"
|
1429 |
msgstr "(ER_CLOSE) Schließen der .zip Archive gescheitert"
|
1430 |
|
1431 |
-
#: inc/class-create-archive.php:
|
1432 |
#@ backwpup
|
1433 |
msgid "(ER_SEEK) Seek error"
|
1434 |
msgstr "(ER_SEEK) Such-Fehler"
|
1435 |
|
1436 |
-
#: inc/class-create-archive.php:
|
1437 |
#@ backwpup
|
1438 |
msgid "(ER_READ) Read error"
|
1439 |
msgstr "(ER_READ) Lese-Fehler"
|
1440 |
|
1441 |
-
#: inc/class-create-archive.php:
|
1442 |
#@ backwpup
|
1443 |
msgid "(ER_WRITE) Write error"
|
1444 |
msgstr "(ER_WRITE) Schreib-Fehler"
|
1445 |
|
1446 |
-
#: inc/class-create-archive.php:
|
1447 |
#@ backwpup
|
1448 |
msgid "(ER_CRC) CRC error"
|
1449 |
msgstr "(ER_CRC) CRC Fehler"
|
1450 |
|
1451 |
-
#: inc/class-create-archive.php:
|
1452 |
#@ backwpup
|
1453 |
msgid "(ER_ZIPCLOSED) Containing zip archive was closed"
|
1454 |
msgstr "(ER_ZIPCLOSED) beinhaltetendes .zip Archiv war geschlossen"
|
1455 |
|
1456 |
-
#: inc/class-create-archive.php:
|
1457 |
#@ backwpup
|
1458 |
msgid "(ER_NOENT) No such file"
|
1459 |
msgstr "(ER_NOENT) keine passende Datei"
|
1460 |
|
1461 |
-
#: inc/class-create-archive.php:
|
1462 |
#@ backwpup
|
1463 |
msgid "(ER_EXISTS) File already exists"
|
1464 |
msgstr "(ER_EXISTS) Datei exisitiert bereits"
|
1465 |
|
1466 |
-
#: inc/class-create-archive.php:
|
1467 |
#@ backwpup
|
1468 |
msgid "(ER_OPEN) Can't open file"
|
1469 |
msgstr "(ER_OPEN) Kann die Datei nicht öffnen"
|
1470 |
|
1471 |
-
#: inc/class-create-archive.php:
|
1472 |
#@ backwpup
|
1473 |
msgid "(ER_TMPOPEN) Failure to create temporary file"
|
1474 |
msgstr "(ER_TMPOPEN) Erstellen einer temporären Datei fehlgeschlagen"
|
1475 |
|
1476 |
-
#: inc/class-create-archive.php:
|
1477 |
#@ backwpup
|
1478 |
msgid "(ER_ZLIB) Zlib error"
|
1479 |
msgstr "(ER_ZLIB) Zlib Fehler"
|
1480 |
|
1481 |
-
#: inc/class-create-archive.php:
|
1482 |
#@ backwpup
|
1483 |
msgid "(ER_MEMORY) Malloc failure"
|
1484 |
msgstr "(ER_MEMORY) Malloc Fehler"
|
1485 |
|
1486 |
-
#: inc/class-create-archive.php:
|
1487 |
#@ backwpup
|
1488 |
msgid "(ER_CHANGED) Entry has been changed"
|
1489 |
msgstr "(ER_CHANGED) Eintrag wurde geändert"
|
1490 |
|
1491 |
-
#: inc/class-create-archive.php:
|
1492 |
#@ backwpup
|
1493 |
msgid "(ER_COMPNOTSUPP) Compression method not supported"
|
1494 |
msgstr "(ER_COMPNOTSUPP) Kompressionsmethode nicht unterstützt"
|
1495 |
|
1496 |
-
#: inc/class-create-archive.php:
|
1497 |
#@ backwpup
|
1498 |
msgid "(ER_EOF) Premature EOF"
|
1499 |
msgstr "(ER_EOF) verfrühtes EOF"
|
1500 |
|
1501 |
-
#: inc/class-create-archive.php:
|
1502 |
#@ backwpup
|
1503 |
msgid "(ER_INVAL) Invalid argument"
|
1504 |
msgstr "(ER_INVAL) ungültiges Argument"
|
1505 |
|
1506 |
-
#: inc/class-create-archive.php:
|
1507 |
#@ backwpup
|
1508 |
msgid "(ER_NOZIP) Not a zip archive"
|
1509 |
msgstr "(ER_NOZIP) kein .zip Archiv"
|
1510 |
|
1511 |
-
#: inc/class-create-archive.php:
|
1512 |
#@ backwpup
|
1513 |
msgid "(ER_INTERNAL) Internal error"
|
1514 |
msgstr "(ER_INTERNAL) Interner Fehler"
|
1515 |
|
1516 |
-
#: inc/class-create-archive.php:
|
1517 |
#@ backwpup
|
1518 |
msgid "(ER_INCONS) Zip archive inconsistent"
|
1519 |
msgstr "(ER_INCONS) .zip Archiv inkonsistent"
|
1520 |
|
1521 |
-
#: inc/class-create-archive.php:
|
1522 |
#@ backwpup
|
1523 |
msgid "(ER_REMOVE) Can't remove file"
|
1524 |
msgstr "(ER_REMOVE) Datei kann nicht entfernt werden"
|
1525 |
|
1526 |
-
#: inc/class-create-archive.php:
|
1527 |
#@ backwpup
|
1528 |
msgid "(ER_DELETED) Entry has been deleted"
|
1529 |
msgstr "(ER_DELETED) Eintrag wurde gelöscht"
|
1530 |
|
1531 |
-
#: inc/class-job.php:
|
1532 |
#, php-format
|
1533 |
#@ backwpup
|
1534 |
msgid "Archive size is %s."
|
1535 |
msgstr "Archivgröße ist %s"
|
1536 |
|
1537 |
-
#: inc/class-job.php:
|
1538 |
#, php-format
|
1539 |
#@ backwpup
|
1540 |
msgid "%1$d Files with %2$s in Archive."
|
1541 |
msgstr "%1$d Dateien mit %2$s in Archiven."
|
1542 |
|
1543 |
-
#: inc/class-create-archive.php:
|
1544 |
#, php-format
|
1545 |
#@ backwpup
|
1546 |
msgid "File name \"%1$s\" too long to be saved correctly in %2$s archive!"
|
1547 |
msgstr "Dateiname \"%1$s\" ist zu lang, um korrekt im %2$s Archiv zu speichern."
|
1548 |
|
1549 |
-
#: inc/class-create-archive.php:
|
1550 |
#, php-format
|
1551 |
#@ backwpup
|
1552 |
msgid "File path \"%1$s\" too long to be saved correctly in %2$s archive!"
|
1553 |
msgstr "Dateipfad \"%1$s\" ist zu lang, um korrekt in %2$s Archiv zu speichern"
|
1554 |
|
1555 |
-
#: inc/class-create-archive.php:
|
1556 |
-
#: inc/class-create-archive.php:
|
1557 |
-
#: inc/class-create-archive.php:
|
1558 |
-
#: inc/class-create-archive.php:
|
1559 |
#@ backwpup
|
1560 |
msgid "Unknown"
|
1561 |
msgstr "Unbekannt"
|
@@ -1588,56 +1572,45 @@ msgid "Check WordPress database tables only"
|
|
1588 |
msgstr "Teste nur die WordPress-Tabellen"
|
1589 |
|
1590 |
#: inc/class-jobtype-dbcheck.php:49
|
1591 |
-
#: inc/class-jobtype-dbdump.php:91
|
1592 |
-
#: inc/class-jobtype-dboptimize.php:50
|
1593 |
#: inc/features/class-jobtype-dbcheck-pro.php:25
|
1594 |
-
#: inc/features/class-jobtype-dbdump-pro.php:92
|
1595 |
-
#: inc/features/class-jobtype-dbdump-pro.php:181
|
1596 |
-
#: inc/features/class-jobtype-dboptimize-pro.php:26
|
1597 |
-
#@ backwpup
|
1598 |
-
msgid "Maintenance mode"
|
1599 |
-
msgstr "Wartungsmodus"
|
1600 |
-
|
1601 |
-
#: inc/class-jobtype-dbcheck.php:59
|
1602 |
-
#: inc/features/class-jobtype-dbcheck-pro.php:33
|
1603 |
#@ backwpup
|
1604 |
msgid "Repair"
|
1605 |
msgstr "Reparieren"
|
1606 |
|
1607 |
-
#: inc/class-jobtype-dbcheck.php:
|
1608 |
-
#: inc/features/class-jobtype-dbcheck-pro.php:
|
1609 |
#@ backwpup
|
1610 |
msgid "Try to repair defect table"
|
1611 |
msgstr "Versuche, definierte Tabellen zu reparieren"
|
1612 |
|
1613 |
-
#: inc/class-jobtype-dbcheck.php:
|
1614 |
#, php-format
|
1615 |
#@ backwpup
|
1616 |
msgid "Table %1$s is not a MyISAM/InnoDB table. Not checked."
|
1617 |
msgstr "Tabelle %1$s ist keine MyISAM/InnoDB Tabelle. Nicht geprüft"
|
1618 |
|
1619 |
-
#: inc/class-jobtype-dbcheck.php:
|
1620 |
-
#: inc/class-jobtype-dbcheck.php:
|
1621 |
-
#: inc/class-jobtype-dbcheck.php:
|
1622 |
#, php-format
|
1623 |
#@ backwpup
|
1624 |
msgid "Result of table check for %1$s is: %2$s"
|
1625 |
msgstr "Ergebnis der Tabellenprüfung für %1$s ist: %2$s"
|
1626 |
|
1627 |
-
#: inc/class-jobtype-dbcheck.php:
|
1628 |
-
#: inc/class-jobtype-dbcheck.php:
|
1629 |
-
#: inc/class-jobtype-dbcheck.php:
|
1630 |
#, php-format
|
1631 |
#@ backwpup
|
1632 |
msgid "Result of table repair for %1$s is: %2$s"
|
1633 |
msgstr "Ergebnis der Tabellenreparatur für %1$s ist: %2$s"
|
1634 |
|
1635 |
-
#: inc/class-jobtype-dbcheck.php:
|
1636 |
#@ backwpup
|
1637 |
msgid "Database check done!"
|
1638 |
msgstr "Datenbank-Check fertig!"
|
1639 |
|
1640 |
-
#: inc/class-jobtype-dbcheck.php:
|
1641 |
#@ backwpup
|
1642 |
msgid "No tables to check."
|
1643 |
msgstr "Keine Tabellen zum checken."
|
@@ -1647,103 +1620,96 @@ msgstr "Keine Tabellen zum checken."
|
|
1647 |
msgid "Database backup"
|
1648 |
msgstr "Datenbank Backup"
|
1649 |
|
1650 |
-
#: inc/features/class-jobtype-dbdump-pro.php:
|
1651 |
#@ backwpup
|
1652 |
msgid "Settings for database dump"
|
1653 |
msgstr "Einstellungen für das Datenbank-Backup"
|
1654 |
|
1655 |
-
#: inc/class-jobtype-dbdump.php:
|
1656 |
-
#: inc/features/class-jobtype-dbdump-pro.php:
|
1657 |
#@ backwpup
|
1658 |
msgid "all"
|
1659 |
msgstr "alle"
|
1660 |
|
1661 |
-
#: inc/class-jobtype-dbdump.php:
|
1662 |
-
#: inc/features/class-jobtype-dbdump-pro.php:
|
1663 |
-
#: inc/features/class-jobtype-dbdump-pro.php:185
|
1664 |
-
#@ backwpup
|
1665 |
-
msgid "Activate maintenance mode on database dump"
|
1666 |
-
msgstr "Aktiviere den Wartungsmodus bei der Datenbank Sicherung"
|
1667 |
-
|
1668 |
-
#: inc/class-jobtype-dbdump.php:99
|
1669 |
-
#: inc/features/class-jobtype-dbdump-pro.php:207
|
1670 |
#@ backwpup
|
1671 |
msgid "Dumpfile name"
|
1672 |
msgstr "Name der Backup-Datei"
|
1673 |
|
1674 |
-
#: inc/class-jobtype-dbdump.php:
|
1675 |
-
#: inc/features/class-jobtype-dbdump-pro.php:
|
1676 |
#@ backwpup
|
1677 |
msgid "Dumpfile compression"
|
1678 |
msgstr "Kompression der Backup-Datei"
|
1679 |
|
1680 |
-
#: inc/class-jobtype-dbdump.php:
|
1681 |
-
#: inc/class-jobtype-dbdump.php:
|
1682 |
#: inc/class-jobtype-wpexp.php:72
|
1683 |
#: inc/class-jobtype-wpexp.php:74
|
1684 |
#: inc/class-jobtype-wpplugin.php:58
|
1685 |
#: inc/class-jobtype-wpplugin.php:60
|
1686 |
-
#: inc/features/class-jobtype-dbdump-pro.php:
|
1687 |
-
#: inc/features/class-jobtype-dbdump-pro.php:
|
1688 |
#@ backwpup
|
1689 |
msgid "GZip"
|
1690 |
msgstr "GZip"
|
1691 |
|
1692 |
-
#: inc/class-jobtype-dbdump.php:
|
1693 |
-
#: inc/class-jobtype-dbdump.php:
|
1694 |
#: inc/class-jobtype-wpexp.php:76
|
1695 |
#: inc/class-jobtype-wpexp.php:78
|
1696 |
#: inc/class-jobtype-wpplugin.php:62
|
1697 |
#: inc/class-jobtype-wpplugin.php:64
|
1698 |
-
#: inc/features/class-jobtype-dbdump-pro.php:
|
1699 |
-
#: inc/features/class-jobtype-dbdump-pro.php:
|
1700 |
#@ backwpup
|
1701 |
msgid "BZip2"
|
1702 |
msgstr "BZip2"
|
1703 |
|
1704 |
-
#: inc/class-jobtype-dbdump.php:
|
1705 |
-
#: inc/features/class-jobtype-dbdump-pro.php:
|
1706 |
-
#: inc/features/class-jobtype-dbdump-pro.php:
|
1707 |
#, php-format
|
1708 |
#@ backwpup
|
1709 |
msgid "Connected to database %1$s on %2$s"
|
1710 |
msgstr "Mit Datenbank %1$s auf %2$s verbunden"
|
1711 |
|
1712 |
-
#: inc/class-mysqldump.php:
|
1713 |
-
#: inc/class-mysqldump.php:
|
1714 |
-
#: inc/class-mysqldump.php:
|
1715 |
-
#: inc/class-mysqldump.php:
|
1716 |
-
#: inc/class-mysqldump.php:
|
1717 |
-
#: inc/class-mysqldump.php:
|
1718 |
-
#: inc/class-mysqldump.php:
|
1719 |
-
#: inc/class-mysqldump.php:
|
1720 |
-
#: inc/class-mysqldump.php:
|
1721 |
-
#: inc/features/class-jobtype-dbdump-pro.php:
|
1722 |
-
#: inc/features/class-jobtype-dbdump-pro.php:
|
1723 |
-
#: inc/features/class-jobtype-dbdump-pro.php:
|
1724 |
-
#: inc/features/class-jobtype-dbdump-pro.php:
|
1725 |
-
#: inc/features/class-jobtype-dbdump-pro.php:
|
1726 |
#, php-format
|
1727 |
#@ backwpup
|
1728 |
msgid "Database error %1$s for query %2$s"
|
1729 |
msgstr "Datenbankfehler %1$s für die Abfrage (Query) %2$s"
|
1730 |
|
1731 |
-
#: inc/class-jobtype-dbdump.php:
|
1732 |
-
#: inc/features/class-jobtype-dbdump-pro.php:
|
1733 |
#@ backwpup
|
1734 |
msgid "No tables to dump."
|
1735 |
msgstr "Es gibt keine Tabellen zu sichern"
|
1736 |
|
1737 |
-
#: inc/class-jobtype-dbdump.php:
|
1738 |
-
#: inc/features/class-jobtype-dbdump-pro.php:
|
1739 |
#, php-format
|
1740 |
#@ backwpup
|
1741 |
msgid "Dump database table \"%s\""
|
1742 |
msgstr "Sichere Datenbanktabelle \"%s\""
|
1743 |
|
1744 |
-
#: inc/class-jobtype-dbdump.php:
|
1745 |
-
#: inc/features/class-jobtype-dbdump-pro.php:
|
1746 |
-
#: inc/features/class-jobtype-dbdump-pro.php:
|
1747 |
#@ backwpup
|
1748 |
msgid "Database dump done!"
|
1749 |
msgstr "Datenbank-Backup fertig!"
|
@@ -1769,53 +1735,48 @@ msgstr "Einstellungen der Datenbank Optimierung"
|
|
1769 |
msgid "Optimize WordPress Database tables only"
|
1770 |
msgstr "Optimiere nur WordPress Datenbank Tabellen"
|
1771 |
|
1772 |
-
#: inc/class-jobtype-dboptimize.php:
|
1773 |
-
|
1774 |
-
msgid "Activate maintenance mode during table optimize"
|
1775 |
-
msgstr "Aktiviere den Wartungsmodus bei der Tabellen Optimierung"
|
1776 |
-
|
1777 |
-
#: inc/class-jobtype-dboptimize.php:61
|
1778 |
-
#: inc/class-jobtype-dboptimize.php:64
|
1779 |
#@ backwpup
|
1780 |
msgid "Table types to optimize"
|
1781 |
msgstr "Tabellen-Typen zum Optimieren"
|
1782 |
|
1783 |
-
#: inc/class-jobtype-dboptimize.php:
|
1784 |
#@ backwpup
|
1785 |
msgid "Optimize MyISAM Tables"
|
1786 |
msgstr "Optimiere MyISAM Tabellen"
|
1787 |
|
1788 |
-
#: inc/class-jobtype-dboptimize.php:
|
1789 |
#@ backwpup
|
1790 |
msgid "Optimize InnoDB tables"
|
1791 |
msgstr "Optimiere InnoDB Tabellen"
|
1792 |
|
1793 |
-
#: inc/class-jobtype-dboptimize.php:
|
1794 |
#@ backwpup
|
1795 |
msgid "Optimize will done with ALTER TABLE `table` ENGINE=InnoDB"
|
1796 |
msgstr "Optimierung wird erledigt mit ALTER TABLE `table` ENGINE=InnoDB "
|
1797 |
|
1798 |
-
#: inc/class-jobtype-dboptimize.php:
|
1799 |
-
#: inc/class-jobtype-dboptimize.php:
|
1800 |
-
#: inc/class-jobtype-dboptimize.php:
|
1801 |
#, php-format
|
1802 |
#@ backwpup
|
1803 |
msgid "Result of MyISAM table optimize for %1$s is: %2$s"
|
1804 |
msgstr "Ergebnis der MyISAM Tabellen Optmierung für %1$s ist: %2$s"
|
1805 |
|
1806 |
-
#: inc/class-jobtype-dboptimize.php:
|
1807 |
#, php-format
|
1808 |
#@ backwpup
|
1809 |
msgid "InnoDB Table %1$s optimizing done."
|
1810 |
msgstr "InnoDB-Tabelle %1$s: Optimierung abgeschlossen."
|
1811 |
|
1812 |
-
#: inc/class-jobtype-dboptimize.php:
|
1813 |
#, php-format
|
1814 |
#@ backwpup
|
1815 |
msgid "%2$s table %1$s not optimized."
|
1816 |
msgstr "%2$s Tabelle %1$s ist nicht optimiert."
|
1817 |
|
1818 |
-
#: inc/class-jobtype-dboptimize.php:
|
1819 |
#@ backwpup
|
1820 |
msgid "No tables to optimize."
|
1821 |
msgstr "Es gibt keine Datenbanktabellen zum Optimieren."
|
@@ -1934,8 +1895,8 @@ msgstr "Inaktive Plugins:"
|
|
1934 |
msgid "Added plugin list file \"%1$s\" with %2$s to backup file list."
|
1935 |
msgstr "Plugin Listendatei \"%1$s\" mit %2$s zur Backup Dateiliste hinzugefügt."
|
1936 |
|
1937 |
-
#: inc/class-page-backups.php:
|
1938 |
-
#: inc/class-page-backups.php:
|
1939 |
#: inc/class-page-jobs.php:56
|
1940 |
#: inc/class-page-jobs.php:130
|
1941 |
#: inc/class-page-logs.php:103
|
@@ -1944,42 +1905,42 @@ msgstr "Plugin Listendatei \"%1$s\" mit %2$s zur Backup Dateiliste hinzugefügt
|
|
1944 |
msgid "Delete"
|
1945 |
msgstr "Löschen"
|
1946 |
|
1947 |
-
#: inc/class-page-backups.php:
|
1948 |
#@ backwpup
|
1949 |
msgid "Change destination"
|
1950 |
msgstr "Ziel ändern"
|
1951 |
|
1952 |
-
#: inc/class-page-backups.php:
|
1953 |
#@ backwpup
|
1954 |
msgid "File"
|
1955 |
msgstr "Datei"
|
1956 |
|
1957 |
-
#: inc/class-page-backups.php:
|
1958 |
#: inc/class-page-logs.php:118
|
1959 |
#@ backwpup
|
1960 |
msgid "Size"
|
1961 |
msgstr "Größe"
|
1962 |
|
1963 |
-
#: inc/class-page-backups.php:
|
1964 |
-
#: inc/class-page-backwpup.php:
|
1965 |
-
#: inc/class-page-backwpup.php:
|
1966 |
#@ backwpup
|
1967 |
msgid "Time"
|
1968 |
msgstr "Zeit"
|
1969 |
|
1970 |
-
#: inc/class-page-backups.php:
|
1971 |
#: inc/class-page-jobs.php:219
|
1972 |
#: inc/class-page-logs.php:186
|
1973 |
#@ backwpup
|
1974 |
msgid "Download"
|
1975 |
msgstr "Herunterladen"
|
1976 |
|
1977 |
-
#: inc/class-page-backups.php:
|
1978 |
#@ backwpup
|
1979 |
msgid "?"
|
1980 |
msgstr "?"
|
1981 |
|
1982 |
-
#: inc/class-page-backups.php:
|
1983 |
#, php-format
|
1984 |
#@ backwpup
|
1985 |
msgid "%s Manage Backup Archives"
|
@@ -2001,73 +1962,73 @@ msgstr "Willkommen zu BackWPup Pro"
|
|
2001 |
msgid "Welcome to BackWPup"
|
2002 |
msgstr "Willkommen bei BackWPup"
|
2003 |
|
2004 |
-
#: inc/class-page-backwpup.php:
|
2005 |
-
#: inc/features/class-page-wizard.php:
|
2006 |
#@ backwpup
|
2007 |
msgid "Start wizard"
|
2008 |
msgstr "Assistenten starten"
|
2009 |
|
2010 |
-
#: inc/class-page-backwpup.php:
|
2011 |
#@ backwpup
|
2012 |
msgid "Test the installation"
|
2013 |
msgstr "Die Installation testen"
|
2014 |
|
2015 |
-
#: inc/class-page-backwpup.php:
|
2016 |
-
#: inc/class-page-backwpup.php:
|
2017 |
#@ backwpup
|
2018 |
msgid "Create a Job"
|
2019 |
msgstr "Auftrag erstellen"
|
2020 |
|
2021 |
-
#: inc/class-page-backwpup.php:
|
2022 |
#@ backwpup
|
2023 |
msgid "Run the created job"
|
2024 |
msgstr "Erstellten Auftrag starten"
|
2025 |
|
2026 |
-
#: inc/class-page-backwpup.php:
|
2027 |
#@ backwpup
|
2028 |
msgid "Check the job log"
|
2029 |
msgstr "Logs des Auftrages prüfen"
|
2030 |
|
2031 |
-
#: inc/class-page-backwpup.php:
|
2032 |
#@ backwpup
|
2033 |
msgid "Next scheduled jobs"
|
2034 |
msgstr "Nächste geplante Aufträge"
|
2035 |
|
2036 |
-
#: inc/class-page-backwpup.php:
|
2037 |
-
#: inc/class-page-backwpup.php:
|
2038 |
#: inc/class-page-logs.php:114
|
2039 |
#@ backwpup
|
2040 |
msgid "Job"
|
2041 |
msgstr "Auftrag"
|
2042 |
|
2043 |
-
#: inc/class-page-backwpup.php:
|
2044 |
#, php-format
|
2045 |
#@ backwpup
|
2046 |
msgid "working since %d seconds"
|
2047 |
msgstr "in Arbeit seit %d Sek."
|
2048 |
|
2049 |
-
#: inc/class-page-backwpup.php:
|
2050 |
-
#: inc/class-page-jobs.php:
|
2051 |
#@ backwpup
|
2052 |
msgid "Abort"
|
2053 |
msgstr "Abbrechen"
|
2054 |
|
2055 |
-
#: inc/class-page-backwpup.php:
|
2056 |
#@ backwpup
|
2057 |
msgid "Edit Job"
|
2058 |
msgstr "Auftrag bearbeiten"
|
2059 |
|
2060 |
-
#: inc/class-page-backwpup.php:
|
2061 |
#@ backwpup
|
2062 |
msgid "Last logs"
|
2063 |
msgstr "Letzte Logs"
|
2064 |
|
2065 |
-
#: inc/class-page-backwpup.php:
|
2066 |
#@ backwpup
|
2067 |
msgid "Result"
|
2068 |
msgstr "Ergebnis"
|
2069 |
|
2070 |
-
#: inc/class-page-backwpup.php:
|
2071 |
#, php-format
|
2072 |
#@ backwpup
|
2073 |
msgid "%d ERROR"
|
@@ -2075,7 +2036,7 @@ msgid_plural "%d ERRORS"
|
|
2075 |
msgstr[0] "%d FEHLER"
|
2076 |
msgstr[1] "%d FEHLER"
|
2077 |
|
2078 |
-
#: inc/class-page-backwpup.php:
|
2079 |
#, php-format
|
2080 |
#@ backwpup
|
2081 |
msgid "%d WARNING"
|
@@ -2093,65 +2054,65 @@ msgstr "O.K."
|
|
2093 |
msgid "Overview"
|
2094 |
msgstr "Überblick"
|
2095 |
|
2096 |
-
#: inc/class-page-editjob.php:
|
2097 |
#, php-format
|
2098 |
#@ backwpup
|
2099 |
msgid "Changes for job <i>%s</i> saved."
|
2100 |
msgstr "Änderungen für den Auftrag <i>%s</i> gesichert."
|
2101 |
|
2102 |
-
#: inc/class-page-editjob.php:
|
2103 |
#, php-format
|
2104 |
#@ backwpup
|
2105 |
msgid "ATTENTION: Job runs every %d minutes!"
|
2106 |
msgstr "ACHTUNG: Auftrag läuft alle %d Minuten!"
|
2107 |
|
2108 |
-
#: inc/class-page-editjob.php:
|
2109 |
#, php-format
|
2110 |
#@ backwpup
|
2111 |
msgid "ATTENTION: Job runs every %d hours!"
|
2112 |
msgstr "ACHTUNG: Auftrag läuft alle %d Stunden!"
|
2113 |
|
2114 |
-
#: inc/class-page-editjob.php:
|
2115 |
#@ backwpup
|
2116 |
msgid "ATTENTION: Can't calculate cron!"
|
2117 |
msgstr "ACHTUNG: Kann cron nicht berechnen!"
|
2118 |
|
2119 |
-
#: inc/class-page-editjob.php:
|
2120 |
#@ backwpup
|
2121 |
msgid "Next runtime:"
|
2122 |
msgstr "Nächster Durchlauf:"
|
2123 |
|
2124 |
-
#: inc/class-page-editjob.php:
|
2125 |
#: inc/class-page-settings.php:103
|
2126 |
#@ backwpup
|
2127 |
msgid "General"
|
2128 |
msgstr "Allgemein"
|
2129 |
|
2130 |
-
#: inc/class-page-editjob.php:
|
2131 |
#@ backwpup
|
2132 |
msgid "Schedule"
|
2133 |
msgstr "Planen"
|
2134 |
|
2135 |
-
#: inc/class-page-editjob.php:
|
2136 |
#, php-format
|
2137 |
#@ backwpup
|
2138 |
msgid "To: %s"
|
2139 |
msgstr "Zu: %s"
|
2140 |
|
2141 |
-
#: inc/class-page-editjob.php:
|
2142 |
#, php-format
|
2143 |
#@ backwpup
|
2144 |
msgid "%s Job:"
|
2145 |
msgstr "%s Auftrag: "
|
2146 |
|
2147 |
-
#: inc/class-page-editjob.php:
|
2148 |
#: inc/features/class-wizard-job.php:228
|
2149 |
#@ backwpup
|
2150 |
msgid "Job tasks"
|
2151 |
msgstr "Auftragsdetails"
|
2152 |
|
2153 |
-
#: inc/class-page-editjob.php:
|
2154 |
-
#: inc/class-page-editjob.php:
|
2155 |
#: inc/features/class-wizard-job.php:350
|
2156 |
#: inc/features/class-wizard-job.php:353
|
2157 |
#@ backwpup
|
@@ -2163,20 +2124,20 @@ msgstr "Backup Typ"
|
|
2163 |
msgid "Sync file by file to destination"
|
2164 |
msgstr "Synchronisiere Datei für Datei zum Zielverzeichnis"
|
2165 |
|
2166 |
-
#: inc/class-page-editjob.php:
|
2167 |
#: inc/features/class-wizard-job.php:361
|
2168 |
#@ backwpup
|
2169 |
msgid "Create a backup archive"
|
2170 |
msgstr "Backup erstellen"
|
2171 |
|
2172 |
-
#: inc/class-page-editjob.php:
|
2173 |
-
#: inc/class-page-editjob.php:
|
2174 |
#@ backwpup
|
2175 |
msgid "Archive Format"
|
2176 |
msgstr "Archiv Format"
|
2177 |
|
2178 |
-
#: inc/class-page-editjob.php:
|
2179 |
-
#: inc/class-page-editjob.php:
|
2180 |
#: inc/features/class-wizard-job.php:371
|
2181 |
#: inc/features/class-wizard-job.php:373
|
2182 |
#@ backwpup
|
@@ -2190,22 +2151,22 @@ msgstr "Zip"
|
|
2190 |
msgid "Disabled because missing PHP function."
|
2191 |
msgstr "Aufgrund fehlender PHP Funktion deaktiviert."
|
2192 |
|
2193 |
-
#: inc/class-page-editjob.php:
|
2194 |
#: inc/features/class-wizard-job.php:374
|
2195 |
#@ backwpup
|
2196 |
msgid "Tar"
|
2197 |
msgstr "Tar"
|
2198 |
|
2199 |
-
#: inc/class-page-editjob.php:
|
2200 |
-
#: inc/class-page-editjob.php:
|
2201 |
#: inc/features/class-wizard-job.php:376
|
2202 |
#: inc/features/class-wizard-job.php:378
|
2203 |
#@ backwpup
|
2204 |
msgid "Tar GZip"
|
2205 |
msgstr "Tar GZip"
|
2206 |
|
2207 |
-
#: inc/class-page-editjob.php:
|
2208 |
-
#: inc/class-page-editjob.php:
|
2209 |
#: inc/features/class-wizard-job.php:380
|
2210 |
#: inc/features/class-wizard-job.php:382
|
2211 |
#@ backwpup
|
@@ -2224,56 +2185,56 @@ msgstr "Wo die Dateien abgelegt werden"
|
|
2224 |
msgid "Destinations"
|
2225 |
msgstr "Zielordner"
|
2226 |
|
2227 |
-
#: inc/class-page-editjob.php:
|
2228 |
-
#: inc/class-page-editjob.php:
|
2229 |
#@ backwpup
|
2230 |
msgid "Start job"
|
2231 |
msgstr "Auftrag starten"
|
2232 |
|
2233 |
-
#: inc/class-page-editjob.php:
|
2234 |
#@ backwpup
|
2235 |
msgid "manually only"
|
2236 |
msgstr "nur manuell"
|
2237 |
|
2238 |
-
#: inc/class-page-editjob.php:
|
2239 |
#@ backwpup
|
2240 |
msgid "with WordPress cron"
|
2241 |
msgstr "mit WordPress Cron"
|
2242 |
|
2243 |
-
#: inc/class-page-editjob.php:
|
2244 |
#@ backwpup
|
2245 |
msgid "with a link"
|
2246 |
msgstr "mit einem Link"
|
2247 |
|
2248 |
-
#: inc/class-page-editjob.php:
|
2249 |
#@ backwpup
|
2250 |
msgid "Schedule execution time"
|
2251 |
msgstr "Plane Ausführungszeit"
|
2252 |
|
2253 |
-
#: inc/class-page-editjob.php:
|
2254 |
-
#: inc/class-page-editjob.php:
|
2255 |
#@ backwpup
|
2256 |
msgid "Scheduler type"
|
2257 |
msgstr "Planungstyp"
|
2258 |
|
2259 |
-
#: inc/class-page-editjob.php:
|
2260 |
#@ backwpup
|
2261 |
msgid "basic"
|
2262 |
msgstr "einfach"
|
2263 |
|
2264 |
-
#: inc/class-page-editjob.php:
|
2265 |
#@ backwpup
|
2266 |
msgid "advanced"
|
2267 |
msgstr "erweitert"
|
2268 |
|
2269 |
-
#: inc/class-page-editjob.php:
|
2270 |
-
#: inc/class-page-editjob.php:
|
2271 |
#: inc/features/class-wizard-job.php:275
|
2272 |
#@ backwpup
|
2273 |
msgid "Scheduler"
|
2274 |
msgstr "Planer"
|
2275 |
|
2276 |
-
#: inc/class-page-editjob.php:
|
2277 |
#: inc/class-page-jobs.php:70
|
2278 |
#: inc/class-page-logs.php:115
|
2279 |
#: inc/features/class-wizard-job.php:280
|
@@ -2281,187 +2242,187 @@ msgstr "Planer"
|
|
2281 |
msgid "Type"
|
2282 |
msgstr "Typ"
|
2283 |
|
2284 |
-
#: inc/class-page-editjob.php:
|
2285 |
#: inc/features/class-wizard-job.php:285
|
2286 |
#@ backwpup
|
2287 |
msgid "Hour"
|
2288 |
msgstr "Stunde"
|
2289 |
|
2290 |
-
#: inc/class-page-editjob.php:
|
2291 |
#: inc/features/class-wizard-job.php:288
|
2292 |
#@ backwpup
|
2293 |
msgid "Minute"
|
2294 |
msgstr "Minute"
|
2295 |
|
2296 |
-
#: inc/class-page-editjob.php:
|
2297 |
#: inc/features/class-wizard-job.php:292
|
2298 |
#@ backwpup
|
2299 |
msgid "monthly"
|
2300 |
msgstr "monatlich"
|
2301 |
|
2302 |
-
#: inc/class-page-editjob.php:
|
2303 |
#: inc/features/class-wizard-job.php:294
|
2304 |
#@ backwpup
|
2305 |
msgid "on"
|
2306 |
msgstr "am"
|
2307 |
|
2308 |
-
#: inc/class-page-editjob.php:
|
2309 |
#: inc/features/class-wizard-job.php:304
|
2310 |
#@ backwpup
|
2311 |
msgid "weekly"
|
2312 |
msgstr "wöchentlich"
|
2313 |
|
2314 |
-
#: inc/class-page-editjob.php:
|
2315 |
-
#: inc/class-page-editjob.php:
|
2316 |
#: inc/features/class-wizard-job.php:306
|
2317 |
#@ backwpup
|
2318 |
msgid "Sunday"
|
2319 |
msgstr "Sonntag"
|
2320 |
|
2321 |
-
#: inc/class-page-editjob.php:
|
2322 |
-
#: inc/class-page-editjob.php:
|
2323 |
#: inc/features/class-wizard-job.php:307
|
2324 |
#@ backwpup
|
2325 |
msgid "Monday"
|
2326 |
msgstr "Montag"
|
2327 |
|
2328 |
-
#: inc/class-page-editjob.php:
|
2329 |
-
#: inc/class-page-editjob.php:
|
2330 |
#: inc/features/class-wizard-job.php:308
|
2331 |
#@ backwpup
|
2332 |
msgid "Tuesday"
|
2333 |
msgstr "Dienstag"
|
2334 |
|
2335 |
-
#: inc/class-page-editjob.php:
|
2336 |
-
#: inc/class-page-editjob.php:
|
2337 |
#: inc/features/class-wizard-job.php:309
|
2338 |
#@ backwpup
|
2339 |
msgid "Wednesday"
|
2340 |
msgstr "Mittwoch"
|
2341 |
|
2342 |
-
#: inc/class-page-editjob.php:
|
2343 |
-
#: inc/class-page-editjob.php:
|
2344 |
#: inc/features/class-wizard-job.php:310
|
2345 |
#@ backwpup
|
2346 |
msgid "Thursday"
|
2347 |
msgstr "Donnerstag"
|
2348 |
|
2349 |
-
#: inc/class-page-editjob.php:
|
2350 |
-
#: inc/class-page-editjob.php:
|
2351 |
#: inc/features/class-wizard-job.php:311
|
2352 |
#@ backwpup
|
2353 |
msgid "Friday"
|
2354 |
msgstr "Freitag"
|
2355 |
|
2356 |
-
#: inc/class-page-editjob.php:
|
2357 |
-
#: inc/class-page-editjob.php:
|
2358 |
#: inc/features/class-wizard-job.php:312
|
2359 |
#@ backwpup
|
2360 |
msgid "Saturday"
|
2361 |
msgstr "Samstag"
|
2362 |
|
2363 |
-
#: inc/class-page-editjob.php:
|
2364 |
#: inc/features/class-wizard-job.php:322
|
2365 |
#@ backwpup
|
2366 |
msgid "daily"
|
2367 |
msgstr "täglich"
|
2368 |
|
2369 |
-
#: inc/class-page-editjob.php:
|
2370 |
#: inc/features/class-wizard-job.php:332
|
2371 |
#@ backwpup
|
2372 |
msgid "hourly"
|
2373 |
msgstr "stündlich"
|
2374 |
|
2375 |
-
#: inc/class-page-editjob.php:
|
2376 |
-
#: inc/class-page-editjob.php:
|
2377 |
-
#: inc/class-page-editjob.php:
|
2378 |
-
#: inc/class-page-editjob.php:
|
2379 |
-
#: inc/class-page-editjob.php:
|
2380 |
#@ backwpup
|
2381 |
msgid "Any (*)"
|
2382 |
msgstr "Alle (*)"
|
2383 |
|
2384 |
-
#: inc/class-page-editjob.php:
|
2385 |
#@ backwpup
|
2386 |
msgid "Hours:"
|
2387 |
msgstr "Stunden:"
|
2388 |
|
2389 |
-
#: inc/class-page-editjob.php:
|
2390 |
#@ backwpup
|
2391 |
msgid "Day of Month:"
|
2392 |
msgstr "Tag des Monats:"
|
2393 |
|
2394 |
-
#: inc/class-page-editjob.php:
|
2395 |
#@ backwpup
|
2396 |
msgid "Month:"
|
2397 |
msgstr "Monat:"
|
2398 |
|
2399 |
-
#: inc/class-page-editjob.php:
|
2400 |
#@ backwpup
|
2401 |
msgid "January"
|
2402 |
msgstr "Januar"
|
2403 |
|
2404 |
-
#: inc/class-page-editjob.php:
|
2405 |
#@ backwpup
|
2406 |
msgid "February"
|
2407 |
msgstr "Februar"
|
2408 |
|
2409 |
-
#: inc/class-page-editjob.php:
|
2410 |
#@ backwpup
|
2411 |
msgid "March"
|
2412 |
msgstr "März"
|
2413 |
|
2414 |
-
#: inc/class-page-editjob.php:
|
2415 |
#@ backwpup
|
2416 |
msgid "April"
|
2417 |
msgstr "April"
|
2418 |
|
2419 |
-
#: inc/class-page-editjob.php:
|
2420 |
#@ backwpup
|
2421 |
msgid "May"
|
2422 |
msgstr "Mai"
|
2423 |
|
2424 |
-
#: inc/class-page-editjob.php:
|
2425 |
#@ backwpup
|
2426 |
msgid "June"
|
2427 |
msgstr "Juni"
|
2428 |
|
2429 |
-
#: inc/class-page-editjob.php:
|
2430 |
#@ backwpup
|
2431 |
msgid "July"
|
2432 |
msgstr "Juli"
|
2433 |
|
2434 |
-
#: inc/class-page-editjob.php:
|
2435 |
#@ backwpup
|
2436 |
msgid "August"
|
2437 |
msgstr "August"
|
2438 |
|
2439 |
-
#: inc/class-page-editjob.php:
|
2440 |
#@ backwpup
|
2441 |
msgid "September"
|
2442 |
msgstr "September"
|
2443 |
|
2444 |
-
#: inc/class-page-editjob.php:
|
2445 |
#@ backwpup
|
2446 |
msgid "October"
|
2447 |
msgstr "Oktober"
|
2448 |
|
2449 |
-
#: inc/class-page-editjob.php:
|
2450 |
#@ backwpup
|
2451 |
msgid "November"
|
2452 |
msgstr "November"
|
2453 |
|
2454 |
-
#: inc/class-page-editjob.php:
|
2455 |
#@ backwpup
|
2456 |
msgid "December"
|
2457 |
msgstr "Dezember"
|
2458 |
|
2459 |
-
#: inc/class-page-editjob.php:
|
2460 |
#@ backwpup
|
2461 |
msgid "Day of Week:"
|
2462 |
msgstr "Wochentag:"
|
2463 |
|
2464 |
-
#: inc/class-page-editjob.php:
|
2465 |
#@ backwpup
|
2466 |
msgid "Save changes"
|
2467 |
msgstr "Änderungen speichern"
|
@@ -2476,7 +2437,7 @@ msgstr "Keine Aufträge."
|
|
2476 |
msgid "ID"
|
2477 |
msgstr "ID"
|
2478 |
|
2479 |
-
#: inc/class-page-editjob.php:
|
2480 |
#: inc/class-page-jobs.php:69
|
2481 |
#@ backwpup
|
2482 |
msgid "Job Name"
|
@@ -2519,7 +2480,7 @@ msgstr "Läuft seit %s Sekunden"
|
|
2519 |
msgid "Cron: %s"
|
2520 |
msgstr "Cron: %s"
|
2521 |
|
2522 |
-
#: inc/class-page-backwpup.php:
|
2523 |
#: inc/class-page-jobs.php:197
|
2524 |
#@ backwpup
|
2525 |
msgid "Not scheduled!"
|
@@ -2545,56 +2506,56 @@ msgstr "Protokoll"
|
|
2545 |
msgid "Copy of"
|
2546 |
msgstr "Kopie von"
|
2547 |
|
2548 |
-
#: inc/class-page-jobs.php:
|
2549 |
#, php-format
|
2550 |
#@ backwpup
|
2551 |
msgid "Job \"%s\" started."
|
2552 |
msgstr "Auftrag \"%s\" wurde gestartet."
|
2553 |
|
2554 |
-
#: inc/class-page-jobs.php:
|
2555 |
-
#: inc/class-wp-cli.php:
|
2556 |
#@ backwpup
|
2557 |
msgid "Aborted by user!"
|
2558 |
msgstr "Abgebrochen vom Benutzer!"
|
2559 |
|
2560 |
-
#: inc/class-page-jobs.php:
|
2561 |
-
#: inc/class-wp-cli.php:
|
2562 |
#@ backwpup
|
2563 |
msgid "Job will be terminated."
|
2564 |
msgstr "Auftrag wird beendet."
|
2565 |
|
2566 |
-
#: inc/class-page-jobs.php:
|
2567 |
#, php-format
|
2568 |
#@ backwpup
|
2569 |
msgid "%s Jobs"
|
2570 |
msgstr "%s Aufträge"
|
2571 |
|
2572 |
-
#: inc/class-page-jobs.php:
|
2573 |
#@ backwpup
|
2574 |
msgid "Warnings:"
|
2575 |
msgstr "Warnungen:"
|
2576 |
|
2577 |
-
#: inc/class-page-jobs.php:
|
2578 |
#@ backwpup
|
2579 |
msgid "Errors:"
|
2580 |
msgstr "Fehler:"
|
2581 |
|
2582 |
-
#: inc/class-page-jobs.php:
|
2583 |
#@ backwpup
|
2584 |
msgid "Display working log"
|
2585 |
msgstr "Zeige Auftragslog"
|
2586 |
|
2587 |
-
#: inc/class-page-jobs.php:
|
2588 |
#@ backwpup
|
2589 |
msgid "Close working screen"
|
2590 |
msgstr "Arbeitsfläche schließen"
|
2591 |
|
2592 |
-
#: inc/class-page-jobs.php:
|
2593 |
#@ backwpup
|
2594 |
msgid "close"
|
2595 |
msgstr "schließen"
|
2596 |
|
2597 |
-
#: inc/class-page-jobs.php:
|
2598 |
#@ backwpup
|
2599 |
msgid "Job end"
|
2600 |
msgstr "Auftragsende"
|
@@ -2647,7 +2608,7 @@ msgstr "Nur Log"
|
|
2647 |
|
2648 |
#: inc/class-destination-ftp.php:101
|
2649 |
#: inc/class-page-logs.php:212
|
2650 |
-
#: inc/class-page-settings.php:
|
2651 |
#@ backwpup
|
2652 |
msgid "seconds"
|
2653 |
msgstr "Sekunden"
|
@@ -2817,119 +2778,119 @@ msgstr "Pro-Version kaufen"
|
|
2817 |
msgid "unavailable"
|
2818 |
msgstr "unerreichbar"
|
2819 |
|
2820 |
-
#: inc/class-page-settings.php:
|
2821 |
#@ backwpup
|
2822 |
msgid "Server"
|
2823 |
msgstr "Server"
|
2824 |
|
2825 |
-
#: inc/class-page-settings.php:
|
2826 |
#@ backwpup
|
2827 |
msgid "Operating System"
|
2828 |
msgstr "Betriebssystem"
|
2829 |
|
2830 |
-
#: inc/class-page-settings.php:
|
2831 |
#@ backwpup
|
2832 |
msgid "PHP SAPI"
|
2833 |
msgstr "PHP SAPI"
|
2834 |
|
2835 |
-
#: inc/class-page-settings.php:
|
2836 |
#@ backwpup
|
2837 |
msgid "Current PHP user"
|
2838 |
msgstr "Aktueller PHP user"
|
2839 |
|
2840 |
-
#: inc/class-page-settings.php:411
|
2841 |
#: inc/class-page-settings.php:415
|
2842 |
#: inc/class-page-settings.php:419
|
|
|
2843 |
#@ backwpup
|
2844 |
msgid "On"
|
2845 |
msgstr "An"
|
2846 |
|
2847 |
-
#: inc/class-page-settings.php:
|
2848 |
-
#: inc/class-page-settings.php:417
|
2849 |
#: inc/class-page-settings.php:421
|
|
|
2850 |
#@ backwpup
|
2851 |
msgid "Off"
|
2852 |
msgstr "Aus"
|
2853 |
|
2854 |
-
#: inc/class-page-settings.php:
|
2855 |
#@ backwpup
|
2856 |
msgid "Safe Mode"
|
2857 |
msgstr "Safe Mode"
|
2858 |
|
2859 |
-
#: inc/class-page-settings.php:
|
2860 |
#@ backwpup
|
2861 |
msgid "Maximum execution time"
|
2862 |
msgstr "Max. Ausführungszeit"
|
2863 |
|
2864 |
-
#: inc/class-page-settings.php:
|
2865 |
-
#: inc/class-page-settings.php:
|
2866 |
#@ backwpup
|
2867 |
msgid "Alternative WP Cron"
|
2868 |
msgstr "Alternative WP Cron"
|
2869 |
|
2870 |
-
#: inc/class-page-settings.php:
|
2871 |
-
#: inc/class-page-settings.php:
|
2872 |
#@ backwpup
|
2873 |
msgid "CHMOD Dir"
|
2874 |
msgstr "CHMOD Verzeichnis"
|
2875 |
|
2876 |
-
#: inc/class-page-settings.php:
|
2877 |
#@ backwpup
|
2878 |
msgid "Server Time"
|
2879 |
msgstr "Server Zeit"
|
2880 |
|
2881 |
-
#: inc/class-page-settings.php:
|
2882 |
#@ backwpup
|
2883 |
msgid "Blog Time"
|
2884 |
msgstr "Webseite Zeit"
|
2885 |
|
2886 |
-
#: inc/class-page-settings.php:
|
2887 |
#@ backwpup
|
2888 |
msgid "Blog Timezone"
|
2889 |
msgstr "Webseite Zeitzone"
|
2890 |
|
2891 |
-
#: inc/class-page-settings.php:
|
2892 |
#@ backwpup
|
2893 |
msgid "Blog Time offset"
|
2894 |
msgstr "Webseite Zeitversetzung"
|
2895 |
|
2896 |
-
#: inc/class-page-settings.php:
|
2897 |
#, php-format
|
2898 |
#@ backwpup
|
2899 |
msgid "%s hours"
|
2900 |
msgstr "%s Stunden"
|
2901 |
|
2902 |
-
#: inc/class-page-settings.php:
|
2903 |
#@ backwpup
|
2904 |
msgid "Blog language"
|
2905 |
msgstr "Webseiten Sprache"
|
2906 |
|
2907 |
-
#: inc/class-page-settings.php:
|
2908 |
#@ backwpup
|
2909 |
msgid "MySQL Client encoding"
|
2910 |
msgstr "MySQL Client Encoding"
|
2911 |
|
2912 |
-
#: inc/class-page-settings.php:
|
2913 |
#@ backwpup
|
2914 |
msgid "Blog charset"
|
2915 |
msgstr "Webseiten Charset"
|
2916 |
|
2917 |
-
#: inc/class-page-settings.php:
|
2918 |
#@ backwpup
|
2919 |
msgid "PHP Memory limit"
|
2920 |
msgstr "PHP Memory Limit"
|
2921 |
|
2922 |
-
#: inc/class-page-settings.php:
|
2923 |
#@ backwpup
|
2924 |
msgid "Memory in use"
|
2925 |
msgstr "Speicher in Benutzung"
|
2926 |
|
2927 |
-
#: inc/class-page-settings.php:
|
2928 |
#@ backwpup
|
2929 |
msgid "Disabled PHP Functions:"
|
2930 |
msgstr "Deaktivierte PHP Funktionen:"
|
2931 |
|
2932 |
-
#: inc/class-page-settings.php:
|
2933 |
#@ backwpup
|
2934 |
msgid "Loaded PHP Extensions:"
|
2935 |
msgstr "Geladene PHP Erweiterungen"
|
@@ -2939,7 +2900,7 @@ msgstr "Geladene PHP Erweiterungen"
|
|
2939 |
msgid "Job Types"
|
2940 |
msgstr "Auftragstypen"
|
2941 |
|
2942 |
-
#: inc/class-page-settings.php:
|
2943 |
#@ backwpup
|
2944 |
msgid "Save Changes"
|
2945 |
msgstr "Änderungen speichern"
|
@@ -3001,58 +2962,53 @@ msgstr "Etwas ist falsch gelaufen. Bitte versuche es erneut oder kontaktiere das
|
|
3001 |
msgid "Due to a wrong license you are not allowed to activate this plugin. Please update your license at <a href=\"http://marketpress.com\">marketpress.com</a>."
|
3002 |
msgstr "Dir ist nicht erlaubt, das Plugin zu aktivieren, mit einer falschen Lizenz. Bitte aktualisiere deine Lizenz auf <a href=\"http://marketpress.de\">MarketPress.de</a>."
|
3003 |
|
3004 |
-
#: inc/features/class-destination-dropbox-pro.php:
|
3005 |
-
#: inc/features/class-destination-dropbox-pro.php:
|
3006 |
#: inc/features/class-destination-sugarsync-pro.php:28
|
3007 |
#@ backwpup
|
3008 |
msgid "Login:"
|
3009 |
msgstr "Login:"
|
3010 |
|
3011 |
-
#: inc/features/class-destination-dropbox-pro.php:
|
3012 |
#@ backwpup
|
3013 |
msgid "Reauthenticate"
|
3014 |
msgstr "Neu authentifizieren"
|
3015 |
|
3016 |
-
#: inc/features/class-destination-dropbox-pro.php:
|
3017 |
#: inc/features/class-destination-sugarsync-pro.php:55
|
3018 |
#@ backwpup
|
3019 |
msgid "Folder:"
|
3020 |
msgstr "Ordner:"
|
3021 |
|
3022 |
-
#: inc/features/class-destination-dropbox-pro.php:
|
3023 |
#, php-format
|
3024 |
#@ backwpup
|
3025 |
msgid "%d. Try to sync files to Dropbox …"
|
3026 |
msgstr "%d. Versuche, Dateien mit Dropbox zu synchronisieren …"
|
3027 |
|
3028 |
-
#: inc/features/class-destination-dropbox-pro.php:
|
3029 |
#@ backwpup
|
3030 |
msgid "Retrieving file list from Dropbox"
|
3031 |
msgstr "Ziehe Dateiliste von Dropbox"
|
3032 |
|
3033 |
-
#: inc/features/class-destination-dropbox-pro.php:
|
3034 |
#@ backwpup
|
3035 |
msgid "Upload changed files to Dropbox"
|
3036 |
msgstr "Lade geänderte Datei in die Dropbox"
|
3037 |
|
3038 |
-
#: inc/features/class-destination-dropbox-pro.php:
|
3039 |
#, php-format
|
3040 |
#@ backwpup
|
3041 |
msgid "File %s uploaded to Dropbox"
|
3042 |
msgstr "Datei %s in die Dropbox geladen"
|
3043 |
|
3044 |
-
#: inc/features/class-destination-dropbox-pro.php:
|
3045 |
#, php-format
|
3046 |
#@ backwpup
|
3047 |
msgid "Extra file %s uploaded to Dropbox"
|
3048 |
msgstr "Extra Datei %s in die Dropbox geladen"
|
3049 |
|
3050 |
-
#: inc/features/class-destination-dropbox-pro.php:
|
3051 |
-
#@ backwpup
|
3052 |
-
msgid "Delete nonexistent files from Dropbox"
|
3053 |
-
msgstr "Es werden keine existierenden Dateien in der Dropbox gelöscht."
|
3054 |
-
|
3055 |
-
#: inc/features/class-destination-dropbox-pro.php:215
|
3056 |
#, php-format
|
3057 |
#@ backwpup
|
3058 |
msgid "File %s deleted from Dropbox"
|
@@ -3069,7 +3025,7 @@ msgstr "Ziehe Dateiliste vom Ordner"
|
|
3069 |
msgid "File %s copied"
|
3070 |
msgstr "Datei %s kopiert"
|
3071 |
|
3072 |
-
#: inc/features/class-destination-folder-pro.php:
|
3073 |
#, php-format
|
3074 |
#@ backwpup
|
3075 |
msgid "Empty folder %s deleted"
|
@@ -3098,7 +3054,7 @@ msgstr "Kontoname/ Benutzername:"
|
|
3098 |
|
3099 |
#: inc/features/class-destination-msazure-pro.php:15
|
3100 |
#: inc/features/class-destination-s3-pro.php:39
|
3101 |
-
#: inc/features/class-destination-s3-v1-pro.php:
|
3102 |
#@ backwpup
|
3103 |
msgid "Access Key:"
|
3104 |
msgstr "Zugangsschlüssel (Access Key):"
|
@@ -3193,83 +3149,83 @@ msgstr "Datei %s zur Rackspace Cloud hochgeladen."
|
|
3193 |
msgid "Extra file %s uploaded to Rackspace Cloud."
|
3194 |
msgstr "Extra Datei %s zur Rackspace Cloud hochgeladen."
|
3195 |
|
3196 |
-
#: inc/features/class-destination-rsc-pro.php:
|
3197 |
#, php-format
|
3198 |
#@ backwpup
|
3199 |
msgid "File %s deleted from Rackspace Cloud."
|
3200 |
msgstr "Datei %s in der Rackspace Cloud gelöscht."
|
3201 |
|
3202 |
#: inc/features/class-destination-s3-pro.php:22
|
3203 |
-
#: inc/features/class-destination-s3-v1-pro.php:
|
3204 |
#@ backwpup
|
3205 |
msgid "Select an S3 service:"
|
3206 |
msgstr "Wähle einen S3 service: "
|
3207 |
|
3208 |
#: inc/features/class-destination-s3-pro.php:42
|
3209 |
-
#: inc/features/class-destination-s3-v1-pro.php:
|
3210 |
#@ backwpup
|
3211 |
msgid "Secret Key:"
|
3212 |
msgstr "Secret Key:"
|
3213 |
|
3214 |
#: inc/features/class-destination-s3-pro.php:45
|
3215 |
-
#: inc/features/class-destination-s3-v1-pro.php:
|
3216 |
#@ backwpup
|
3217 |
msgid "Bucket:"
|
3218 |
msgstr "Bucket:"
|
3219 |
|
3220 |
#: inc/features/class-destination-s3-pro.php:55
|
3221 |
-
#: inc/features/class-destination-s3-v1-pro.php:
|
3222 |
#@ backwpup
|
3223 |
msgid "New Bucket:"
|
3224 |
msgstr "Neues Bucket: "
|
3225 |
|
3226 |
#: inc/features/class-destination-s3-pro.php:57
|
3227 |
-
#: inc/features/class-destination-s3-v1-pro.php:
|
3228 |
#@ backwpup
|
3229 |
msgid "Folder in bucket:"
|
3230 |
msgstr "Ordner im Bucket:"
|
3231 |
|
3232 |
#: inc/features/class-destination-s3-pro.php:152
|
3233 |
-
#: inc/features/class-destination-s3-v1-pro.php:
|
3234 |
#, php-format
|
3235 |
#@ backwpup
|
3236 |
msgid "%d. Trying to sync files to S3 Service …"
|
3237 |
msgstr "%d. Versuche, die Dateien mit dem S3-Service zu synchronisieren …"
|
3238 |
|
3239 |
#: inc/features/class-destination-s3-pro.php:174
|
3240 |
-
#: inc/features/class-destination-s3-v1-pro.php:
|
3241 |
#@ backwpup
|
3242 |
msgid "Retrieving file list from S3."
|
3243 |
msgstr "Ziehe Dateilliste von S3."
|
3244 |
|
3245 |
#: inc/features/class-destination-s3-pro.php:227
|
3246 |
-
#: inc/features/class-destination-s3-v1-pro.php:
|
3247 |
#@ backwpup
|
3248 |
msgid "Upload changed files to S3."
|
3249 |
msgstr "Geänderte Dateien zu S3 hochladen."
|
3250 |
|
3251 |
#: inc/features/class-destination-s3-pro.php:239
|
3252 |
-
#: inc/features/class-destination-s3-v1-pro.php:
|
3253 |
#, php-format
|
3254 |
#@ backwpup
|
3255 |
msgid "File %s uploaded to S3."
|
3256 |
msgstr "Datei %s zu S3 hochgeladen."
|
3257 |
|
3258 |
#: inc/features/class-destination-s3-pro.php:256
|
3259 |
-
#: inc/features/class-destination-s3-v1-pro.php:
|
3260 |
#, php-format
|
3261 |
#@ backwpup
|
3262 |
msgid "Extra file %s uploaded to S3."
|
3263 |
msgstr "Extra Datei %s zu S3 hochgeladen."
|
3264 |
|
3265 |
#: inc/features/class-destination-s3-pro.php:265
|
3266 |
-
#: inc/features/class-destination-s3-v1-pro.php:
|
3267 |
#@ backwpup
|
3268 |
msgid "Delete nonexistent files on S3"
|
3269 |
msgstr "Es werden keine existierenden Dateien in S3 gelöscht."
|
3270 |
|
3271 |
-
#: inc/features/class-destination-s3-pro.php:
|
3272 |
-
#: inc/features/class-destination-s3-v1-pro.php:
|
3273 |
#, php-format
|
3274 |
#@ backwpup
|
3275 |
msgid "File %s deleted from S3."
|
@@ -3310,7 +3266,7 @@ msgid "Export"
|
|
3310 |
msgstr "Export"
|
3311 |
|
3312 |
#: inc/features/class-jobtype-dbcheck-pro.php:17
|
3313 |
-
#: inc/features/class-jobtype-dbdump-pro.php:
|
3314 |
#: inc/features/class-jobtype-dboptimize-pro.php:17
|
3315 |
#@ backwpup
|
3316 |
msgid "Only WordPress tables"
|
@@ -3321,73 +3277,73 @@ msgstr "Nur WordPress Tabellen"
|
|
3321 |
msgid "Check only WordPress Database tables"
|
3322 |
msgstr "Teste nur die WordPress Datenbank Tabellen"
|
3323 |
|
3324 |
-
#: inc/features/class-jobtype-dbdump-pro.php:
|
3325 |
#@ backwpup
|
3326 |
msgid "Dump only WordPress Database tables"
|
3327 |
msgstr "Nur die WordPress Datenbank Tabellen sichern"
|
3328 |
|
3329 |
-
#: inc/features/class-jobtype-dbdump-pro.php:
|
3330 |
#@ backwpup
|
3331 |
msgid "Database connection"
|
3332 |
msgstr "Datenbank Verbindung"
|
3333 |
|
3334 |
-
#: inc/features/class-jobtype-dbdump-pro.php:
|
3335 |
#@ backwpup
|
3336 |
msgid "Use WordPress database connection."
|
3337 |
msgstr "Nutze WordPress Datenbank Verbindung"
|
3338 |
|
3339 |
-
#: inc/features/class-jobtype-dbdump-pro.php:
|
3340 |
#@ backwpup
|
3341 |
msgid "User:"
|
3342 |
msgstr "Benutzer: "
|
3343 |
|
3344 |
-
#: inc/features/class-jobtype-dbdump-pro.php:
|
3345 |
#@ backwpup
|
3346 |
msgid "Charset:"
|
3347 |
msgstr "Charset: "
|
3348 |
|
3349 |
-
#: inc/features/class-jobtype-dbdump-pro.php:
|
3350 |
#@ backwpup
|
3351 |
msgid "Database:"
|
3352 |
msgstr "Datenbank:"
|
3353 |
|
3354 |
-
#: inc/class-jobtype-dbdump.php:
|
3355 |
-
#: inc/features/class-jobtype-dbdump-pro.php:
|
3356 |
-
#: inc/features/class-jobtype-dbdump-pro.php:
|
3357 |
#, php-format
|
3358 |
#@ backwpup
|
3359 |
msgid "Added database dump \"%1$s\" with %2$s to backup file list"
|
3360 |
msgstr "Datenbank-Backup erstellt \"%1$s\" mit %2$s zur Backup-Liste"
|
3361 |
|
3362 |
-
#: inc/features/class-jobtype-dbdump-pro.php:
|
3363 |
#@ backwpup
|
3364 |
msgid "Compressing done."
|
3365 |
msgstr "Komprimierung erledigt."
|
3366 |
|
3367 |
-
#: inc/features/class-jobtype-dbdump-pro.php:
|
3368 |
#@ backwpup
|
3369 |
msgid "No tables for XML dump"
|
3370 |
msgstr "Es gibt keine Tabellen für ein XML-Backup"
|
3371 |
|
3372 |
-
#: inc/features/class-jobtype-dbdump-pro.php:
|
3373 |
#, php-format
|
3374 |
#@ backwpup
|
3375 |
msgid "Dump database create view \"%s\""
|
3376 |
msgstr "Datenbank-Backup erstellt \"%s\""
|
3377 |
|
3378 |
-
#: inc/features/class-jobtype-dbdump-pro.php:
|
3379 |
#, php-format
|
3380 |
#@ backwpup
|
3381 |
msgid "Dump table \"%s\" data"
|
3382 |
msgstr "Backup der Tabellen \"%s\""
|
3383 |
|
3384 |
-
#: inc/features/class-jobtype-dbdump-pro.php:
|
3385 |
#, php-format
|
3386 |
#@ backwpup
|
3387 |
msgid "Added database XML dump \"%1$s\" with %2$s to backup file list"
|
3388 |
msgstr "XML-Backup der Datenbank \"%1$s\" mit %2$s zur Backup-Liste"
|
3389 |
|
3390 |
-
#: inc/features/class-jobtype-dbdump-pro.php:
|
3391 |
#@ backwpup
|
3392 |
msgid "Database XML dump done!"
|
3393 |
msgstr "XML-Backup der Datenbank erstellt."
|
@@ -3397,21 +3353,21 @@ msgstr "XML-Backup der Datenbank erstellt."
|
|
3397 |
msgid "Nothing to configure"
|
3398 |
msgstr "Nichts zu konfiguieren"
|
3399 |
|
3400 |
-
#: inc/features/class-page-wizard.php:
|
3401 |
-
#: inc/features/class-page-wizard.php:
|
3402 |
-
#: inc/features/class-page-wizard.php:
|
3403 |
#@ backwpup
|
3404 |
msgid "Next >"
|
3405 |
msgstr "weiter >"
|
3406 |
|
3407 |
-
#: inc/features/class-page-wizard.php:
|
3408 |
-
#: inc/features/class-page-wizard.php:
|
3409 |
#@ backwpup
|
3410 |
msgid "< Previous"
|
3411 |
msgstr "< vorher"
|
3412 |
|
3413 |
-
#: inc/features/class-page-wizard.php:
|
3414 |
-
#: inc/features/class-page-wizard.php:
|
3415 |
#@ backwpup
|
3416 |
msgid "Cancel"
|
3417 |
msgstr "Abbrechen"
|
@@ -3522,43 +3478,43 @@ msgstr "Ein .tar und .gz Archiv (schnell und schlank)"
|
|
3522 |
msgid "A tared and BZipped archive (fast and memory less)"
|
3523 |
msgstr "Ein .tar und .bz Archiv (schnell und schlank)"
|
3524 |
|
3525 |
-
#: inc/features/class-wizard-job.php:
|
3526 |
#, php-format
|
3527 |
#@ backwpup
|
3528 |
msgid "Wizard: %1$s"
|
3529 |
msgstr "Assistent: %1$s"
|
3530 |
|
3531 |
-
#: inc/features/class-wizard-job.php:
|
3532 |
#@ backwpup
|
3533 |
msgid "Create Job"
|
3534 |
msgstr "Auftrag erstellen"
|
3535 |
|
3536 |
-
#: inc/features/class-wizard-job.php:
|
3537 |
-
#: inc/features/class-wizard-job.php:
|
3538 |
#@ backwpup
|
3539 |
msgid "Database Backup and XML Export (Daily)"
|
3540 |
msgstr "DB Sicherung & XML Export (täglich)"
|
3541 |
|
3542 |
-
#: inc/features/class-wizard-job.php:
|
3543 |
-
#: inc/features/class-wizard-job.php:
|
3544 |
#@ backwpup
|
3545 |
msgid "Database Check and Optimization (Weekly)"
|
3546 |
msgstr "DB-Check & Optimierung (wöchentlich)"
|
3547 |
|
3548 |
-
#: inc/features/class-wizard-job.php:
|
3549 |
-
#: inc/features/class-wizard-job.php:
|
3550 |
#@ backwpup
|
3551 |
msgid "Uploads Backup"
|
3552 |
msgstr "Sicherung der Uploads"
|
3553 |
|
3554 |
-
#: inc/features/class-wizard-job.php:
|
3555 |
-
#: inc/features/class-wizard-job.php:
|
3556 |
#@ backwpup
|
3557 |
msgid "All Files Backup"
|
3558 |
msgstr "Sicherung aller Dateien"
|
3559 |
|
3560 |
-
#: inc/features/class-wizard-job.php:
|
3561 |
-
#: inc/features/class-wizard-job.php:
|
3562 |
#@ backwpup
|
3563 |
msgid "Custom configuration"
|
3564 |
msgstr "Benutzerdefinierte Konfiguration"
|
@@ -3701,17 +3657,17 @@ msgstr "Inpsyde GmbH"
|
|
3701 |
msgid "http://inpsyde.com"
|
3702 |
msgstr "http://inpsyde.com"
|
3703 |
|
3704 |
-
#: inc/class-adminbar.php:
|
3705 |
#@ backwpupadminbar
|
3706 |
msgid "running"
|
3707 |
msgstr "läuft"
|
3708 |
|
3709 |
-
#: inc/class-job.php:
|
3710 |
#@ backwpup
|
3711 |
msgid "Job Start"
|
3712 |
msgstr "Auftragsstart"
|
3713 |
|
3714 |
-
#: inc/class-job.php:
|
3715 |
#@ backwpup
|
3716 |
msgid "No destination correctly defined for backup! Please correct job settings."
|
3717 |
msgstr "Es wurde kein korrektes Backupziel definiert! Bitte überprüfe die Auftragseinstellungen."
|
@@ -3792,7 +3748,7 @@ msgstr "Datei Koprimierung"
|
|
3792 |
msgid "Plugin list file name"
|
3793 |
msgstr "Plugin listen Datei Name"
|
3794 |
|
3795 |
-
#: inc/class-page-backwpup.php:
|
3796 |
#@ backwpup
|
3797 |
msgid "Check the installation"
|
3798 |
msgstr "Überprüfe die Installation"
|
@@ -3807,72 +3763,66 @@ msgstr "Sicherheit"
|
|
3807 |
msgid "Security option for BackWPup"
|
3808 |
msgstr "Sicherheitseinstellungen für BackWPup"
|
3809 |
|
3810 |
-
#: inc/class-page-settings.php:
|
3811 |
#@ backwpup
|
3812 |
msgid "Server self connect:"
|
3813 |
msgstr "Verbindung zum Server selbst:"
|
3814 |
|
3815 |
-
#: inc/class-page-jobs.php:
|
3816 |
-
#: inc/class-page-settings.php:
|
3817 |
#, php-format
|
3818 |
#@ backwpup
|
3819 |
msgid "The HTTP response test get a error \"%s\""
|
3820 |
msgstr "Der HTTP Antwort Test bekommt diesen Fehler \"%s\""
|
3821 |
|
3822 |
-
#: inc/class-page-jobs.php:
|
3823 |
-
#: inc/class-page-settings.php:
|
3824 |
#, php-format
|
3825 |
#@ backwpup
|
3826 |
msgid "The HTTP response test get a false http status (%s)"
|
3827 |
msgstr "Der HTTP Antwort Test bekommt den falschen http Status (%s)"
|
3828 |
|
3829 |
-
#: inc/class-page-settings.php:
|
3830 |
-
#, php-format
|
3831 |
-
#@ backwpup
|
3832 |
-
msgid "The HTTP response gives back the false body \"%s\""
|
3833 |
-
msgstr "Der HTTP Antwort Test bekommt den falschen Inhalt \"%s\""
|
3834 |
-
|
3835 |
-
#: inc/class-page-settings.php:389
|
3836 |
#@ backwpup
|
3837 |
msgid "Temp folder:"
|
3838 |
msgstr "Temp Verzeichnis:"
|
3839 |
|
3840 |
-
#: inc/class-page-settings.php:
|
3841 |
#, php-format
|
3842 |
#@ backwpup
|
3843 |
msgid "Temp folder %s not exist and can't created."
|
3844 |
msgstr "Temp Verzeichnis %s existiert nicht und konnte nicht erstellt werden."
|
3845 |
|
3846 |
-
#: inc/class-page-settings.php:
|
3847 |
#, php-format
|
3848 |
#@ backwpup
|
3849 |
msgid "Temp folder %s not writable."
|
3850 |
msgstr "Temp Verzeichnis %s ist nicht beschreibbar."
|
3851 |
|
3852 |
-
#: inc/class-page-settings.php:
|
3853 |
#@ backwpup
|
3854 |
msgid "Logs folder:"
|
3855 |
msgstr "Logdateien Verzeichnis:"
|
3856 |
|
3857 |
-
#: inc/class-page-settings.php:
|
3858 |
#, php-format
|
3859 |
#@ backwpup
|
3860 |
msgid "Logs folder %s not exist and can't created."
|
3861 |
msgstr "Logdateien Verzeichnis %s existiert nicht und kann nicht erstellt werden"
|
3862 |
|
3863 |
-
#: inc/class-page-settings.php:
|
3864 |
#, php-format
|
3865 |
#@ backwpup
|
3866 |
msgid "Logs folder %s not writable."
|
3867 |
msgstr "Logdateien Verzeichnis %s nicht beschreibbar."
|
3868 |
|
3869 |
-
#: inc/class-page-settings.php:
|
3870 |
-
#: inc/class-page-settings.php:
|
3871 |
#@ backwpup
|
3872 |
msgid "Disabled WP Cron"
|
3873 |
msgstr "WP Cron abgeschaltet"
|
3874 |
|
3875 |
-
#: inc/class-job.php:
|
3876 |
#, php-format
|
3877 |
#@ backwpup
|
3878 |
msgid "[INFO] Maximum script execution time is %1$d seconds"
|
@@ -3884,18 +3834,18 @@ msgstr "[INFO] Maximale Script ausführungszeit ist %1$d Sekunden"
|
|
3884 |
msgid "Runtime: %d seconds"
|
3885 |
msgstr "Ausführungszeit: %d Sekunden"
|
3886 |
|
3887 |
-
#: inc/class-job.php:
|
3888 |
#@ backwpup
|
3889 |
msgid "Second process start terminated, because a other job is already running!"
|
3890 |
msgstr "Ein zweiter Prozess start wurde abgebrochen, weil der alte Auftrag noch läuft!"
|
3891 |
|
3892 |
-
#: inc/class-job.php:
|
3893 |
#, php-format
|
3894 |
#@ backwpup
|
3895 |
msgid "Signal %d is sent to script!"
|
3896 |
msgstr "Signal %d wurde zum Script gesendet!"
|
3897 |
|
3898 |
-
#: inc/class-page-backups.php:
|
3899 |
#: inc/class-page-jobs.php:210
|
3900 |
#: inc/class-page-logs.php:181
|
3901 |
#, php-format
|
@@ -3909,7 +3859,7 @@ msgstr "%1$s um %2$s"
|
|
3909 |
msgid "%1$s at %2$s by WP-Cron"
|
3910 |
msgstr "%1$s um %2$s mit WP-Cron"
|
3911 |
|
3912 |
-
#: inc/class-admin.php:
|
3913 |
#@ backwpup
|
3914 |
msgid "About"
|
3915 |
msgstr "Über"
|
@@ -3919,12 +3869,12 @@ msgstr "Über"
|
|
3919 |
msgid "Manual"
|
3920 |
msgstr "Handbuch"
|
3921 |
|
3922 |
-
#: inc/class-job.php:
|
3923 |
#@ backwpup
|
3924 |
msgid "[INFO] BackWPup job started form commandline interface"
|
3925 |
msgstr "[INFO] BackWPup-Auftrag per Kommandozeile gestartet"
|
3926 |
|
3927 |
-
#: inc/class-job.php:
|
3928 |
#@ default
|
3929 |
msgid "Job Started"
|
3930 |
msgstr ""
|
@@ -4003,7 +3953,7 @@ msgstr "BackWPup unterstützt mehrere Cloud-Dienste parallel. Damit wird sicherg
|
|
4003 |
msgid "Backup now!"
|
4004 |
msgstr "Sichern Sie Ihre Daten jetzt!"
|
4005 |
|
4006 |
-
#: inc/class-page-editjob.php:
|
4007 |
#@ backwpup
|
4008 |
msgid "Start job with CLI"
|
4009 |
msgstr "Auftrag per CLI starten"
|
@@ -4013,20 +3963,20 @@ msgstr "Auftrag per CLI starten"
|
|
4013 |
msgid "Nothing to abort!"
|
4014 |
msgstr "Es gibt nichts abzubrechen!"
|
4015 |
|
4016 |
-
#: inc/class-wp-cli.php:
|
4017 |
-
#: inc/class-wp-cli.php:
|
4018 |
#, php-format
|
4019 |
#@ backwpup
|
4020 |
msgid "ID: %1$d Name: %2$s"
|
4021 |
msgstr "ID: %1$d Name: %2$s"
|
4022 |
|
4023 |
-
#: inc/class-wp-cli.php:
|
4024 |
#, php-format
|
4025 |
#@ backwpup
|
4026 |
msgid "Warnings: %1$d Errors: %2$d"
|
4027 |
msgstr "Warnungen: %1$d Fehler: %2$d"
|
4028 |
|
4029 |
-
#: inc/features/class-jobtype-dbdump-pro.php:
|
4030 |
#@ backwpup
|
4031 |
msgid "Path to <em>mysqldump</em> file"
|
4032 |
msgstr "Pfad zum <em>mysqldump</em>"
|
@@ -4041,21 +3991,21 @@ msgstr "Auftrag erstellen"
|
|
4041 |
msgid "Test if BackWPup can work without problems."
|
4042 |
msgstr "Prüfen Sie, ob BackWPup problemlos laufen kann."
|
4043 |
|
4044 |
-
#: inc/features/class-wizard-systemtest.php:
|
4045 |
#, php-format
|
4046 |
#@ backwpup
|
4047 |
msgctxt "%1 = extension name, %2 = file suffix"
|
4048 |
msgid "We recommend to install the %1$s extension to generate %2$s archives."
|
4049 |
msgstr "Wir empfehlen, die Erweiterung %1$s für %2$s-Archive zu installieren."
|
4050 |
|
4051 |
-
#: inc/features/class-wizard-systemtest.php:
|
4052 |
#, php-format
|
4053 |
#@ backwpup
|
4054 |
msgctxt "Link to PHP manual"
|
4055 |
msgid "Please disable the deprecated <a href=\"%s\">PHP safe mode</a>."
|
4056 |
msgstr "Bitte deaktiviere den veralteten <a href=\"%s\">PHP-safe-mode</a>."
|
4057 |
|
4058 |
-
#: inc/features/class-wizard-systemtest.php:
|
4059 |
#@ backwpup
|
4060 |
msgid "We recommend to install the PHP FTP extension to use the FTP backup destination."
|
4061 |
msgstr "Wir empfehlen, die PHP-Erweiterung FTP zu installieren, um das Speicherziel FTP zu verwenden."
|
@@ -4072,40 +4022,34 @@ msgstr "Das temporäre Verzeichnis %s existiert nicht, und es kann auch nicht er
|
|
4072 |
msgid "Logs folder %s does not exist and cannot be created. Please create it and set proper write permissions."
|
4073 |
msgstr "Das Logverzeichnis %s existiert nicht, und es kann auch nicht erstellt werden. Bitte erstellen Sie es, und setzen Sie die passenden Schreibrechte."
|
4074 |
|
4075 |
-
#: inc/features/class-wizard-systemtest.php:
|
4076 |
#, php-format
|
4077 |
#@ backwpup
|
4078 |
msgid "The HTTP response test result is an error: \"%s\"."
|
4079 |
msgstr "Das Ergebnis des HTTP-Tests ist ein Fehler: %s"
|
4080 |
|
4081 |
-
#: inc/features/class-wizard-systemtest.php:
|
4082 |
#, php-format
|
4083 |
#@ backwpup
|
4084 |
msgid "The HTTP response test result is a wrong HTTP status: %s. It should be the staus 200."
|
4085 |
msgstr "Das Ergebnis des HTTP-Tests ist ein falscher HTTP-Status: %s. Es sollte der Status 200 sein."
|
4086 |
|
4087 |
-
#: inc/features/class-wizard-systemtest.php:
|
4088 |
-
#, php-format
|
4089 |
-
#@ backwpup
|
4090 |
-
msgid "The HTTP response result is a wrong response body :%s."
|
4091 |
-
msgstr "Der HTTP-Test erhielt eine falsche Antwort: %s"
|
4092 |
-
|
4093 |
-
#: inc/features/class-wizard-systemtest.php:196
|
4094 |
#@ backwpup
|
4095 |
msgid "WP-Cron seems to be broken. But it is needed to run scheduled jobs."
|
4096 |
msgstr "WP-Cron scheint nicht zu funktionieren. Es wird aber gebraucht, damit geplante Aufträge ausgeführt werden."
|
4097 |
|
4098 |
-
#: inc/features/class-wizard-systemtest.php:
|
4099 |
#@ backwpup
|
4100 |
msgid "All tests passed without errors."
|
4101 |
msgstr "Alle Tests liefen fehlerfrei."
|
4102 |
|
4103 |
-
#: inc/features/class-wizard-systemtest.php:
|
4104 |
#@ backwpup
|
4105 |
msgid "There is no error, but some warnings. BackWPup will work, but with limitations."
|
4106 |
msgstr "Es gibt keine Fehler, aber einige Warnungen. BackWPup wird eingeschränkt funktionieren."
|
4107 |
|
4108 |
-
#: inc/features/class-wizard-systemtest.php:
|
4109 |
#@ backwpup
|
4110 |
msgid "There are errors. Please correct them, or BackWPup cannot work."
|
4111 |
msgstr "Es gab Fehler. Bitte korrigieren Sie diese, damit BackWPup arbeiten kann."
|
@@ -4120,7 +4064,7 @@ msgstr "FTP-Einstellungen"
|
|
4120 |
msgid "New Job"
|
4121 |
msgstr "Bitte geben Sie einen Namen ein"
|
4122 |
|
4123 |
-
#: inc/class-page-editjob.php:
|
4124 |
#@ backwpup
|
4125 |
msgid "Minutes:"
|
4126 |
msgstr "Minuten:"
|
@@ -4171,12 +4115,12 @@ msgstr "S3-Einstellungen"
|
|
4171 |
msgid "All your passwords"
|
4172 |
msgstr "All Ihre Passwörter"
|
4173 |
|
4174 |
-
#: inc/class-page-editjob.php:
|
4175 |
#@ backwpup
|
4176 |
msgid "Synchronize file by file to destination"
|
4177 |
msgstr "Synchronisiere Datei für Datei zum Auftragsziel"
|
4178 |
|
4179 |
-
#: inc/class-page-editjob.php:
|
4180 |
#@ backwpup
|
4181 |
msgid "Archive name"
|
4182 |
msgstr "Archivname"
|
@@ -4191,37 +4135,37 @@ msgstr "noch nicht"
|
|
4191 |
msgid "A job is already running."
|
4192 |
msgstr "Ein Auftrag läuft gerade."
|
4193 |
|
4194 |
-
#: inc/class-wp-cli.php:
|
4195 |
#@ backwpup
|
4196 |
msgid "List of jobs"
|
4197 |
msgstr "Auftragsliste"
|
4198 |
|
4199 |
-
#: inc/class-wp-cli.php:
|
4200 |
#, php-format
|
4201 |
#@ backwpup
|
4202 |
msgid "Steps in percent: %1$d percent of step: %2$d"
|
4203 |
msgstr "Schritte in Prozent: %1$d Prozent des Schritts: %2$d"
|
4204 |
|
4205 |
-
#: inc/class-wp-cli.php:
|
4206 |
#, php-format
|
4207 |
#@ backwpup
|
4208 |
msgid "On step: %s"
|
4209 |
msgstr "Bei Schritt: %s"
|
4210 |
|
4211 |
-
#: inc/class-wp-cli.php:
|
4212 |
#, php-format
|
4213 |
#@ backwpup
|
4214 |
msgid "Last message: %s"
|
4215 |
msgstr "Letzte Nachricht: %s"
|
4216 |
|
4217 |
-
#: inc/class-admin.php:
|
4218 |
#, php-format
|
4219 |
#@ backwpup
|
4220 |
msgctxt "link to Inpsyde.com, link text: Inpsyde GmbH"
|
4221 |
msgid "A project of %s"
|
4222 |
msgstr "Ein Projekt der %s"
|
4223 |
|
4224 |
-
#: inc/class-admin.php:
|
4225 |
#, php-format
|
4226 |
#@ backwpup
|
4227 |
msgctxt "developer name, link text: Daniel Hüsken"
|
@@ -4254,28 +4198,28 @@ msgstr "Mit BackWPup können Sie automatische Datenbank-Backups planen. Mit eine
|
|
4254 |
msgid "You can back up all your attachments, also all system files, plugins and themes in a single file. You can <a href=\"%s\">create a job</a> to update a backup copy of your file system only when files are changed."
|
4255 |
msgstr "Sie können all Ihre Anhänge sichern, ebenso alle Systemdateien, Plugins und Themes – in einer einzigen Datei. Sie können einen <a href=\\\"%s\\\">Auftrag erstellen</a>, um die Sicherungskopie nur dann zu aktualisieren, wenn sich tatsächlich eine Datei geändert hat."
|
4256 |
|
4257 |
-
#: inc/class-page-editjob.php:
|
4258 |
#@ backwpup
|
4259 |
msgid "Copy the link for an external start. This option has to be activated to make the link work."
|
4260 |
msgstr "Kopieren Sie den Link für einen externen Auftragsstart. Diese Option muss erst aktiviert werden, damit der Link funktioniert."
|
4261 |
|
4262 |
-
#: inc/class-page-editjob.php:
|
4263 |
#, php-format
|
4264 |
#@ backwpup
|
4265 |
msgid "Use <a href=\"http://wp-cli.org/\">WP-CLI</a> to run jobs from commandline or <a href=\"%s\">get the start script</a>."
|
4266 |
msgstr "Verwenden Sie <a href=\"http://wp-cli.org/\">WP-CLI</a>, um Aufträge per Kommandozeile auszulösen, oder <a href=\"%s\">dieses Start-Script</a>."
|
4267 |
|
4268 |
-
#: inc/class-page-editjob.php:
|
4269 |
#@ backwpup
|
4270 |
msgid "Replacement patterns:"
|
4271 |
msgstr "Ersetzungsmuster:"
|
4272 |
|
4273 |
-
#: inc/class-page-settings.php:
|
4274 |
#@ backwpup
|
4275 |
msgid "WP memory limit"
|
4276 |
msgstr "WordPress-Memory-Limit"
|
4277 |
|
4278 |
-
#: inc/class-page-settings.php:
|
4279 |
#@ backwpup
|
4280 |
msgid "WP Maximum memory limit"
|
4281 |
msgstr "Maximales WordPress-Memory-Limit"
|
@@ -4286,19 +4230,19 @@ msgstr "Maximales WordPress-Memory-Limit"
|
|
4286 |
msgid "https://marketpress.com/product/backwpup-pro/"
|
4287 |
msgstr "https://marketpress.de/product/backwpup-pro/"
|
4288 |
|
4289 |
-
#: inc/class-admin.php:
|
4290 |
#: inc/class-help.php:29
|
4291 |
#@ backwpup
|
4292 |
msgid "https://marketpress.com/documentation/backwpup-pro/"
|
4293 |
msgstr "https://marketpress.de/dokumentation/backwpup-pro/"
|
4294 |
|
4295 |
-
#: inc/class-admin.php:
|
4296 |
#: inc/class-help.php:26
|
4297 |
#@ backwpup
|
4298 |
msgid "https://marketpress.com/support/forum/plugins/backwpup-pro/"
|
4299 |
msgstr "https://marketpress.de/support/forum/plugins/backwpup-pro/"
|
4300 |
|
4301 |
-
#: inc/class-admin.php:
|
4302 |
#: inc/class-help.php:26
|
4303 |
#@ backwpup
|
4304 |
msgid "Pro Support"
|
@@ -4319,7 +4263,7 @@ msgstr "Erstellen Sie erst einen Auftrag, und planen Sie, was Sie sichern möcht
|
|
4319 |
msgid "First set up a job, and plan what you want to save. Please note: the plugin author gives no warranty for your data."
|
4320 |
msgstr "Erstellen Sie erst einen Auftrag, und planen Sie, was Sie sichern möchten. Bitte beachten Sie: Die Pluginautoren übernehmen keine Gewähr für Ihre Daten."
|
4321 |
|
4322 |
-
#: inc/class-page-editjob.php:
|
4323 |
#@ backwpup
|
4324 |
msgid "Working as <a href=\"http://wikipedia.org/wiki/Cron\">Cron</a> schedule:"
|
4325 |
msgstr "Als <a href=\\\"http://de.wikipedia.org/wiki/Cron\\\">Cron-Job</a> ausführen:"
|
@@ -4334,14 +4278,14 @@ msgstr "Informationen"
|
|
4334 |
msgid "Compress log files with GZip."
|
4335 |
msgstr "Komprimiere Logdateien mit Gzip."
|
4336 |
|
4337 |
-
#: inc/features/class-page-wizard.php:
|
4338 |
#, php-format
|
4339 |
#@ backwpup
|
4340 |
msgctxt "Plugin Name"
|
4341 |
msgid "%s Wizards"
|
4342 |
msgstr "%s-Assistenten"
|
4343 |
|
4344 |
-
#: inc/features/class-page-wizard.php:
|
4345 |
#, php-format
|
4346 |
#@ backwpup
|
4347 |
msgctxt "Plugin Name"
|
@@ -4358,12 +4302,12 @@ msgstr "Benutzen Sie die Links in der Box <b>Erste Schritte</b>, um ein Backup z
|
|
4358 |
msgid "Settings reset to default"
|
4359 |
msgstr "Die Einstellungen wurden zurückgesetzt."
|
4360 |
|
4361 |
-
#: inc/class-page-settings.php:
|
4362 |
#@ backwpup
|
4363 |
msgid "Reset all settings to default"
|
4364 |
msgstr "Alle Einstellungen zurücksetzen"
|
4365 |
|
4366 |
-
#: inc/features/class-page-wizard.php:
|
4367 |
#@ backwpup
|
4368 |
msgid "Back to overview"
|
4369 |
msgstr "Zurück zur Übersicht"
|
@@ -4378,7 +4322,7 @@ msgstr "Spezialoption"
|
|
4378 |
msgid "Include special files"
|
4379 |
msgstr "Spezielle Dateien einschließen"
|
4380 |
|
4381 |
-
#: inc/features/class-jobtype-dbdump-pro.php:
|
4382 |
#, php-format
|
4383 |
#@ backwpup
|
4384 |
msgid "Dump database structure \"%s\""
|
@@ -4409,42 +4353,42 @@ msgstr "Die Funktionen für die Bz2-Kompression sind nicht verfügbar."
|
|
4409 |
msgid "Cannot open archive file"
|
4410 |
msgstr "Kann Archivdatei nicht öffnen"
|
4411 |
|
4412 |
-
#: inc/class-create-archive.php:
|
4413 |
-
#: inc/class-create-archive.php:
|
4414 |
-
#: inc/class-create-archive.php:
|
4415 |
#, php-format
|
4416 |
#@ backwpup
|
4417 |
msgid "Cannot open source file %s to archive"
|
4418 |
msgstr "Konnte Quelle %s zum Archivieren nicht öffnen"
|
4419 |
|
4420 |
#: inc/class-create-archive.php:165
|
4421 |
-
#: inc/class-create-archive.php:
|
4422 |
#, php-format
|
4423 |
#@ backwpup
|
4424 |
msgid "PclZip archive add error: %s"
|
4425 |
msgstr "Fehler beim Hinzufügen zum PclZip-Archive: %s"
|
4426 |
|
4427 |
-
#: inc/class-create-archive.php:
|
4428 |
#, php-format
|
4429 |
#@ backwpup
|
4430 |
msgctxt "Text of ZipArchive status Message"
|
4431 |
msgid "ZipArchive returns status: %s"
|
4432 |
msgstr "Das Zip-Archive liefert den Status: %s"
|
4433 |
|
4434 |
-
#: inc/class-job.php:
|
4435 |
#, php-format
|
4436 |
#@ backwpup
|
4437 |
msgid "%d. Trying to create backup archive …"
|
4438 |
msgstr "%d. Versuche, Backup zu erstellen …"
|
4439 |
|
4440 |
-
#: inc/class-job.php:
|
4441 |
#, php-format
|
4442 |
#@ backwpup
|
4443 |
msgctxt "Archive compression method"
|
4444 |
msgid "Compression method is %s"
|
4445 |
msgstr "Komprimierungsmethode ist %s"
|
4446 |
|
4447 |
-
#: inc/class-job.php:
|
4448 |
#@ backwpup
|
4449 |
msgid "Backup archive created."
|
4450 |
msgstr "Backup wurde erstellt."
|
@@ -4460,24 +4404,24 @@ msgstr "Konnte Backup nicht öffnen"
|
|
4460 |
msgid "Could not find content for this page. Please try again later."
|
4461 |
msgstr "Konnte den Inhalt der Seite nicht finden. Bitte versuchen Sie es später."
|
4462 |
|
4463 |
-
#: inc/features/class-jobtype-dbdump-pro.php:
|
4464 |
#@ backwpup
|
4465 |
msgid "SQL File"
|
4466 |
msgstr "SQL-Datei"
|
4467 |
|
4468 |
-
#: inc/features/class-jobtype-dbdump-pro.php:
|
4469 |
#@ backwpup
|
4470 |
msgid "XML File (phpMyAdmin schema)"
|
4471 |
msgstr "XML-Datei (phpMyAdmin-Schema9"
|
4472 |
|
4473 |
-
#: inc/features/class-jobtype-dbdump-pro.php:
|
4474 |
#, php-format
|
4475 |
#@ backwpup
|
4476 |
msgctxt "Executed shell_exec() command"
|
4477 |
msgid "CLI Exec: %s"
|
4478 |
msgstr "CLI-Exec: %s"
|
4479 |
|
4480 |
-
#: inc/features/class-jobtype-dbdump-pro.php:
|
4481 |
#, php-format
|
4482 |
#@ backwpup
|
4483 |
msgctxt "Output of a shell_exec()"
|
@@ -4498,15 +4442,15 @@ msgctxt "%s = file name"
|
|
4498 |
msgid "Method to archive file %s not detected"
|
4499 |
msgstr "Methode zum Archivieren der Datei %s nicht gefunden"
|
4500 |
|
4501 |
-
#: inc/class-create-archive.php:
|
4502 |
#@ backwpup
|
4503 |
msgid "File name cannot be empty"
|
4504 |
msgstr "Der Dateiname kann nicht leer sein."
|
4505 |
|
4506 |
-
#: inc/class-create-archive.php:
|
4507 |
-
#: inc/class-create-archive.php:
|
4508 |
-
#: inc/class-create-archive.php:
|
4509 |
-
#: inc/class-create-archive.php:
|
4510 |
#@ backwpup
|
4511 |
msgid "This archive method can only add one file"
|
4512 |
msgstr "Diese Archive-Methode kann nur eine einziges Datei sichern."
|
@@ -4518,7 +4462,7 @@ msgctxt "Database Charset"
|
|
4518 |
msgid "Cannot set DB charset to %s"
|
4519 |
msgstr "Kann Datenbank-Zeichenkodierung nicht auf %s setzen."
|
4520 |
|
4521 |
-
#: inc/class-page-backwpup.php:
|
4522 |
#@ backwpup
|
4523 |
msgid "One click backup"
|
4524 |
msgstr "Ein-Klick-Backup"
|
@@ -4531,14 +4475,14 @@ msgctxt "%s = Remote Code"
|
|
4531 |
msgid "Could not connect to remote host, code %d. Please try again later."
|
4532 |
msgstr "Konnte nicht zum Remote-Host verbinden, code: %s. Bitte versuchen Sie es später."
|
4533 |
|
4534 |
-
#: inc/class-create-archive.php:
|
4535 |
#, php-format
|
4536 |
#@ backwpup
|
4537 |
msgctxt "File path to add to archive"
|
4538 |
msgid "File %s does not exist or is not readable"
|
4539 |
msgstr "Die Datei %s existiert nicht, oder sie ist nicht lesbar."
|
4540 |
|
4541 |
-
#: inc/class-page-backwpup.php:
|
4542 |
#@ backwpup
|
4543 |
msgid "Download database backup"
|
4544 |
msgstr "Datenbank-Backup herunterladen"
|
@@ -4557,7 +4501,7 @@ msgctxt "%s = plugin name"
|
|
4557 |
msgid "Your license for the plugin %s is not valid. The auto-update has been deactivated."
|
4558 |
msgstr "Der Lizenzschlüssel für das Plugin %s ist ungültig. Die automatische Aktualisierung wurde abgeschaltet."
|
4559 |
|
4560 |
-
#: inc/class-job.php:
|
4561 |
#, php-format
|
4562 |
#@ backwpup
|
4563 |
msgctxt "Plugin name; Plugin Version; WordPress Version"
|
@@ -4574,13 +4518,13 @@ msgstr "Bitte aktivieren Sie Ihre Lizenz."
|
|
4574 |
msgid "Please go to your plugin page and active the license to have the autoupdates enabled."
|
4575 |
msgstr "Bitte gehen Sie auf die Plugin-Seite, und aktivieren Sie die Lizenz, um automatische Aktualisierungen zu aktivieren."
|
4576 |
|
4577 |
-
#: inc/class-admin.php:
|
4578 |
#: inc/class-help.php:28
|
4579 |
#@ backwpup
|
4580 |
msgid "http://wordpress.org/support/plugin/backwpup/"
|
4581 |
msgstr "http://wordpress.org/support/plugin/backwpup/"
|
4582 |
|
4583 |
-
#: inc/class-admin.php:
|
4584 |
#: inc/class-help.php:28
|
4585 |
#@ backwpup
|
4586 |
msgid "Support"
|
@@ -4591,14 +4535,14 @@ msgstr "Support"
|
|
4591 |
msgid "Plugin on wordpress.org"
|
4592 |
msgstr "Plugin auf wordpress.org"
|
4593 |
|
4594 |
-
#: inc/class-job.php:
|
4595 |
#, php-format
|
4596 |
#@ backwpup
|
4597 |
msgctxt "Folder name"
|
4598 |
msgid "Folder %s not exists"
|
4599 |
msgstr "Verzeichnis %s existiert nicht"
|
4600 |
|
4601 |
-
#: inc/class-job.php:
|
4602 |
#, php-format
|
4603 |
#@ backwpup
|
4604 |
msgctxt "Folder name"
|
@@ -4805,7 +4749,7 @@ msgstr "Benutze Multipart Upload zu hochladen der Datei"
|
|
4805 |
#: inc/class-destination-s3-v1.php:395
|
4806 |
#: inc/class-destination-s3.php:392
|
4807 |
#: inc/features/class-destination-s3-pro.php:164
|
4808 |
-
#: inc/features/class-destination-s3-v1-pro.php:
|
4809 |
#, php-format
|
4810 |
#@ backwpup
|
4811 |
msgid "Connected to S3 Bucket \"%1$s\" in %2$s"
|
@@ -4816,25 +4760,25 @@ msgstr "Verbunden zum S3 Bucket \"%1$s\" in %2$s"
|
|
4816 |
msgid "Sender name"
|
4817 |
msgstr "Absender NAme"
|
4818 |
|
4819 |
-
#: inc/class-create-archive.php:
|
4820 |
#@ backwpup
|
4821 |
msgid "Folder name cannot be empty"
|
4822 |
msgstr "Der Verzeichnis Name darf nicht leer sein"
|
4823 |
|
4824 |
-
#: inc/class-create-archive.php:
|
4825 |
#, php-format
|
4826 |
#@ backwpup
|
4827 |
msgctxt "Folder path to add to archive"
|
4828 |
msgid "Folder %s does not exist or is not readable"
|
4829 |
msgstr "Verzeichnis %s existiert nicht oder ist nicht lesbar"
|
4830 |
|
4831 |
-
#: inc/class-create-archive.php:
|
4832 |
#, php-format
|
4833 |
#@ backwpup
|
4834 |
msgid "Folder name \"%1$s\" too long to be saved correctly in %2$s archive!"
|
4835 |
msgstr "Verzeichnis Name \"%1$s\" ist zu lang um ihn koreckt zu speichern im %2$s Archiv"
|
4836 |
|
4837 |
-
#: inc/class-create-archive.php:
|
4838 |
#, php-format
|
4839 |
#@ backwpup
|
4840 |
msgid "Folder path \"%1$s\" too long to be saved correctly in %2$s archive!"
|
@@ -4863,7 +4807,7 @@ msgstr "Backups Verzeichnis nicht lesbar oder nicht beschreibbar. Bitte die rich
|
|
4863 |
msgid "Backups folder %s does not exist and cannot be created. Please create it and set proper write permissions."
|
4864 |
msgstr "Backups Verzeichnis %s existiert nicht und kann nicht angelegt werden. Bitte überprüfen Sie die Berechtigungen."
|
4865 |
|
4866 |
-
#: inc/class-page-jobs.php:
|
4867 |
#@ backwpup
|
4868 |
msgid "Working job log"
|
4869 |
msgstr "Auftrags lLog"
|
@@ -4873,19 +4817,19 @@ msgstr "Auftrags lLog"
|
|
4873 |
msgid "The file name of an archive cannot be empty."
|
4874 |
msgstr "Der Dateiname eines Archivs kann nicht leer sein."
|
4875 |
|
4876 |
-
#: inc/class-admin.php:
|
4877 |
-
#: inc/class-admin.php:
|
4878 |
#@ backwpup
|
4879 |
msgid "Cheating, huh?"
|
4880 |
msgstr "Mogeln, wie?"
|
4881 |
|
4882 |
-
#: inc/class-admin.php:
|
4883 |
#, php-format
|
4884 |
#@ backwpup
|
4885 |
msgid "You have activated or updated BackWPup. Please check <a href=\"%s\">this page</a>."
|
4886 |
msgstr "Du hast BackWPup aktiviert oder aktualisiert. Bitte gehe zu <a href=\"%s\">dieser Seite</a>."
|
4887 |
|
4888 |
-
#: inc/class-adminbar.php:
|
4889 |
#@ backwpupadminbar
|
4890 |
msgid "Now Running"
|
4891 |
msgstr ""
|
@@ -4902,53 +4846,53 @@ msgstr "Ordner %s für Archiv nicht gefunden"
|
|
4902 |
msgid "Aborted, because no progress for 2 hours!"
|
4903 |
msgstr "Abgebrochen, da seit 2 Stunden kein Fortschritt!"
|
4904 |
|
4905 |
-
#: inc/features/class-destination-dropbox-pro.php:
|
4906 |
#@ backwpup
|
4907 |
msgid "Dropbox authentication not approved!"
|
4908 |
msgstr "Dropbox-Authentifizierung nicht angenommen!"
|
4909 |
|
4910 |
-
#: inc/class-destination-dropbox.php:
|
4911 |
#, php-format
|
4912 |
#@ backwpup
|
4913 |
msgid "%d. Try to send backup file to Dropbox …"
|
4914 |
msgstr "%d. Versuche, das Backup zur Dropbox zu senden …"
|
4915 |
|
4916 |
-
#: inc/class-destination-dropbox.php:
|
4917 |
-
#: inc/features/class-destination-dropbox-pro.php:
|
4918 |
#, php-format
|
4919 |
#@ backwpup
|
4920 |
msgid "Authenticated with Dropbox of user %s"
|
4921 |
msgstr "Authentifiziert mit Dropbox von Benutzer %s"
|
4922 |
|
4923 |
-
#: inc/class-destination-dropbox.php:
|
4924 |
#@ backwpup
|
4925 |
msgid "Your Dropbox appears to be full."
|
4926 |
msgstr "Deine Dropbox scheint voll zu sein."
|
4927 |
|
4928 |
-
#: inc/class-destination-dropbox.php:
|
4929 |
-
#: inc/features/class-destination-dropbox-pro.php:
|
4930 |
#, php-format
|
4931 |
#@ backwpup
|
4932 |
msgid "%s available on your Dropbox"
|
4933 |
msgstr "%s verfügbar in deiner Dropbox"
|
4934 |
|
4935 |
-
#: inc/class-destination-dropbox.php:
|
4936 |
#@ backwpup
|
4937 |
msgid "Uploading to Dropbox …"
|
4938 |
msgstr "Hochladen zur Dropbox hat begonnen …"
|
4939 |
|
4940 |
-
#: inc/class-destination-dropbox.php:
|
4941 |
#@ backwpup
|
4942 |
msgid "Uploaded file size and local file size don't match."
|
4943 |
msgstr "Größe der lokalen und der hochgeladenen Datei ist nicht identisch."
|
4944 |
|
4945 |
-
#: inc/class-destination-dropbox.php:
|
4946 |
#, php-format
|
4947 |
#@ backwpup
|
4948 |
msgid "Error while deleting file from Dropbox: %s"
|
4949 |
msgstr "Fehler beim Löschen der Datei aus der Dropbox: %s"
|
4950 |
|
4951 |
-
#: inc/class-destination-dropbox.php:
|
4952 |
#, php-format
|
4953 |
#@ backwpup
|
4954 |
msgid "One file deleted from Dropbox"
|
@@ -5030,36 +4974,36 @@ msgstr "Verwende Blogeinstellungen"
|
|
5030 |
msgid "- Use site settings: retrieves the e-mail settings of your site. -PHP mail(): needs more PHP memory"
|
5031 |
msgstr "- Verwende Website-Einstelllung: verwendet die Einstellungen der Website. - PHP mail(): verbraucht viel PHP Memory\\\""
|
5032 |
|
5033 |
-
#: inc/class-destination-email.php:
|
5034 |
#, php-format
|
5035 |
#@ backwpup
|
5036 |
msgid "%d. Trying to send backup with e-mail…"
|
5037 |
msgstr "%d. Versuche, Backup als E-Mail zu senden…"
|
5038 |
|
5039 |
-
#: inc/class-destination-email.php:
|
5040 |
#@ backwpup
|
5041 |
msgid "Backup archive too big to be sent by e-mail!"
|
5042 |
msgstr "Das Datensicherungsarchiv ist zu groß zum Senden via E-Mail!"
|
5043 |
|
5044 |
-
#: inc/class-destination-email.php:
|
5045 |
#, php-format
|
5046 |
#@ backwpup
|
5047 |
msgid "Sending e-mail to %s…"
|
5048 |
msgstr "Sende E-Mail an %s…"
|
5049 |
|
5050 |
-
#: inc/class-destination-email.php:
|
5051 |
-
#: inc/class-destination-email.php:
|
5052 |
#@ backwpup
|
5053 |
msgid "Error while sending e-mail!"
|
5054 |
msgstr "Fehler beim Senden der E-Mail"
|
5055 |
|
5056 |
-
#: inc/class-destination-email.php:
|
5057 |
-
#: inc/class-destination-email.php:
|
5058 |
#@ backwpup
|
5059 |
msgid "E-Mail sent."
|
5060 |
msgstr "E-Mail gesendet."
|
5061 |
|
5062 |
-
#: inc/class-destination-email.php:
|
5063 |
#@ backwpup
|
5064 |
msgid "If this message reaches your inbox, sending backup archives via e-mail should work for you."
|
5065 |
msgstr "Wenn dich diese Nachricht erreicht, funktioniert das Senden der Sicherungsarchive per E-Mail."
|
@@ -5162,33 +5106,33 @@ msgid_plural "%d files deleted on FTP server"
|
|
5162 |
msgstr[0] "Eine Datei vom FTP-Server gelöscht"
|
5163 |
msgstr[1] "%d Dateien vom FTP-Server gelöscht"
|
5164 |
|
5165 |
-
#: inc/class-destination-msazure.php:
|
5166 |
#, php-format
|
5167 |
#@ backwpup
|
5168 |
msgid "%d. Try sending backup to a Microsoft Azure (Blob) …"
|
5169 |
msgstr "%d. Versuche, das Backup zu Microsoft Azure (Blob) zu senden …"
|
5170 |
|
5171 |
-
#: inc/class-destination-msazure.php:
|
5172 |
#@ backwpup
|
5173 |
msgid "Starting upload to MS Azure …"
|
5174 |
msgstr "Hochladen zu MS Azure hat begonnen …"
|
5175 |
|
5176 |
-
#: inc/class-destination-msazure.php:
|
5177 |
#@ backwpup
|
5178 |
msgid "Missing account name!"
|
5179 |
msgstr "Kontoname (Benutzername) nicht angegeben!"
|
5180 |
|
5181 |
-
#: inc/class-destination-msazure.php:
|
5182 |
#@ backwpup
|
5183 |
msgid "No container found!"
|
5184 |
msgstr "Kein Container gefunden!"
|
5185 |
|
5186 |
-
#: inc/class-destination-rsc.php:
|
5187 |
#@ backwpup
|
5188 |
msgid "Missing username!"
|
5189 |
msgstr "Fehlender Benutzername!"
|
5190 |
|
5191 |
-
#: inc/class-destination-rsc.php:
|
5192 |
#@ backwpup
|
5193 |
msgid "A container could not be found!"
|
5194 |
msgstr "Kein Container gefunden!"
|
@@ -5261,23 +5205,18 @@ msgctxt "Plugin name and link; Plugin Version"
|
|
5261 |
msgid "%1$s version %2$s. A project by <a href=\"http://inpsyde.com\">Inpsyde GmbH</a>. Developed by <a href=\"http://danielhuesken.de\">Daniel Hüsken</a>."
|
5262 |
msgstr "%1$s version %2$s. Ein Projekt der <a href=\"http://inpsyde.com\">Inpsyde GmbH</a>. Entwickler: <a href=\"http://danielhuesken.de\">Daniel Hüsken</a>."
|
5263 |
|
5264 |
-
#: inc/class-job.php:
|
5265 |
#@ backwpup
|
5266 |
msgid "Script stopped! Will start again."
|
5267 |
msgstr "Script angehalten! Wird neu gestartet."
|
5268 |
|
5269 |
-
#: inc/class-jobtype-dbcheck.php:
|
5270 |
-
#@ backwpup
|
5271 |
-
msgid "Activate maintenance mode during table check"
|
5272 |
-
msgstr "Aktivierte den Wartungsmodus bei der Tabellenprüfung"
|
5273 |
-
|
5274 |
-
#: inc/class-jobtype-dbcheck.php:89
|
5275 |
#, php-format
|
5276 |
#@ backwpup
|
5277 |
msgid "%d. Trying to check database …"
|
5278 |
msgstr "%d. Versuche, die Datenbank zu prüfen …"
|
5279 |
|
5280 |
-
#: inc/class-jobtype-dbcheck.php:
|
5281 |
#, php-format
|
5282 |
#@ backwpup
|
5283 |
msgid "Table %1$s is a view. Not checked."
|
@@ -5288,31 +5227,31 @@ msgstr "Tabelle %1$s ist ein View. Nicht geprüft."
|
|
5288 |
msgid "Creates an .sql database dump file"
|
5289 |
msgstr "Erstellt ein Datenbank-Backup (.sql, .xml)"
|
5290 |
|
5291 |
-
#: inc/class-jobtype-dbdump.php:
|
5292 |
-
#: inc/features/class-jobtype-dbdump-pro.php:
|
5293 |
#, php-format
|
5294 |
#@ backwpup
|
5295 |
msgid "%d. Try to dump database …"
|
5296 |
msgstr "%d. Versuche, Datenbank-Backup zu erstellen …"
|
5297 |
|
5298 |
-
#: inc/class-jobtype-dboptimize.php:
|
5299 |
#@ backwpup
|
5300 |
msgid "Optimize will be done with OPTIMIZE TABLE `table`."
|
5301 |
msgstr "Optimierung wird erstellt mit OPTIMIZE TABLE `table`."
|
5302 |
|
5303 |
-
#: inc/class-jobtype-dboptimize.php:
|
5304 |
#, php-format
|
5305 |
#@ backwpup
|
5306 |
msgid "%d. Trying to optimize database …"
|
5307 |
msgstr "%d. Versuche die Datenbank zu optimieren …"
|
5308 |
|
5309 |
-
#: inc/class-jobtype-dboptimize.php:
|
5310 |
#, php-format
|
5311 |
#@ backwpup
|
5312 |
msgid "Views cannot optimize! View %1$s"
|
5313 |
msgstr "Views kann nicht optimieren! View %1$s"
|
5314 |
|
5315 |
-
#: inc/class-jobtype-dboptimize.php:
|
5316 |
#@ backwpup
|
5317 |
msgid "Database optimization done!"
|
5318 |
msgstr "Datenbank-Backup fertig!"
|
@@ -5366,13 +5305,13 @@ msgid "All plugin information:"
|
|
5366 |
msgstr "Alle Plugin-Informationen"
|
5367 |
|
5368 |
#: inc/class-mysqldump.php:90
|
5369 |
-
#: inc/features/class-jobtype-dbdump-pro.php:
|
5370 |
#, php-format
|
5371 |
#@ backwpup
|
5372 |
msgid "Cannot connect to MySQL database %1$d: %2$s"
|
5373 |
msgstr "Kann keine Verbindung zur Datenbank %1$d herstellen: %2$s"
|
5374 |
|
5375 |
-
#: inc/class-mysqldump.php:
|
5376 |
#@ backwpup
|
5377 |
msgid "Error while writing file!"
|
5378 |
msgstr "Fehler beim Schreiben!"
|
@@ -5403,12 +5342,12 @@ msgstr "Die SugarSync-Authentifizierung muss wiederholt werden"
|
|
5403 |
msgid "Google Storage is now a part of S3 service settings"
|
5404 |
msgstr "Google Storage ist jetzt Teil der S3-Einstellungen"
|
5405 |
|
5406 |
-
#: inc/class-page-backups.php:
|
5407 |
#@ backwpup
|
5408 |
msgid "No files could be found. (List will be generated during next backup.)"
|
5409 |
msgstr "Keine Dateien gefunden. (Liste wird beim nächsten Backup generiert.)"
|
5410 |
|
5411 |
-
#: inc/class-page-backups.php:
|
5412 |
#@ backwpup
|
5413 |
msgid ""
|
5414 |
"You are about to delete this backup archive. \n"
|
@@ -5417,242 +5356,236 @@ msgstr ""
|
|
5417 |
"Sie sind dabei dieses Datensicherungsarchiv zu löschen. \n"
|
5418 |
" 'Abbrechen' um zu stoppen, 'OK' um zu löschen."
|
5419 |
|
5420 |
-
#: inc/class-page-backups.php:
|
5421 |
-
#: inc/class-page-backups.php:
|
5422 |
#: inc/class-page-editjob.php:41
|
5423 |
#: inc/class-page-jobs.php:312
|
5424 |
#@ backwpup
|
5425 |
msgid "Sorry, you don't have permissions to do that."
|
5426 |
msgstr "Sie haben nicht die notwendigen Berechtigungen für diese Aktion."
|
5427 |
|
5428 |
-
#: inc/class-page-backwpup.php:
|
5429 |
#@ backwpup
|
5430 |
msgid "First Steps"
|
5431 |
msgstr "Erste Schritte"
|
5432 |
|
5433 |
-
#: inc/class-page-backwpup.php:
|
5434 |
#@ backwpup
|
5435 |
msgid "Generate a database backup of WordPress tables and download it right away!"
|
5436 |
msgstr "Generieren Sie ein Datenbank-Backup der WordPress-Tabellen und laden Sie es gleich herunter!"
|
5437 |
|
5438 |
-
#: inc/class-page-backwpup.php:
|
5439 |
#@ backwpup
|
5440 |
msgid "OK"
|
5441 |
msgstr "OK"
|
5442 |
|
5443 |
-
#: inc/class-page-editjob.php:
|
5444 |
#@ backwpup
|
5445 |
msgid "Please name this job."
|
5446 |
msgstr "Bitte benennen Sie diesen Auftrag."
|
5447 |
|
5448 |
-
#: inc/class-page-editjob.php:
|
5449 |
#@ backwpup
|
5450 |
msgid "Job Tasks"
|
5451 |
msgstr "Auftragsdetails"
|
5452 |
|
5453 |
-
#: inc/class-page-editjob.php:
|
5454 |
#: inc/features/class-wizard-job.php:225
|
5455 |
#@ backwpup
|
5456 |
msgid "This job is a …"
|
5457 |
msgstr "Dieser Auftrag ist ein …"
|
5458 |
|
5459 |
-
#: inc/class-page-editjob.php:
|
5460 |
#@ backwpup
|
5461 |
msgid "Backup File Creation"
|
5462 |
msgstr "Erstellen der Backup-Datei"
|
5463 |
|
5464 |
-
#: inc/class-page-editjob.php:
|
5465 |
#, php-format
|
5466 |
#@ backwpup
|
5467 |
msgid "%d = Two digit day of the month, with leading zeros"
|
5468 |
msgstr "%d = Zweistelliger Tag des Monats, mit führenden Nullen"
|
5469 |
|
5470 |
-
#: inc/class-page-editjob.php:
|
5471 |
#, php-format
|
5472 |
#@ backwpup
|
5473 |
msgid "%j = Day of the month, without leading zeros"
|
5474 |
msgstr "%j = Tag des Monats, ohne führende Nullen"
|
5475 |
|
5476 |
-
#: inc/class-page-editjob.php:
|
5477 |
#, php-format
|
5478 |
#@ backwpup
|
5479 |
msgid "%m = Day of the month, with leading zeros"
|
5480 |
msgstr "%m = Tag des Monats, mit führenden Nullen"
|
5481 |
|
5482 |
-
#: inc/class-page-editjob.php:
|
5483 |
#, php-format
|
5484 |
#@ backwpup
|
5485 |
msgid "%n = Representation of the month (without leading zeros)"
|
5486 |
msgstr "%n = Monat als Zahl (ohne führende Nullen)"
|
5487 |
|
5488 |
-
#: inc/class-page-editjob.php:
|
5489 |
#, php-format
|
5490 |
#@ backwpup
|
5491 |
msgid "%Y = Four digit representation for the year"
|
5492 |
msgstr "%Y = Vierstellige Jahreszahl"
|
5493 |
|
5494 |
-
#: inc/class-page-editjob.php:
|
5495 |
#, php-format
|
5496 |
#@ backwpup
|
5497 |
msgid "%y = Two digit representation of the year"
|
5498 |
msgstr "%y = Zweistellige Jahreszahl"
|
5499 |
|
5500 |
-
#: inc/class-page-editjob.php:
|
5501 |
#, php-format
|
5502 |
#@ backwpup
|
5503 |
msgid "%a = Lowercase ante meridiem (am) and post meridiem (pm)"
|
5504 |
msgstr "%a = Kleingeschriebenes ante meridiem (am) und post meridiem (pm)"
|
5505 |
|
5506 |
-
#: inc/class-page-editjob.php:
|
5507 |
#, php-format
|
5508 |
#@ backwpup
|
5509 |
msgid "%A = Uppercase ante meridiem (AM) and post meridiem (PM)"
|
5510 |
msgstr "%A = Großgeschriebenes ante meridiem (AM) and post meridiem (PM)"
|
5511 |
|
5512 |
-
#: inc/class-page-editjob.php:
|
5513 |
#, php-format
|
5514 |
#@ backwpup
|
5515 |
msgid "%B = Swatch Internet Time"
|
5516 |
msgstr "%B = Swatch Internet Time"
|
5517 |
|
5518 |
-
#: inc/class-page-editjob.php:
|
5519 |
#, php-format
|
5520 |
#@ backwpup
|
5521 |
msgid "%g = Hour in 12-hour format, without leading zeros"
|
5522 |
msgstr "%g = Stunde im Zwölfstunden-Format, ohne führende Nullen"
|
5523 |
|
5524 |
-
#: inc/class-page-editjob.php:
|
5525 |
#, php-format
|
5526 |
#@ backwpup
|
5527 |
msgid "%G = Hour in 24-hour format, without leading zeros"
|
5528 |
msgstr "%G = Stunde im 24-Stunden-Format, ohne führende Nullen"
|
5529 |
|
5530 |
-
#: inc/class-page-editjob.php:
|
5531 |
#, php-format
|
5532 |
#@ backwpup
|
5533 |
msgid "%h = Hour in 12-hour format, with leading zeros"
|
5534 |
msgstr "%h = Stunde im Zwölfstunden-Format, mit führenden Nullen"
|
5535 |
|
5536 |
-
#: inc/class-page-editjob.php:
|
5537 |
#, php-format
|
5538 |
#@ backwpup
|
5539 |
msgid "%H = Hour in 24-hour format, with leading zeros"
|
5540 |
msgstr "%H = Stunde im 24-Stunden-Format, mit führenden Nullen"
|
5541 |
|
5542 |
-
#: inc/class-page-editjob.php:
|
5543 |
#, php-format
|
5544 |
#@ backwpup
|
5545 |
msgid "%i = Two digit representation of the minute"
|
5546 |
msgstr "%i = Zweistellige Minute"
|
5547 |
|
5548 |
-
#: inc/class-page-editjob.php:
|
5549 |
#, php-format
|
5550 |
#@ backwpup
|
5551 |
msgid "%s = Two digit representation of the second"
|
5552 |
msgstr "%s = Zweistellige Sekunde"
|
5553 |
|
5554 |
-
#: inc/class-page-editjob.php:
|
5555 |
#, php-format
|
5556 |
#@ backwpup
|
5557 |
msgid "%u = Two digit representation of the microsecond"
|
5558 |
msgstr "%u = Zweistellige Mikrosekunde"
|
5559 |
|
5560 |
-
#: inc/class-page-editjob.php:
|
5561 |
#, php-format
|
5562 |
#@ backwpup
|
5563 |
msgid "%U = UNIX timestamp (seconds since January 1 1970 00:00:00 GMT)"
|
5564 |
msgstr "%U = UNIX-Zeitstempel (Sekunden seit dem 1. Januar 1970, 00:00:00 GMT)"
|
5565 |
|
5566 |
-
#: inc/class-page-editjob.php:
|
5567 |
#@ backwpup
|
5568 |
msgid "PHP Zip functions will be used if available (needs less memory). Otherwise the PCLZip class will be used."
|
5569 |
msgstr "PHP-Zip-Funktionen werden verwendet, sofern verfügbar (schneller). Ansonsten wird die Klasse PCLZip verwendet."
|
5570 |
|
5571 |
-
#: inc/class-page-editjob.php:
|
5572 |
-
#: inc/class-page-editjob.php:
|
5573 |
-
#: inc/class-page-editjob.php:
|
5574 |
#@ backwpup
|
5575 |
msgid "Disabled due to missing PHP function."
|
5576 |
msgstr "Deaktiviert wegen nicht verfügbarer PHP-Funktion."
|
5577 |
|
5578 |
-
#: inc/class-page-editjob.php:
|
5579 |
#@ backwpup
|
5580 |
msgid "A tarballed, not compressed archive (fast and less memory)"
|
5581 |
msgstr "Ein TAR-Archiv, nicht komprimiert (schnell und speicherschonend)"
|
5582 |
|
5583 |
-
#: inc/class-page-editjob.php:
|
5584 |
#@ backwpup
|
5585 |
msgid "A tarballed, GZipped archive (fast and less memory)"
|
5586 |
msgstr "Ein TAR-GZ-Archiv (schnell und speicherschonend)"
|
5587 |
|
5588 |
-
#: inc/class-page-editjob.php:
|
5589 |
#@ backwpup
|
5590 |
msgid "A tarballed, BZipped archive (fast and less memory)"
|
5591 |
msgstr "Ein TAR-BZ-Archiv (schnell und speicherschonend)"
|
5592 |
|
5593 |
-
#: inc/class-page-editjob.php:
|
5594 |
#@ backwpup
|
5595 |
msgid "Job Destination"
|
5596 |
msgstr "Zielordner des Auftrags"
|
5597 |
|
5598 |
-
#: inc/class-page-editjob.php:
|
5599 |
-
#: inc/class-page-editjob.php:
|
5600 |
#@ backwpup
|
5601 |
msgid "Where should your backup file be stored?"
|
5602 |
msgstr "Wo soll die Backup-Datei gespeichert werden?"
|
5603 |
|
5604 |
-
#: inc/class-page-editjob.php:
|
5605 |
#@ backwpup
|
5606 |
msgid "Log Files"
|
5607 |
msgstr "Protokoll-Dateien"
|
5608 |
|
5609 |
-
#: inc/class-page-editjob.php:
|
5610 |
#@ backwpup
|
5611 |
msgid "Send log to e-mail address"
|
5612 |
msgstr "Protokoll-Datei an E-Mail-Adresse senden"
|
5613 |
|
5614 |
-
#: inc/class-page-editjob.php:
|
5615 |
#@ backwpup
|
5616 |
msgid "Leave empty to not have log sent."
|
5617 |
msgstr "Leer lassen, um kein Protokoll zu senden."
|
5618 |
|
5619 |
-
#: inc/class-page-editjob.php:
|
5620 |
#@ backwpup
|
5621 |
msgid "E-Mail FROM field"
|
5622 |
msgstr "VON-Feld der E-Mail"
|
5623 |
|
5624 |
-
#: inc/class-page-editjob.php:
|
5625 |
#@ backwpup
|
5626 |
msgid "Errors only"
|
5627 |
msgstr "Nur Fehler"
|
5628 |
|
5629 |
-
#: inc/class-page-editjob.php:
|
5630 |
#@ backwpup
|
5631 |
msgid "Send e-mail with log only when errors occur during job execution."
|
5632 |
msgstr "Sende eine E-Mail mit Protokoll nur, wenn während des Auftrags ein Fehler aufgetreten ist."
|
5633 |
|
5634 |
-
#: inc/class-page-editjob.php:
|
5635 |
#@ backwpup
|
5636 |
msgid "Job Schedule"
|
5637 |
msgstr "Auftragsplanung"
|
5638 |
|
5639 |
-
#: inc/class-page-editjob.php:
|
5640 |
#@ backwpup
|
5641 |
msgid "Generate a server script file to let the job start with the server’s cron on command line interface. Alternatively use WP-CLI commands."
|
5642 |
msgstr "Erzeugen Sie ein Serverscript, um einen Auftrag per Kommandoziele auszulösen, oder benutzen Sie WP-CLI."
|
5643 |
|
5644 |
-
#: inc/class-page-jobs.php:
|
5645 |
#, php-format
|
5646 |
#@ backwpup
|
5647 |
msgid "Job currently running: %s"
|
5648 |
msgstr "Aktueller Auftrag wird bearbeitet: %s"
|
5649 |
|
5650 |
-
#: inc/class-page-jobs.php:618
|
5651 |
-
#, php-format
|
5652 |
-
#@ backwpup
|
5653 |
-
msgid "Job completed in %s seconds."
|
5654 |
-
msgstr "Auftrag ausgeführt in %s Sekunden."
|
5655 |
-
|
5656 |
#: inc/class-page-settings.php:120
|
5657 |
#@ backwpup
|
5658 |
msgid "Display Settings"
|
@@ -5730,17 +5663,17 @@ msgstr "Keine Auftragsnummer angegeben!"
|
|
5730 |
msgid "Job ID does not exist!"
|
5731 |
msgstr "Auftragsnummer existiert nicht!"
|
5732 |
|
5733 |
-
#: inc/class-wp-cli.php:
|
5734 |
#@ backwpup
|
5735 |
msgid "No job running"
|
5736 |
msgstr "Laufender Auftrag"
|
5737 |
|
5738 |
-
#: inc/class-wp-cli.php:
|
5739 |
#@ backwpup
|
5740 |
msgid "Running job"
|
5741 |
msgstr "Laufender Auftrag"
|
5742 |
|
5743 |
-
#: inc/features/class-destination-dropbox-pro.php:
|
5744 |
#, php-format
|
5745 |
#@ backwpup
|
5746 |
msgid "Folder %s deleted from Dropbox"
|
@@ -5783,7 +5716,7 @@ msgstr "Lösche nicht vorhandene Dateien aus Ordner"
|
|
5783 |
msgid "Extra file %s copied"
|
5784 |
msgstr "Zusätzliche Datei %s kopiert"
|
5785 |
|
5786 |
-
#: inc/features/class-destination-folder-pro.php:
|
5787 |
#, php-format
|
5788 |
#@ backwpup
|
5789 |
msgid "File %s deleted from folder"
|
@@ -5811,33 +5744,28 @@ msgid "Delete nonexistent files from Rackspace Cloud."
|
|
5811 |
msgstr "Nicht vorhandene Dateien von der Rackspace Cloud löschen."
|
5812 |
|
5813 |
#: inc/features/class-destination-s3-pro.php:36
|
5814 |
-
#: inc/features/class-destination-s3-v1-pro.php:
|
5815 |
#@ backwpup
|
5816 |
msgid "or set an S3 Server URL:"
|
5817 |
msgstr "oder setze eine S3-Server-URL:"
|
5818 |
|
5819 |
-
#: inc/features/class-jobtype-
|
5820 |
-
#@ backwpup
|
5821 |
-
msgid "Activate maintenance mode on table check"
|
5822 |
-
msgstr "Aktiviere den Wartungsmodus bei der Tabellenprüfung"
|
5823 |
-
|
5824 |
-
#: inc/features/class-jobtype-dbdump-pro.php:203
|
5825 |
#@ backwpup
|
5826 |
msgid "Path to mysqldump file, so a backup can be made with it. If it is correct and <em>shell_exec</em> is active, the backup will be generated with a system command. If <em>shell_exec</em> ist not active, this is disabled"
|
5827 |
msgstr "Pfad zur MySQL-Datei, mit der ein Backup erstellt werden kann. Wenn es korrekt ist und <em>shell_exec</em> funktioniert, kann das Backup mit einem Systemkommando ausgelöst werden. Dies wird deaktiviert, wenn <em>shell_exec</em> nicht verfügbar ist."
|
5828 |
|
5829 |
-
#: inc/features/class-jobtype-dbdump-pro.php:
|
5830 |
#, php-format
|
5831 |
#@ backwpup
|
5832 |
msgid "%d. Try to dump MySQL system …"
|
5833 |
msgstr "%d. Erstelle MySQL-System-Backup …"
|
5834 |
|
5835 |
-
#: inc/features/class-jobtype-dbdump-pro.php:
|
5836 |
#@ backwpup
|
5837 |
msgid "Compressing file …"
|
5838 |
msgstr "Datei wird komprimiert …"
|
5839 |
|
5840 |
-
#: inc/features/class-jobtype-dbdump-pro.php:
|
5841 |
#, php-format
|
5842 |
#@ backwpup
|
5843 |
msgid "%d. Try to dump database XML …"
|
@@ -5848,11 +5776,6 @@ msgstr "%d. Erstelle XML-Backup der Datenbank …"
|
|
5848 |
msgid "Optimize only WordPress database tables"
|
5849 |
msgstr "Optimiere nur Tabellen der WordPress-Datenbank"
|
5850 |
|
5851 |
-
#: inc/features/class-jobtype-dboptimize-pro.php:30
|
5852 |
-
#@ backwpup
|
5853 |
-
msgid "Activate maintenance mode on table optimization"
|
5854 |
-
msgstr "Aktiviere den Wartungsmodus bei der Tabellen-Optimierung"
|
5855 |
-
|
5856 |
#: inc/features/class-jobtype-file-pro.php:15
|
5857 |
#@ backwpup
|
5858 |
msgid "Backup WordPress main files"
|
@@ -5908,18 +5831,18 @@ msgstr "Wann möchten Sie den Auftrag starten?"
|
|
5908 |
msgid "Select one or more tasks for your backup job."
|
5909 |
msgstr "Wählen Sie eine oder mehrere Aufgaben für Ihren Backup-Auftrag."
|
5910 |
|
5911 |
-
#: inc/features/class-wizard-job.php:
|
5912 |
#, php-format
|
5913 |
#@ backwpup
|
5914 |
msgid "New job named %s generated."
|
5915 |
msgstr "Neuer Auftrag mit dem Namen %s erstellt."
|
5916 |
|
5917 |
-
#: inc/features/class-wizard-job.php:
|
5918 |
#@ backwpup
|
5919 |
msgid "Essential files + list of plugins"
|
5920 |
msgstr "Essenzielle Dateien und Plugin-Liste"
|
5921 |
|
5922 |
-
#: inc/features/class-wizard-job.php:
|
5923 |
#@ backwpup
|
5924 |
msgid "Backup essential files and folders, plus a list of installed plugins."
|
5925 |
msgstr "Sichern Sie die essenziellen Dateien und Ordner, sowie eine Liste der installierten Plugins."
|
@@ -5960,54 +5883,54 @@ msgstr "Hier gibt es leider einen Fehler."
|
|
5960 |
msgid "This is not a BackWPup XML file"
|
5961 |
msgstr "Dies ist keine BackWPup-XML-Datei"
|
5962 |
|
5963 |
-
#: inc/features/class-wizard-systemtest.php:
|
5964 |
#, php-format
|
5965 |
#@ backwpup
|
5966 |
msgid "You must run WordPress version 3.2 or higher to use this plugin. You are using version %s now."
|
5967 |
msgstr "Sie müssen WordPress in der Version 3.2 oder höher verwenden, um dieses Plugin zu benutzen. Momentan verwenden Sie Version %s."
|
5968 |
|
5969 |
-
#: inc/features/class-wizard-systemtest.php:
|
5970 |
#, php-format
|
5971 |
#@ backwpup
|
5972 |
msgid "You must run PHP version 5.2.6 or higher to use this plugin. You are using version %s now."
|
5973 |
msgstr "Sie benötigen PHP in der Version 5.2.6 oder höher, um das Plugin zu benutzen. Momentan haben Sie Version %s."
|
5974 |
|
5975 |
-
#: inc/features/class-wizard-systemtest.php:
|
5976 |
#, php-format
|
5977 |
#@ backwpup
|
5978 |
msgid "We recommend to run a PHP version above 5.3.2 to get the full plugin functionality. You are using version %s now."
|
5979 |
msgstr "Wir empfehlen, PHP in der Version 5.3.2 oder höher zu verwenden, um die volle Funktionalität des Plugins zu erhalten. Momentan verwenden Sie Version %s."
|
5980 |
|
5981 |
-
#: inc/features/class-wizard-systemtest.php:
|
5982 |
#, php-format
|
5983 |
#@ backwpup
|
5984 |
msgid "You must have the MySQLi extension installed and a MySQL server version of 5.0.7 or higher to use this plugin. You are using version %s now."
|
5985 |
msgstr "Sie müssen die MySQLi-Erweiterung und MySQL-Server in der Version 5.0.7 oder höher installiert haben, um dieses Plugin zu benutzen. Momentan verwenden Sie Version %s."
|
5986 |
|
5987 |
-
#: inc/features/class-wizard-systemtest.php:
|
5988 |
#@ backwpup
|
5989 |
msgid "You must have the PHP cURL extension installed to get the full plugin functionality."
|
5990 |
msgstr "Um dieses Plugin vollumfänglich zu nutzen, müssen Sie die Erweiterung PHP-cURL installiert haben."
|
5991 |
|
5992 |
-
#: inc/features/class-wizard-systemtest.php:
|
5993 |
#, php-format
|
5994 |
#@ backwpup
|
5995 |
msgid "Temp folder %s not read or writable. Please set proper writing permissions."
|
5996 |
msgstr "Das Temporäre Verzeichnis %s ist nicht lesbar oder beschreibbar. Bitte setze Schreibberechtigung."
|
5997 |
|
5998 |
-
#: inc/features/class-wizard-systemtest.php:
|
5999 |
#, php-format
|
6000 |
#@ backwpup
|
6001 |
msgid "Temp folder %s does not exist and cannot be created. Please create it and set proper writing permissions."
|
6002 |
msgstr "Das temporäre Verzeichnis %s existiert nicht, und es kann auch nicht erstellt werden. Bitte erstellen Sie es, und setzen Sie die passenden Schreibrechte."
|
6003 |
|
6004 |
-
#: inc/features/class-wizard-systemtest.php:
|
6005 |
#, php-format
|
6006 |
#@ backwpup
|
6007 |
msgid "Logs folder %s is not readable or writable. Please set proper writing permissions."
|
6008 |
msgstr "Das Verzeichnis %s für Protokoll-Dateien ist nicht lesbar oder beschreibbar. Bitte setze Schreibberechtigung."
|
6009 |
|
6010 |
-
#: inc/features/class-wizard-systemtest.php:
|
6011 |
#, php-format
|
6012 |
#@ backwpup
|
6013 |
msgid "Logs folder %s does not exist and cannot be created. Please create it and set proper writing permissions."
|
@@ -6057,41 +5980,83 @@ msgstr "Methode für ZIP-Erstellung"
|
|
6057 |
msgid "Auto = Uses PHP class ZipArchive if available; otherwise uses PclZip.<br />ZipArchive = Uses less memory, but many open files at a time.<br />PclZip = Uses more memory, but only 2 open files at a time."
|
6058 |
msgstr "Auto = Nutzt die PHP-Klasse ZipArchive falls verfügbar; andernfalls wird PclZip genutzt.<br />ZipArchive = Benötigt weniger Memory, aber viele offene Dateien gleichzeitig.<br />PclZip = Benötigt mehr Memory, aber nur 2 zur gleichen Zeit offene Dateien."
|
6059 |
|
6060 |
-
#: inc/class-page-editjob.php:
|
6061 |
#@ backwpup
|
6062 |
msgid "E-Mail \"From\" field (Name < you@your-email-address.tld >)"
|
6063 |
msgstr "\"VON\"-Feld der E-Mail (Name < email@adresse.tld >)"
|
6064 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6065 |
#. translators: plugin header field 'Version'
|
6066 |
#: backwpup.php:0
|
6067 |
#@ backwpup
|
6068 |
-
msgid "3.0.
|
6069 |
msgstr ""
|
6070 |
|
6071 |
-
#: inc/class-
|
6072 |
#@ backwpup
|
6073 |
-
msgid "
|
6074 |
-
msgstr "
|
6075 |
|
6076 |
-
#: inc/class-
|
6077 |
#@ backwpup
|
6078 |
-
msgid "
|
6079 |
-
msgstr "
|
6080 |
|
6081 |
-
#: inc/class-
|
6082 |
-
#: inc/features/class-jobtype-dbdump-pro.php:111
|
6083 |
#@ backwpup
|
6084 |
-
msgid "
|
6085 |
-
msgstr "
|
6086 |
|
6087 |
-
#: inc/class-
|
6088 |
-
#: inc/features/class-jobtype-dbdump-pro.php:157
|
6089 |
#@ backwpup
|
6090 |
-
msgid "
|
6091 |
-
msgstr "
|
6092 |
|
6093 |
-
#: inc/
|
|
|
|
|
6094 |
#@ backwpup
|
6095 |
-
msgid "
|
6096 |
-
msgstr "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6097 |
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
+
"Project-Id-Version: BackWPup Pro v3.0.8\n"
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
"POT-Creation-Date: 2013-02-06 17:42+0100\n"
|
6 |
+
"PO-Revision-Date: 2013-04-30 06:01:47-0500\n"
|
7 |
"Last-Translator: Frank Bueltge <frank@bueltge.de>\n"
|
8 |
"Language-Team: INPSYDE <info@inpsyde.com>\n"
|
9 |
"MIME-Version: 1.0\n"
|
20 |
"X-Poedit-SearchPath-0: ..\n"
|
21 |
"X-Textdomain-Support: yes"
|
22 |
|
23 |
+
#: inc/class-admin.php:123
|
24 |
#: inc/features/class-documentation.php:150
|
25 |
#: inc/features/class-features.php:149
|
26 |
#@ backwpup
|
27 |
msgid "Documentation"
|
28 |
msgstr "Dokumentation"
|
29 |
|
30 |
+
#: inc/class-admin.php:146
|
31 |
#@ backwpup
|
32 |
msgid "BackWPup Dashboard"
|
33 |
msgstr "BackWPup Dashboard"
|
34 |
|
35 |
+
#: inc/class-admin.php:146
|
36 |
#@ backwpup
|
37 |
msgid "Dashboard"
|
38 |
msgstr "Dashboard"
|
39 |
|
40 |
+
#: inc/class-admin.php:165
|
41 |
+
#: inc/class-adminbar.php:84
|
42 |
#: inc/class-page-settings.php:103
|
43 |
#@ backwpup
|
44 |
#@ backwpupadminbar
|
45 |
msgid "Jobs"
|
46 |
msgstr "Aufträge"
|
47 |
|
48 |
+
#: inc/class-admin.php:180
|
49 |
#@ backwpup
|
50 |
msgid "Add New Job"
|
51 |
msgstr "Neuer Auftrag"
|
52 |
|
53 |
+
#: inc/class-admin.php:196
|
54 |
+
#: inc/class-adminbar.php:100
|
55 |
+
#: inc/class-page-backups.php:366
|
56 |
#: inc/class-page-logs.php:281
|
57 |
#: inc/class-page-settings.php:103
|
58 |
#@ backwpup
|
60 |
msgid "Logs"
|
61 |
msgstr "Protokolle"
|
62 |
|
63 |
+
#: inc/class-admin.php:211
|
64 |
+
#: inc/class-adminbar.php:108
|
65 |
#@ backwpup
|
66 |
#@ backwpupadminbar
|
67 |
msgid "Backups"
|
68 |
msgstr "Datensicherungen"
|
69 |
|
70 |
+
#: inc/class-admin.php:226
|
71 |
#@ backwpup
|
72 |
msgid "Settings"
|
73 |
msgstr "Einstellungen"
|
74 |
|
75 |
+
#: inc/class-admin.php:320
|
76 |
#@ backwpup
|
77 |
msgid "Jobs overview"
|
78 |
msgstr "Auftragsübersicht"
|
79 |
|
80 |
+
#: inc/class-admin.php:320
|
81 |
#: inc/class-page-jobs.php:134
|
82 |
#@ backwpup
|
83 |
msgid "Run now"
|
84 |
msgstr "Jetzt starten"
|
85 |
|
86 |
+
#: inc/class-admin.php:415
|
87 |
#, php-format
|
88 |
#@ backwpup
|
89 |
msgid "version %s"
|
90 |
msgstr "Version %s"
|
91 |
|
92 |
+
#: inc/class-adminbar.php:62
|
93 |
#@ backwpupadminbar
|
94 |
msgid "BackWPup"
|
95 |
msgstr "BackWPup"
|
96 |
|
97 |
+
#: inc/class-adminbar.php:75
|
98 |
#@ backwpupadminbar
|
99 |
msgid "Abort!"
|
100 |
msgstr "Abbrechen!"
|
101 |
|
102 |
+
#: inc/class-adminbar.php:92
|
103 |
+
#: inc/class-page-jobs.php:471
|
104 |
#@ backwpupadminbar
|
105 |
#@ backwpup
|
106 |
msgid "Add New"
|
107 |
msgstr "Neuer Auftrag"
|
108 |
|
109 |
#: inc/features/class-features.php:135
|
110 |
+
#: inc/features/class-features.php:168
|
111 |
#@ backwpup
|
112 |
#@ backwpupadminbar
|
113 |
msgid "Wizards"
|
114 |
msgstr "Assistenten"
|
115 |
|
116 |
+
#: inc/class-adminbar.php:130
|
117 |
#@ backwpupadminbar
|
118 |
msgid "Run Now"
|
119 |
msgstr "Jetzt starten"
|
120 |
|
121 |
#: inc/class-cron.php:53
|
122 |
+
#: inc/class-job.php:1010
|
123 |
+
#: inc/class-page-jobs.php:402
|
124 |
+
#: inc/class-page-jobs.php:637
|
125 |
+
#: inc/class-wp-cli.php:52
|
126 |
#@ backwpup
|
127 |
msgid "ERROR:"
|
128 |
msgstr "FEHLER:"
|
129 |
|
130 |
#: inc/class-cron.php:84
|
131 |
+
#: inc/class-job.php:1242
|
132 |
#, php-format
|
133 |
#@ backwpup
|
134 |
msgid "[%3$s] BackWPup log %1$s: %2$s"
|
135 |
msgstr "[%3$s] BackWPup Log %1$s: %2$s"
|
136 |
|
137 |
#: inc/class-cron.php:84
|
138 |
+
#: inc/class-job.php:1238
|
139 |
#@ backwpup
|
140 |
msgid "ERROR"
|
141 |
msgstr "FEHLER"
|
151 |
msgid "Backup to Dropbox"
|
152 |
msgstr "Datensicherung in die Dropbox"
|
153 |
|
154 |
+
#: inc/class-destination-dropbox.php:50
|
155 |
+
#: inc/features/class-destination-dropbox-pro.php:29
|
156 |
#@ backwpup
|
157 |
msgid "Dropbox authentication complete!"
|
158 |
msgstr "Dropbox-Authentifizierung vollständig!"
|
159 |
|
160 |
+
#: inc/class-destination-dropbox.php:57
|
161 |
+
#: inc/class-destination-dropbox.php:133
|
162 |
+
#: inc/class-destination-dropbox.php:152
|
163 |
+
#: inc/class-destination-dropbox.php:278
|
164 |
+
#: inc/class-destination-dropbox.php:328
|
165 |
+
#: inc/features/class-destination-dropbox-pro.php:32
|
166 |
+
#: inc/features/class-destination-dropbox-pro.php:51
|
167 |
+
#: inc/features/class-destination-dropbox-pro.php:214
|
168 |
#, php-format
|
169 |
#@ backwpup
|
170 |
msgid "Dropbox API: %s"
|
171 |
msgstr "Dropbox-API: %s"
|
172 |
|
173 |
+
#: inc/class-destination-dropbox.php:63
|
|
|
|
|
|
|
|
|
|
|
174 |
#@ backwpup
|
175 |
msgid "Login"
|
176 |
msgstr "Anmelden"
|
177 |
|
178 |
+
#: inc/class-destination-dropbox.php:67
|
179 |
+
#: inc/features/class-destination-dropbox-pro.php:59
|
180 |
#@ backwpup
|
181 |
msgid "Authenticate"
|
182 |
msgstr "Authentifizieren"
|
183 |
|
184 |
+
#: inc/class-destination-dropbox.php:69
|
185 |
+
#: inc/features/class-destination-dropbox-pro.php:58
|
186 |
#@ backwpup
|
187 |
msgid "Not authenticated!"
|
188 |
msgstr "Nicht authentifiziert!"
|
189 |
|
190 |
+
#: inc/class-destination-dropbox.php:69
|
191 |
+
#: inc/features/class-destination-dropbox-pro.php:60
|
192 |
#@ backwpup
|
193 |
msgid "Create Account"
|
194 |
msgstr "Konto erstellen"
|
195 |
|
196 |
+
#: inc/class-destination-dropbox.php:71
|
197 |
#: inc/class-destination-sugarsync.php:63
|
198 |
+
#: inc/features/class-destination-dropbox-pro.php:66
|
199 |
#: inc/features/class-destination-sugarsync-pro.php:29
|
200 |
#@ backwpup
|
201 |
msgid "Authenticated!"
|
202 |
msgstr "Authentifiziert!"
|
203 |
|
204 |
+
#: inc/class-destination-dropbox.php:73
|
205 |
#@ backwpup
|
206 |
msgid "Reauthenticate (Sandbox)"
|
207 |
msgstr "Neu authentifizieren (Sandbox)"
|
208 |
|
209 |
+
#: inc/class-destination-dropbox.php:74
|
210 |
#@ backwpup
|
211 |
msgid "Reauthenticate (full Dropbox)"
|
212 |
msgstr "Neu authentifizieren (volle Dropbox)"
|
213 |
|
214 |
+
#: inc/class-destination-dropbox.php:80
|
215 |
#: inc/class-destination-folder.php:41
|
216 |
#: inc/class-destination-ftp.php:67
|
217 |
#: inc/class-destination-msazure.php:86
|
218 |
+
#: inc/class-destination-rsc.php:97
|
219 |
#: inc/class-destination-sugarsync.php:100
|
220 |
#@ backwpup
|
221 |
msgid "Backup settings"
|
222 |
msgstr "Backup-Einstellungen"
|
223 |
|
224 |
+
#: inc/class-destination-dropbox.php:84
|
225 |
#@ backwpup
|
226 |
msgid "Folder in Dropbox"
|
227 |
msgstr "Ordner in Dropbox"
|
228 |
|
229 |
+
#: inc/class-destination-dropbox.php:90
|
230 |
#: inc/class-destination-folder.php:51
|
231 |
#: inc/class-destination-ftp.php:77
|
232 |
#: inc/class-destination-sugarsync.php:110
|
234 |
msgid "File Deletion"
|
235 |
msgstr "Dateilöschung"
|
236 |
|
237 |
+
#: inc/class-destination-dropbox.php:96
|
238 |
#: inc/class-destination-folder.php:57
|
239 |
#: inc/class-destination-msazure.php:102
|
240 |
+
#: inc/class-destination-rsc.php:113
|
241 |
#: inc/class-destination-s3-v1.php:172
|
242 |
#: inc/class-destination-s3.php:177
|
243 |
#: inc/class-destination-sugarsync.php:116
|
244 |
+
#: inc/features/class-destination-dropbox-pro.php:74
|
245 |
#: inc/features/class-destination-folder-pro.php:27
|
246 |
#: inc/features/class-destination-msazure-pro.php:32
|
247 |
#: inc/features/class-destination-rsc-pro.php:56
|
248 |
#: inc/features/class-destination-s3-pro.php:64
|
249 |
+
#: inc/features/class-destination-s3-v1-pro.php:64
|
250 |
#@ backwpup
|
251 |
msgid "Number of files to keep in folder."
|
252 |
msgstr "Anzahl der Dateien, die im Ordner behalten werden"
|
253 |
|
254 |
+
#: inc/class-destination-dropbox.php:96
|
255 |
#: inc/class-destination-folder.php:57
|
256 |
#: inc/class-destination-ftp.php:83
|
257 |
#: inc/class-destination-msazure.php:102
|
258 |
+
#: inc/class-destination-rsc.php:113
|
259 |
#: inc/class-destination-s3-v1.php:172
|
260 |
#: inc/class-destination-s3.php:177
|
261 |
#: inc/class-destination-sugarsync.php:116
|
262 |
+
#: inc/features/class-destination-dropbox-pro.php:74
|
263 |
#: inc/features/class-destination-folder-pro.php:27
|
264 |
#: inc/features/class-destination-msazure-pro.php:32
|
265 |
#: inc/features/class-destination-rsc-pro.php:56
|
266 |
#: inc/features/class-destination-s3-pro.php:64
|
267 |
+
#: inc/features/class-destination-s3-v1-pro.php:64
|
268 |
#@ backwpup
|
269 |
msgid "Oldest files will be deleted first. 0 = no deletion"
|
270 |
msgstr "Älteste Dateien werden als erstes gelöscht. 0 = keine Löschung"
|
271 |
|
272 |
+
#: inc/class-destination-dropbox.php:100
|
273 |
#: inc/class-destination-folder.php:61
|
274 |
#: inc/class-destination-ftp.php:87
|
275 |
#: inc/class-destination-msazure.php:106
|
276 |
+
#: inc/class-destination-rsc.php:117
|
277 |
#: inc/class-destination-s3-v1.php:176
|
278 |
#: inc/class-destination-s3.php:181
|
279 |
#: inc/class-destination-sugarsync.php:120
|
280 |
+
#: inc/features/class-destination-dropbox-pro.php:76
|
281 |
#: inc/features/class-destination-folder-pro.php:32
|
282 |
#: inc/features/class-destination-ftp-pro.php:42
|
283 |
#: inc/features/class-destination-msazure-pro.php:37
|
284 |
#: inc/features/class-destination-rsc-pro.php:61
|
285 |
#: inc/features/class-destination-s3-pro.php:69
|
286 |
+
#: inc/features/class-destination-s3-v1-pro.php:69
|
287 |
#: inc/features/class-destination-sugarsync-pro.php:65
|
288 |
#@ backwpup
|
289 |
msgid "Do not delete files while syncing to destination!"
|
290 |
msgstr "Keine Dateien im Sync-Zielverzeichnis löschen!"
|
291 |
|
292 |
+
#: inc/class-destination-dropbox.php:266
|
293 |
+
#: inc/class-destination-msazure.php:250
|
294 |
#: inc/class-destination-sugarsync.php:272
|
295 |
#, php-format
|
296 |
#@ backwpup
|
297 |
msgid "Backup transferred to %s"
|
298 |
msgstr "Datensicherung übertragen zu %s"
|
299 |
|
300 |
+
#: inc/class-destination-dropbox.php:272
|
301 |
#, php-format
|
302 |
#@ backwpup
|
303 |
msgid "Error on transfer backup to Dropbox: %s"
|
304 |
msgstr "Fehler beim Transfer des Backups zur Dropbox: %s"
|
305 |
|
306 |
#: inc/class-destination-folder.php:13
|
307 |
+
#: inc/class-page-backups.php:228
|
308 |
#@ backwpup
|
309 |
msgid "Folder"
|
310 |
msgstr "Ordner"
|
314 |
msgid "Backup to Folder"
|
315 |
msgstr "Datensicherung in Ordner"
|
316 |
|
317 |
+
#: inc/class-destination-folder.php:209
|
318 |
#, php-format
|
319 |
#@ backwpup
|
320 |
msgid "One backup file deleted"
|
332 |
msgid "Backup to FTP"
|
333 |
msgstr "Backup zu FTP"
|
334 |
|
335 |
+
#: inc/features/class-jobtype-dbdump-pro.php:116
|
336 |
#@ backwpup
|
337 |
msgid "Host:"
|
338 |
msgstr "Host (Server):"
|
339 |
|
340 |
+
#: inc/class-destination-email.php:125
|
341 |
#: inc/class-destination-ftp.php:46
|
342 |
#: inc/features/class-destination-ftp-pro.php:17
|
343 |
#@ backwpup
|
345 |
msgstr "Port:"
|
346 |
|
347 |
#: inc/class-destination-ftp.php:52
|
348 |
+
#: inc/class-destination-rsc.php:50
|
349 |
#@ backwpup
|
350 |
msgid "Username"
|
351 |
msgstr "Benutzername"
|
468 |
msgid "SMTP"
|
469 |
msgstr "SMTP"
|
470 |
|
471 |
+
#: inc/class-destination-email.php:112
|
472 |
#@ backwpup
|
473 |
msgid "Sendmail path"
|
474 |
msgstr "Sendmail Pfad"
|
475 |
|
476 |
+
#: inc/class-destination-email.php:120
|
477 |
#@ backwpup
|
478 |
msgid "SMTP host name"
|
479 |
msgstr "SMTP Hostname"
|
480 |
|
481 |
+
#: inc/class-destination-email.php:131
|
482 |
#@ backwpup
|
483 |
msgid "SMTP secure connection"
|
484 |
msgstr "SMTP Sichere Verbindung"
|
485 |
|
486 |
+
#: inc/class-destination-email.php:135
|
487 |
#: inc/class-destination-s3-v1.php:189
|
488 |
#: inc/class-destination-s3.php:205
|
489 |
+
#: inc/class-jobtype-dbdump.php:68
|
490 |
+
#: inc/class-jobtype-dbdump.php:103
|
491 |
#: inc/class-jobtype-wpexp.php:70
|
492 |
#: inc/class-jobtype-wpplugin.php:56
|
493 |
+
#: inc/class-page-backwpup.php:218
|
494 |
+
#: inc/class-page-backwpup.php:283
|
495 |
+
#: inc/features/class-jobtype-dbdump-pro.php:153
|
496 |
+
#: inc/features/class-jobtype-dbdump-pro.php:203
|
497 |
#@ backwpup
|
498 |
msgid "none"
|
499 |
msgstr "nichts"
|
500 |
|
501 |
+
#: inc/class-destination-email.php:136
|
502 |
#@ backwpup
|
503 |
msgid "SSL"
|
504 |
msgstr "SSL"
|
505 |
|
506 |
+
#: inc/class-destination-email.php:137
|
507 |
#@ backwpup
|
508 |
msgid "TLS"
|
509 |
msgstr "TLS"
|
510 |
|
511 |
+
#: inc/class-destination-email.php:142
|
512 |
#@ backwpup
|
513 |
msgid "SMTP username"
|
514 |
msgstr "SMTP Benutzername"
|
515 |
|
516 |
+
#: inc/class-destination-email.php:149
|
517 |
#@ backwpup
|
518 |
msgid "SMTP password"
|
519 |
msgstr "SMTP Passwort"
|
520 |
|
521 |
+
#: inc/class-destination-email.php:309
|
522 |
#, php-format
|
523 |
#@ backwpup
|
524 |
msgid "BackWPup archive from %1$s: %2$s"
|
525 |
msgstr "BackWPup-Archiv vom %1$s: %2$s"
|
526 |
|
527 |
+
#: inc/class-destination-email.php:312
|
528 |
#, php-format
|
529 |
#@ backwpup
|
530 |
msgid "Backup archive: %s"
|
531 |
msgstr "Datensicherungsarchiv: %s"
|
532 |
|
533 |
+
#: inc/class-destination-email.php:431
|
534 |
#@ backwpup
|
535 |
msgid "BackWPup archive sending TEST Message"
|
536 |
msgstr "BackWPup Archiv TEST Nachricht senden"
|
566 |
msgstr "Blob Container"
|
567 |
|
568 |
#: inc/class-destination-msazure.php:67
|
569 |
+
#: inc/class-destination-rsc.php:78
|
570 |
#@ backwpup
|
571 |
msgid "Container selection"
|
572 |
msgstr "Container Auswahl"
|
573 |
|
574 |
#: inc/class-destination-msazure.php:79
|
575 |
+
#: inc/class-destination-rsc.php:90
|
576 |
#@ backwpup
|
577 |
msgid "Create a new container"
|
578 |
msgstr "Neuen Container erstellen"
|
583 |
msgstr "Ordner im Container"
|
584 |
|
585 |
#: inc/class-destination-msazure.php:96
|
586 |
+
#: inc/class-destination-rsc.php:107
|
587 |
#: inc/class-destination-s3-v1.php:166
|
588 |
#: inc/class-destination-s3.php:171
|
589 |
#@ backwpup
|
590 |
msgid "File deletion"
|
591 |
msgstr "Datei Löschung"
|
592 |
|
593 |
+
#: inc/class-destination-msazure.php:144
|
594 |
#: inc/features/class-destination-msazure-pro.php:70
|
595 |
#, php-format
|
596 |
#@ backwpup
|
597 |
msgid "MS Azure container \"%s\" created."
|
598 |
msgstr "MS Azure Container \"%s\" erstellt."
|
599 |
|
600 |
+
#: inc/class-destination-msazure.php:147
|
601 |
#: inc/features/class-destination-msazure-pro.php:73
|
602 |
#, php-format
|
603 |
#@ backwpup
|
604 |
msgid "MS Azure container create: %s"
|
605 |
msgstr "MS Azure Container erstellen: %s"
|
606 |
|
607 |
+
#: inc/class-destination-msazure.php:239
|
608 |
#: inc/features/class-destination-msazure-pro.php:108
|
609 |
#, php-format
|
610 |
#@ backwpup
|
611 |
msgid "MS Azure container \"%s\" does not exist!"
|
612 |
msgstr "MS Azure Container \"%s\" existiert nicht!"
|
613 |
|
614 |
+
#: inc/class-destination-msazure.php:243
|
615 |
#: inc/features/class-destination-msazure-pro.php:112
|
616 |
#, php-format
|
617 |
#@ backwpup
|
618 |
msgid "Connected to MS Azure container \"%s\"."
|
619 |
msgstr "Verbunden mit MS Azure container \"%s\""
|
620 |
|
621 |
+
#: inc/class-destination-msazure.php:292
|
622 |
#, php-format
|
623 |
#@ backwpup
|
624 |
msgid "One file deleted on Microsoft Azure container."
|
626 |
msgstr[0] "Eine Datei im Microsoft-Azure-Container gelöscht"
|
627 |
msgstr[1] "%d Dateien im Microsoft-Azure-Container gelöscht"
|
628 |
|
629 |
+
#: inc/class-destination-msazure.php:298
|
630 |
#: inc/features/class-destination-msazure-pro.php:172
|
631 |
#, php-format
|
632 |
#@ backwpup
|
633 |
msgid "Microsoft Azure API: %s"
|
634 |
msgstr "Microsoft Azure API: %s"
|
635 |
|
636 |
+
#: inc/class-destination-rsc.php:23
|
637 |
#@ backwpup
|
638 |
msgid "RSC"
|
639 |
msgstr "RSC"
|
640 |
|
641 |
+
#: inc/class-destination-rsc.php:24
|
642 |
#: inc/class-page-about.php:238
|
643 |
#@ backwpup
|
644 |
msgid "Backup to Rackspace Cloud Files"
|
645 |
msgstr "Datensicherung in die Rackspace Cloud"
|
646 |
|
647 |
+
#: inc/class-destination-rsc.php:46
|
648 |
#@ backwpup
|
649 |
msgid "Rack Space Cloud Keys"
|
650 |
msgstr "Rack Space Cloud Keys"
|
651 |
|
652 |
+
#: inc/class-destination-rsc.php:57
|
653 |
#@ backwpup
|
654 |
msgid "API Key"
|
655 |
msgstr "API Key"
|
656 |
|
657 |
+
#: inc/class-destination-rsc.php:65
|
658 |
#@ backwpup
|
659 |
msgid "Select region"
|
660 |
msgstr "Wähle Region"
|
661 |
|
|
|
662 |
#: inc/class-destination-rsc.php:69
|
663 |
+
#: inc/class-destination-rsc.php:71
|
664 |
#: inc/features/class-destination-rsc-pro.php:34
|
665 |
#@ backwpup
|
666 |
msgid "Rackspace Cloud Files Region"
|
667 |
msgstr "Rackspace Cloud Verzeichnis"
|
668 |
|
669 |
+
#: inc/class-destination-rsc.php:72
|
670 |
#: inc/features/class-destination-rsc-pro.php:35
|
671 |
#@ backwpup
|
672 |
msgid "Dallas (DFW)"
|
673 |
msgstr "Dallas (DFW)"
|
674 |
|
675 |
+
#: inc/class-destination-rsc.php:73
|
676 |
#: inc/features/class-destination-rsc-pro.php:36
|
677 |
#@ backwpup
|
678 |
msgid "Chicago (ORD)"
|
679 |
msgstr "Chicago (ORD)"
|
680 |
|
|
|
681 |
#: inc/class-destination-s3-v1.php:156
|
682 |
#: inc/class-destination-s3.php:161
|
683 |
#@ backwpup
|
684 |
msgid "S3 Backup settings"
|
685 |
msgstr "S3 Backup Einstellungen"
|
686 |
|
687 |
+
#: inc/class-destination-rsc.php:101
|
688 |
#: inc/class-destination-s3-v1.php:160
|
689 |
#: inc/class-destination-s3.php:165
|
690 |
#@ backwpup
|
691 |
msgid "Folder in bucket"
|
692 |
msgstr "Ordner im Bucket"
|
693 |
|
694 |
+
#: inc/class-destination-rsc.php:158
|
695 |
#: inc/features/class-destination-rsc-pro.php:100
|
696 |
#, php-format
|
697 |
#@ backwpup
|
698 |
msgid "Rackspace Cloud container \"%s\" created."
|
699 |
msgstr "Rackspace Cloud Container \"%s\" erstellt."
|
700 |
|
701 |
+
#: inc/class-destination-rsc.php:162
|
702 |
+
#: inc/class-destination-rsc.php:271
|
703 |
+
#: inc/class-destination-rsc.php:299
|
704 |
+
#: inc/class-destination-rsc.php:347
|
705 |
#: inc/features/class-destination-rsc-pro.php:104
|
706 |
#: inc/features/class-destination-rsc-pro.php:147
|
707 |
+
#: inc/features/class-destination-rsc-pro.php:221
|
708 |
#, php-format
|
709 |
#@ backwpup
|
710 |
msgid "Rackspace Cloud API: %s"
|
711 |
msgstr "Rackspace Cloud API: %s"
|
712 |
|
713 |
+
#: inc/class-destination-rsc.php:252
|
714 |
#, php-format
|
715 |
#@ backwpup
|
716 |
msgid "%d. Trying to send backup file to Rackspace cloud …"
|
717 |
msgstr "%d. Versuche, ein Backup zur Rackspace Cloud zu senden …"
|
718 |
|
719 |
+
#: inc/class-destination-rsc.php:268
|
720 |
#, php-format
|
721 |
#@ backwpup
|
722 |
msgid "Connected to Rackspace cloud files container %s"
|
723 |
msgstr "Verbunden mit Rackspace Cloud Container %s"
|
724 |
|
725 |
+
#: inc/class-destination-rsc.php:280
|
726 |
#@ backwpup
|
727 |
msgid "Upload to Rackspace cloud started …"
|
728 |
msgstr "Upload zur Rackspace Cloud nun gestartet …"
|
729 |
|
730 |
+
#: inc/class-destination-rsc.php:289
|
731 |
#@ backwpup
|
732 |
msgid "Backup File transferred to RSC://"
|
733 |
msgstr "Datensicherungsdatei übertragen zu RSC://"
|
734 |
|
735 |
+
#: inc/class-destination-rsc.php:293
|
736 |
#@ backwpup
|
737 |
msgid "Cannot transfer backup to Rackspace cloud."
|
738 |
msgstr "Kann das Backup nicht zur Rackspace Cloud transferieren"
|
739 |
|
740 |
+
#: inc/class-destination-rsc.php:341
|
741 |
#, php-format
|
742 |
#@ backwpup
|
743 |
msgid "One file deleted on Rackspace cloud container."
|
745 |
msgstr[0] "Eine Datei im Rackspace-Container gelöscht"
|
746 |
msgstr[1] "%d Dateien im Rackspace-Container gelöscht"
|
747 |
|
748 |
+
#: inc/class-destination-rsc.php:453
|
749 |
#@ backwpup
|
750 |
msgid "Missing API Key!"
|
751 |
msgstr "API-Schlüssel wird fehlt!"
|
767 |
#: inc/class-destination-s3-v1.php:90
|
768 |
#: inc/class-destination-s3.php:95
|
769 |
#: inc/features/class-destination-s3-pro.php:23
|
770 |
+
#: inc/features/class-destination-s3-v1-pro.php:23
|
771 |
#@ backwpup
|
772 |
msgid "Amazon S3 Region"
|
773 |
msgstr "Amazon S3 Region"
|
775 |
#: inc/class-destination-s3-v1.php:91
|
776 |
#: inc/class-destination-s3.php:96
|
777 |
#: inc/features/class-destination-s3-pro.php:24
|
778 |
+
#: inc/features/class-destination-s3-v1-pro.php:24
|
779 |
#@ backwpup
|
780 |
msgid "Amazon S3: US Standard"
|
781 |
msgstr "Amazon S3: US Standard"
|
783 |
#: inc/class-destination-s3-v1.php:92
|
784 |
#: inc/class-destination-s3.php:97
|
785 |
#: inc/features/class-destination-s3-pro.php:25
|
786 |
+
#: inc/features/class-destination-s3-v1-pro.php:25
|
787 |
#@ backwpup
|
788 |
msgid "Amazon S3: US West (Northern California)"
|
789 |
msgstr "Amazon S3: US West (Northern California)"
|
791 |
#: inc/class-destination-s3-v1.php:93
|
792 |
#: inc/class-destination-s3.php:98
|
793 |
#: inc/features/class-destination-s3-pro.php:26
|
794 |
+
#: inc/features/class-destination-s3-v1-pro.php:26
|
795 |
#@ backwpup
|
796 |
msgid "Amazon S3: US West (Oregon)"
|
797 |
msgstr "Amazon S3: US West (Oregon)"
|
799 |
#: inc/class-destination-s3-v1.php:94
|
800 |
#: inc/class-destination-s3.php:99
|
801 |
#: inc/features/class-destination-s3-pro.php:27
|
802 |
+
#: inc/features/class-destination-s3-v1-pro.php:27
|
803 |
#@ backwpup
|
804 |
msgid "Amazon S3: EU (Ireland)"
|
805 |
msgstr "Amazon S3: EU (Ireland)"
|
807 |
#: inc/class-destination-s3-v1.php:95
|
808 |
#: inc/class-destination-s3.php:100
|
809 |
#: inc/features/class-destination-s3-pro.php:28
|
810 |
+
#: inc/features/class-destination-s3-v1-pro.php:28
|
811 |
#@ backwpup
|
812 |
msgid "Amazon S3: Asia Pacific (Tokyo)"
|
813 |
msgstr "Amazon S3: Asia Pacific (Tokyo)"
|
815 |
#: inc/class-destination-s3-v1.php:96
|
816 |
#: inc/class-destination-s3.php:101
|
817 |
#: inc/features/class-destination-s3-pro.php:29
|
818 |
+
#: inc/features/class-destination-s3-v1-pro.php:29
|
819 |
#@ backwpup
|
820 |
msgid "Amazon S3: Asia Pacific (Singapore)"
|
821 |
msgstr "Amazon S3: Asia Pacific (Singapore)"
|
823 |
#: inc/class-destination-s3-v1.php:97
|
824 |
#: inc/class-destination-s3.php:102
|
825 |
#: inc/features/class-destination-s3-pro.php:30
|
826 |
+
#: inc/features/class-destination-s3-v1-pro.php:30
|
827 |
#@ backwpup
|
828 |
msgid "Amazon S3: Asia Pacific (Sydney)"
|
829 |
msgstr "Amazon S3: Asia Pacific (Sydney)"
|
831 |
#: inc/class-destination-s3-v1.php:98
|
832 |
#: inc/class-destination-s3.php:103
|
833 |
#: inc/features/class-destination-s3-pro.php:31
|
834 |
+
#: inc/features/class-destination-s3-v1-pro.php:31
|
835 |
#@ backwpup
|
836 |
msgid "Amazon S3: South America (Sao Paulo)"
|
837 |
msgstr "Amazon S3: South America (Sao Paulo)"
|
839 |
#: inc/class-destination-s3-v1.php:99
|
840 |
#: inc/class-destination-s3.php:104
|
841 |
#: inc/features/class-destination-s3-pro.php:32
|
842 |
+
#: inc/features/class-destination-s3-v1-pro.php:32
|
843 |
#@ backwpup
|
844 |
msgid "Google Storage (Interoperable Access)"
|
845 |
msgstr "Google Storage (Interoperable Access)"
|
847 |
#: inc/class-destination-s3-v1.php:100
|
848 |
#: inc/class-destination-s3.php:105
|
849 |
#: inc/features/class-destination-s3-pro.php:33
|
850 |
+
#: inc/features/class-destination-s3-v1-pro.php:33
|
851 |
#@ backwpup
|
852 |
msgid "Hosteurope Cloud Storage"
|
853 |
msgstr "Hosteurope Cloud Storage"
|
855 |
#: inc/class-destination-s3-v1.php:101
|
856 |
#: inc/class-destination-s3.php:106
|
857 |
#: inc/features/class-destination-s3-pro.php:34
|
858 |
+
#: inc/features/class-destination-s3-v1-pro.php:34
|
859 |
#@ backwpup
|
860 |
msgid "Dream Host Cloud Storage"
|
861 |
msgstr "Dream Host Cloud Storage"
|
937 |
#: inc/class-destination-s3-v1.php:260
|
938 |
#: inc/class-destination-s3.php:271
|
939 |
#: inc/features/class-destination-s3-pro.php:126
|
940 |
+
#: inc/features/class-destination-s3-v1-pro.php:131
|
941 |
#, php-format
|
942 |
#@ backwpup
|
943 |
msgid "Bucket %1$s created in %2$s."
|
946 |
#: inc/class-destination-s3-v1.php:262
|
947 |
#: inc/class-destination-s3.php:273
|
948 |
#: inc/features/class-destination-s3-pro.php:128
|
949 |
+
#: inc/features/class-destination-s3-v1-pro.php:133
|
950 |
#, php-format
|
951 |
#@ backwpup
|
952 |
msgid "Bucket %s could not be created."
|
967 |
#: inc/class-destination-s3.php:451
|
968 |
#: inc/class-destination-s3.php:472
|
969 |
#: inc/class-destination-s3.php:531
|
970 |
+
#: inc/features/class-destination-s3-pro.php:280
|
971 |
+
#: inc/features/class-destination-s3-v1-pro.php:275
|
972 |
#, php-format
|
973 |
#@ backwpup
|
974 |
msgid "S3 Service API: %s"
|
977 |
#: inc/class-destination-s3-v1.php:398
|
978 |
#: inc/class-destination-s3.php:395
|
979 |
#: inc/features/class-destination-s3-pro.php:167
|
980 |
+
#: inc/features/class-destination-s3-v1-pro.php:176
|
981 |
#, php-format
|
982 |
#@ backwpup
|
983 |
msgid "S3 Bucket \"%s\" does not exist!"
|
1013 |
msgstr[0] "Eine Datei im S3-Bucket gelöscht"
|
1014 |
msgstr[1] "%d Dateien im S3-Bucket gelöscht"
|
1015 |
|
1016 |
+
#: inc/class-destination-msazure.php:382
|
1017 |
#: inc/class-destination-s3-v1.php:587
|
1018 |
#: inc/class-destination-s3.php:628
|
1019 |
#@ backwpup
|
1059 |
#: inc/class-page-settings.php:330
|
1060 |
#: inc/features/class-destination-ftp-pro.php:25
|
1061 |
#: inc/features/class-destination-sugarsync-pro.php:17
|
1062 |
+
#: inc/features/class-jobtype-dbdump-pro.php:122
|
1063 |
#@ backwpup
|
1064 |
msgid "Password:"
|
1065 |
msgstr "Passwort:"
|
1115 |
msgid "SugarSync API: %s"
|
1116 |
msgstr "SugarSync API: %s"
|
1117 |
|
1118 |
+
#: inc/class-page-settings.php:387
|
1119 |
#@ backwpup
|
1120 |
msgid "Response Test O.K."
|
1121 |
msgstr "Response Test O.K."
|
1140 |
msgid "News"
|
1141 |
msgstr "Neuigkeiten"
|
1142 |
|
1143 |
+
#: inc/class-install.php:49
|
1144 |
#@ backwpup
|
1145 |
msgid "BackWPup Admin"
|
1146 |
msgstr "BackWPup Admin"
|
1147 |
|
1148 |
+
#: inc/class-install.php:62
|
1149 |
#@ backwpup
|
1150 |
msgid "BackWPup jobs checker"
|
1151 |
msgstr "BackWPup Auftragsprüfung"
|
1152 |
|
1153 |
+
#: inc/class-install.php:75
|
1154 |
#@ backwpup
|
1155 |
msgid "BackWPup jobs helper"
|
1156 |
msgstr "BackWPup Auftragshelfer"
|
1157 |
|
1158 |
+
#: inc/class-job.php:161
|
1159 |
#@ backwpup
|
1160 |
msgid "Starting job"
|
1161 |
msgstr "Auftrag starten"
|
1162 |
|
1163 |
+
#: inc/class-job.php:212
|
1164 |
#@ backwpup
|
1165 |
msgid "Creates archive"
|
1166 |
msgstr "erstellt Archiv"
|
1167 |
|
1168 |
+
#: inc/class-job.php:244
|
1169 |
#@ backwpup
|
1170 |
msgid "Job End"
|
1171 |
msgstr "Auftragsende"
|
1172 |
|
1173 |
+
#: inc/class-job.php:250
|
1174 |
#, php-format
|
1175 |
#@ backwpup
|
1176 |
msgid "BackWPup log for %1$s from %2$s at %3$s"
|
1177 |
msgstr "BackWPup-Protokoll für %1$s von %2$s am %3$s"
|
1178 |
|
1179 |
+
#: inc/class-job.php:269
|
1180 |
#@ backwpup
|
1181 |
msgid "[INFO] This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions."
|
1182 |
msgstr "[INFO] Dieses Programm leistet ABSOLUT KEINE GEWÄHR. Dies ist eine freie Software und es steht frei, diese unter gleichen Konditionen weiterzuentwickeln."
|
1183 |
|
1184 |
+
#: inc/class-job.php:270
|
1185 |
#, php-format
|
1186 |
#@ backwpup
|
1187 |
msgid "[INFO] BackWPup job: %1$s; %2$s"
|
1188 |
msgstr "[INFO] BackWPup-Auftrag: %1$s; %2$s"
|
1189 |
|
1190 |
+
#: inc/class-job.php:272
|
1191 |
#@ backwpup
|
1192 |
msgid "[INFO] BackWPup cron:"
|
1193 |
msgstr "[INFO] BackWPup Cron:"
|
1194 |
|
1195 |
+
#: inc/class-job.php:274
|
1196 |
#@ backwpup
|
1197 |
msgid "[INFO] BackWPup job started from wp-cron"
|
1198 |
msgstr "[INFO] BackWPup-Auftrag wurde per wp-cron gestartet"
|
1199 |
|
1200 |
+
#: inc/class-job.php:276
|
1201 |
#@ backwpup
|
1202 |
msgid "[INFO] BackWPup job started manually"
|
1203 |
msgstr "[INFO] BackWPup-Auftrag wurde manuell gestartet"
|
1204 |
|
1205 |
+
#: inc/class-job.php:278
|
1206 |
#@ backwpup
|
1207 |
msgid "[INFO] BackWPup job started from external url"
|
1208 |
msgstr "[INFO] BackWPup Auftrag wurde von externer URL gestartet"
|
1209 |
|
1210 |
+
#: inc/class-job.php:281
|
1211 |
#@ backwpup
|
1212 |
msgid "[INFO] PHP ver.:"
|
1213 |
msgstr "[INFO] PHP ver.:"
|
1214 |
|
1215 |
+
#: inc/class-job.php:283
|
1216 |
#, php-format
|
1217 |
#@ backwpup
|
1218 |
msgid "[INFO] MySQL ver.: %s"
|
1219 |
msgstr "[INFO] MySQL ver.: %s"
|
1220 |
|
1221 |
+
#: inc/class-job.php:286
|
1222 |
#, php-format
|
1223 |
#@ backwpup
|
1224 |
msgid "[INFO] curl ver.: %1$s; %2$s"
|
1225 |
msgstr "[INFO] curl ver.: %1$s; %2$s"
|
1226 |
|
1227 |
+
#: inc/class-job.php:288
|
1228 |
#, php-format
|
1229 |
#@ backwpup
|
1230 |
msgid "[INFO] Temp folder is: %s"
|
1231 |
msgstr "[INFO] Temp Ordner ist: %s"
|
1232 |
|
1233 |
+
#: inc/class-job.php:289
|
1234 |
#, php-format
|
1235 |
#@ backwpup
|
1236 |
msgid "[INFO] Logfile folder is: %s"
|
1237 |
msgstr "[INFO] Logdatei Ordner ist: %s"
|
1238 |
|
1239 |
+
#: inc/class-job.php:290
|
1240 |
#, php-format
|
1241 |
#@ backwpup
|
1242 |
msgid "[INFO] Backup type is: %s"
|
1243 |
msgstr "[INFO] Backup Typ ist: %s"
|
1244 |
|
1245 |
+
#: inc/class-job.php:292
|
1246 |
#, php-format
|
1247 |
#@ backwpup
|
1248 |
msgid "[INFO] Backup file is: %s"
|
1250 |
|
1251 |
#: inc/class-job.php:438
|
1252 |
#: inc/class-job.php:439
|
1253 |
+
#: inc/class-job.php:518
|
1254 |
+
#: inc/class-job.php:519
|
1255 |
+
#: inc/class-job.php:570
|
1256 |
#@ backwpup
|
1257 |
msgid "Wrong BackWPup JobID"
|
1258 |
msgstr "Falsche BackWPup JobID"
|
1259 |
|
1260 |
#: inc/class-job.php:443
|
1261 |
#: inc/class-job.php:444
|
1262 |
+
#: inc/class-job.php:524
|
1263 |
+
#: inc/class-job.php:576
|
1264 |
#@ backwpup
|
1265 |
msgid "Log folder does not exist or is not writable for BackWPup"
|
1266 |
msgstr "Log-Ordner existiert nicht oder ist nicht beschreibbar für BackWPup"
|
1267 |
|
1268 |
#: inc/class-job.php:447
|
1269 |
#: inc/class-job.php:448
|
1270 |
+
#: inc/class-job.php:528
|
1271 |
+
#: inc/class-job.php:581
|
1272 |
#@ backwpup
|
1273 |
msgid "Temp folder does not exist or is not writable for BackWPup"
|
1274 |
msgstr "Temp Ordner existiert nicht oder ist nicht beschreibbar für BackWPup!"
|
1281 |
|
1282 |
#: inc/class-job.php:462
|
1283 |
#: inc/class-job.php:463
|
1284 |
+
#: inc/class-job.php:532
|
1285 |
+
#: inc/class-job.php:533
|
1286 |
+
#: inc/class-job.php:588
|
1287 |
#@ backwpup
|
1288 |
msgid "A BackWPup job is already running"
|
1289 |
msgstr "Es läuft bereits ein BackWPup-Auftrag"
|
1290 |
|
1291 |
+
#: inc/class-job.php:523
|
1292 |
#@ backwpup
|
1293 |
msgid "Log folder does not exist or is not writable"
|
1294 |
msgstr "Log-Ordner existiert nicht oder ist nicht beschreibbar"
|
1295 |
|
1296 |
+
#: inc/class-job.php:527
|
1297 |
#@ backwpup
|
1298 |
msgid "Temp folder does not exist or is not writable"
|
1299 |
msgstr "Temp Ordner existiert nicht oder ist nicht beschreibbar"
|
1300 |
|
1301 |
+
#: inc/class-job.php:620
|
1302 |
#@ backwpup
|
1303 |
msgid "Job restart due to inactivity for more than 5 minutes."
|
1304 |
msgstr "Auftrag durch Inaktivität von mehr als 5 Minuten neu gestartet"
|
1305 |
|
1306 |
+
#: inc/class-job.php:731
|
1307 |
#@ backwpup
|
1308 |
msgid "Step aborted: too many attempts!"
|
1309 |
msgstr "Schritt abgebrochen durch zu viele Versuche!"
|
1310 |
|
1311 |
+
#: inc/class-job.php:904
|
1312 |
#, php-format
|
1313 |
#@ backwpup
|
1314 |
msgid "Please use another folder: %1$s"
|
1315 |
msgstr "Bitte einen anderen Ordner auswählen: %1$s"
|
1316 |
|
1317 |
+
#: inc/class-job.php:911
|
1318 |
#, php-format
|
1319 |
#@ backwpup
|
1320 |
msgid "Cannot create folder: %1$s"
|
1321 |
msgstr "Kann keinen Ordner erstellen: %1$s"
|
1322 |
|
1323 |
+
#: inc/class-job.php:919
|
1324 |
#, php-format
|
1325 |
#@ backwpup
|
1326 |
msgid "Folder \"%1$s\" is not writable"
|
1327 |
msgstr "Ordner \"%1$s\" ist nicht beschreibbar"
|
1328 |
|
1329 |
+
#: inc/class-job.php:944
|
1330 |
#, php-format
|
1331 |
#@ backwpup
|
1332 |
msgid "Exception caught in %1$s: %2$s"
|
1333 |
msgstr "Ausnahme eingefangen in %1$s: %2$s"
|
1334 |
|
1335 |
+
#: inc/class-job.php:1001
|
1336 |
+
#: inc/class-page-jobs.php:639
|
1337 |
#@ backwpup
|
1338 |
msgid "WARNING:"
|
1339 |
msgstr "WARNUNG:"
|
1340 |
|
1341 |
+
#: inc/class-job.php:1014
|
1342 |
#@ backwpup
|
1343 |
msgid "DEPRECATED:"
|
1344 |
msgstr "ABGELEHNT:"
|
1345 |
|
1346 |
+
#: inc/class-job.php:1017
|
1347 |
#@ backwpup
|
1348 |
msgid "STRICT NOTICE:"
|
1349 |
msgstr "EXAKTE NOTIZ:"
|
1350 |
|
1351 |
+
#: inc/class-job.php:1020
|
1352 |
#@ backwpup
|
1353 |
msgid "RECOVERABLE ERROR:"
|
1354 |
msgstr "WIEDERHERSTELLUNGS FEHLER:"
|
1355 |
|
1356 |
+
#: inc/class-job.php:1155
|
1357 |
#, php-format
|
1358 |
#@ backwpup
|
1359 |
msgid "One old log deleted"
|
1361 |
msgstr[0] "Eine alte Log-Datei gelöscht"
|
1362 |
msgstr[1] "%d alte Log-Dateien gelöscht"
|
1363 |
|
1364 |
+
#: inc/class-job.php:1165
|
1365 |
+
#: inc/class-page-jobs.php:641
|
1366 |
#, php-format
|
1367 |
#@ backwpup
|
1368 |
msgid "Job done in %s seconds."
|
1369 |
msgstr "Auftrag erledigt in %s Sekunden."
|
1370 |
|
1371 |
+
#: inc/class-job.php:1231
|
1372 |
#@ backwpup
|
1373 |
msgid "SUCCESSFUL"
|
1374 |
msgstr "ERFOLGREICH"
|
1375 |
|
1376 |
+
#: inc/class-job.php:1234
|
1377 |
#@ backwpup
|
1378 |
msgid "WARNING"
|
1379 |
msgstr "WARNUNG"
|
1380 |
|
1381 |
+
#: inc/class-job.php:1579
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1382 |
#, php-format
|
1383 |
#@ backwpup
|
1384 |
msgid "File \"%s\" is not readable!"
|
1385 |
msgstr "Datei \"%s\" ist nicht lesbar!"
|
1386 |
|
1387 |
+
#: inc/class-job.php:1581
|
1388 |
#, php-format
|
1389 |
#@ backwpup
|
1390 |
msgid "Link \"%s\" not followed."
|
1391 |
msgstr "Link \"%s\" wird nicht gefolgt"
|
1392 |
|
1393 |
+
#: inc/class-create-archive.php:281
|
1394 |
+
#: inc/class-create-archive.php:345
|
1395 |
#, php-format
|
1396 |
#@ backwpup
|
1397 |
msgid "Cannot add \"%s\" to zip archive!"
|
1398 |
msgstr "\"%s\" kann dem ZIP-Archiv nicht hinzugefügt werden!"
|
1399 |
|
1400 |
+
#: inc/class-create-archive.php:369
|
1401 |
#@ backwpup
|
1402 |
msgid "(ER_MULTIDISK) Multi-disk zip archives not supported"
|
1403 |
msgstr "(ER_MULTIDISK) Multi-Disk .zip Archive werden nicht unterstützt"
|
1404 |
|
1405 |
+
#: inc/class-create-archive.php:370
|
1406 |
#@ backwpup
|
1407 |
msgid "(ER_RENAME) Renaming temporary file failed"
|
1408 |
msgstr "(ER_RENAME) Umbenennen der temporärern Dateien gescheitert."
|
1409 |
|
1410 |
+
#: inc/class-create-archive.php:371
|
1411 |
#@ backwpup
|
1412 |
msgid "(ER_CLOSE) Closing zip archive failed"
|
1413 |
msgstr "(ER_CLOSE) Schließen der .zip Archive gescheitert"
|
1414 |
|
1415 |
+
#: inc/class-create-archive.php:372
|
1416 |
#@ backwpup
|
1417 |
msgid "(ER_SEEK) Seek error"
|
1418 |
msgstr "(ER_SEEK) Such-Fehler"
|
1419 |
|
1420 |
+
#: inc/class-create-archive.php:373
|
1421 |
#@ backwpup
|
1422 |
msgid "(ER_READ) Read error"
|
1423 |
msgstr "(ER_READ) Lese-Fehler"
|
1424 |
|
1425 |
+
#: inc/class-create-archive.php:374
|
1426 |
#@ backwpup
|
1427 |
msgid "(ER_WRITE) Write error"
|
1428 |
msgstr "(ER_WRITE) Schreib-Fehler"
|
1429 |
|
1430 |
+
#: inc/class-create-archive.php:375
|
1431 |
#@ backwpup
|
1432 |
msgid "(ER_CRC) CRC error"
|
1433 |
msgstr "(ER_CRC) CRC Fehler"
|
1434 |
|
1435 |
+
#: inc/class-create-archive.php:376
|
1436 |
#@ backwpup
|
1437 |
msgid "(ER_ZIPCLOSED) Containing zip archive was closed"
|
1438 |
msgstr "(ER_ZIPCLOSED) beinhaltetendes .zip Archiv war geschlossen"
|
1439 |
|
1440 |
+
#: inc/class-create-archive.php:377
|
1441 |
#@ backwpup
|
1442 |
msgid "(ER_NOENT) No such file"
|
1443 |
msgstr "(ER_NOENT) keine passende Datei"
|
1444 |
|
1445 |
+
#: inc/class-create-archive.php:378
|
1446 |
#@ backwpup
|
1447 |
msgid "(ER_EXISTS) File already exists"
|
1448 |
msgstr "(ER_EXISTS) Datei exisitiert bereits"
|
1449 |
|
1450 |
+
#: inc/class-create-archive.php:379
|
1451 |
#@ backwpup
|
1452 |
msgid "(ER_OPEN) Can't open file"
|
1453 |
msgstr "(ER_OPEN) Kann die Datei nicht öffnen"
|
1454 |
|
1455 |
+
#: inc/class-create-archive.php:380
|
1456 |
#@ backwpup
|
1457 |
msgid "(ER_TMPOPEN) Failure to create temporary file"
|
1458 |
msgstr "(ER_TMPOPEN) Erstellen einer temporären Datei fehlgeschlagen"
|
1459 |
|
1460 |
+
#: inc/class-create-archive.php:381
|
1461 |
#@ backwpup
|
1462 |
msgid "(ER_ZLIB) Zlib error"
|
1463 |
msgstr "(ER_ZLIB) Zlib Fehler"
|
1464 |
|
1465 |
+
#: inc/class-create-archive.php:382
|
1466 |
#@ backwpup
|
1467 |
msgid "(ER_MEMORY) Malloc failure"
|
1468 |
msgstr "(ER_MEMORY) Malloc Fehler"
|
1469 |
|
1470 |
+
#: inc/class-create-archive.php:383
|
1471 |
#@ backwpup
|
1472 |
msgid "(ER_CHANGED) Entry has been changed"
|
1473 |
msgstr "(ER_CHANGED) Eintrag wurde geändert"
|
1474 |
|
1475 |
+
#: inc/class-create-archive.php:384
|
1476 |
#@ backwpup
|
1477 |
msgid "(ER_COMPNOTSUPP) Compression method not supported"
|
1478 |
msgstr "(ER_COMPNOTSUPP) Kompressionsmethode nicht unterstützt"
|
1479 |
|
1480 |
+
#: inc/class-create-archive.php:385
|
1481 |
#@ backwpup
|
1482 |
msgid "(ER_EOF) Premature EOF"
|
1483 |
msgstr "(ER_EOF) verfrühtes EOF"
|
1484 |
|
1485 |
+
#: inc/class-create-archive.php:386
|
1486 |
#@ backwpup
|
1487 |
msgid "(ER_INVAL) Invalid argument"
|
1488 |
msgstr "(ER_INVAL) ungültiges Argument"
|
1489 |
|
1490 |
+
#: inc/class-create-archive.php:387
|
1491 |
#@ backwpup
|
1492 |
msgid "(ER_NOZIP) Not a zip archive"
|
1493 |
msgstr "(ER_NOZIP) kein .zip Archiv"
|
1494 |
|
1495 |
+
#: inc/class-create-archive.php:388
|
1496 |
#@ backwpup
|
1497 |
msgid "(ER_INTERNAL) Internal error"
|
1498 |
msgstr "(ER_INTERNAL) Interner Fehler"
|
1499 |
|
1500 |
+
#: inc/class-create-archive.php:389
|
1501 |
#@ backwpup
|
1502 |
msgid "(ER_INCONS) Zip archive inconsistent"
|
1503 |
msgstr "(ER_INCONS) .zip Archiv inkonsistent"
|
1504 |
|
1505 |
+
#: inc/class-create-archive.php:390
|
1506 |
#@ backwpup
|
1507 |
msgid "(ER_REMOVE) Can't remove file"
|
1508 |
msgstr "(ER_REMOVE) Datei kann nicht entfernt werden"
|
1509 |
|
1510 |
+
#: inc/class-create-archive.php:391
|
1511 |
#@ backwpup
|
1512 |
msgid "(ER_DELETED) Entry has been deleted"
|
1513 |
msgstr "(ER_DELETED) Eintrag wurde gelöscht"
|
1514 |
|
1515 |
+
#: inc/class-job.php:1683
|
1516 |
#, php-format
|
1517 |
#@ backwpup
|
1518 |
msgid "Archive size is %s."
|
1519 |
msgstr "Archivgröße ist %s"
|
1520 |
|
1521 |
+
#: inc/class-job.php:1684
|
1522 |
#, php-format
|
1523 |
#@ backwpup
|
1524 |
msgid "%1$d Files with %2$s in Archive."
|
1525 |
msgstr "%1$d Dateien mit %2$s in Archiven."
|
1526 |
|
1527 |
+
#: inc/class-create-archive.php:418
|
1528 |
#, php-format
|
1529 |
#@ backwpup
|
1530 |
msgid "File name \"%1$s\" too long to be saved correctly in %2$s archive!"
|
1531 |
msgstr "Dateiname \"%1$s\" ist zu lang, um korrekt im %2$s Archiv zu speichern."
|
1532 |
|
1533 |
+
#: inc/class-create-archive.php:420
|
1534 |
#, php-format
|
1535 |
#@ backwpup
|
1536 |
msgid "File path \"%1$s\" too long to be saved correctly in %2$s archive!"
|
1537 |
msgstr "Dateipfad \"%1$s\" ist zu lang, um korrekt in %2$s Archiv zu speichern"
|
1538 |
|
1539 |
+
#: inc/class-create-archive.php:430
|
1540 |
+
#: inc/class-create-archive.php:431
|
1541 |
+
#: inc/class-create-archive.php:514
|
1542 |
+
#: inc/class-create-archive.php:515
|
1543 |
#@ backwpup
|
1544 |
msgid "Unknown"
|
1545 |
msgstr "Unbekannt"
|
1572 |
msgstr "Teste nur die WordPress-Tabellen"
|
1573 |
|
1574 |
#: inc/class-jobtype-dbcheck.php:49
|
|
|
|
|
1575 |
#: inc/features/class-jobtype-dbcheck-pro.php:25
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1576 |
#@ backwpup
|
1577 |
msgid "Repair"
|
1578 |
msgstr "Reparieren"
|
1579 |
|
1580 |
+
#: inc/class-jobtype-dbcheck.php:54
|
1581 |
+
#: inc/features/class-jobtype-dbcheck-pro.php:29
|
1582 |
#@ backwpup
|
1583 |
msgid "Try to repair defect table"
|
1584 |
msgstr "Versuche, definierte Tabellen zu reparieren"
|
1585 |
|
1586 |
+
#: inc/class-jobtype-dbcheck.php:116
|
1587 |
#, php-format
|
1588 |
#@ backwpup
|
1589 |
msgid "Table %1$s is not a MyISAM/InnoDB table. Not checked."
|
1590 |
msgstr "Tabelle %1$s ist keine MyISAM/InnoDB Tabelle. Nicht geprüft"
|
1591 |
|
1592 |
+
#: inc/class-jobtype-dbcheck.php:123
|
1593 |
+
#: inc/class-jobtype-dbcheck.php:125
|
1594 |
+
#: inc/class-jobtype-dbcheck.php:127
|
1595 |
#, php-format
|
1596 |
#@ backwpup
|
1597 |
msgid "Result of table check for %1$s is: %2$s"
|
1598 |
msgstr "Ergebnis der Tabellenprüfung für %1$s ist: %2$s"
|
1599 |
|
1600 |
+
#: inc/class-jobtype-dbcheck.php:133
|
1601 |
+
#: inc/class-jobtype-dbcheck.php:135
|
1602 |
+
#: inc/class-jobtype-dbcheck.php:137
|
1603 |
#, php-format
|
1604 |
#@ backwpup
|
1605 |
msgid "Result of table repair for %1$s is: %2$s"
|
1606 |
msgstr "Ergebnis der Tabellenreparatur für %1$s ist: %2$s"
|
1607 |
|
1608 |
+
#: inc/class-jobtype-dbcheck.php:142
|
1609 |
#@ backwpup
|
1610 |
msgid "Database check done!"
|
1611 |
msgstr "Datenbank-Check fertig!"
|
1612 |
|
1613 |
+
#: inc/class-jobtype-dbcheck.php:145
|
1614 |
#@ backwpup
|
1615 |
msgid "No tables to check."
|
1616 |
msgstr "Keine Tabellen zum checken."
|
1620 |
msgid "Database backup"
|
1621 |
msgstr "Datenbank Backup"
|
1622 |
|
1623 |
+
#: inc/features/class-jobtype-dbdump-pro.php:81
|
1624 |
#@ backwpup
|
1625 |
msgid "Settings for database dump"
|
1626 |
msgstr "Einstellungen für das Datenbank-Backup"
|
1627 |
|
1628 |
+
#: inc/class-jobtype-dbdump.php:67
|
1629 |
+
#: inc/features/class-jobtype-dbdump-pro.php:152
|
1630 |
#@ backwpup
|
1631 |
msgid "all"
|
1632 |
msgstr "alle"
|
1633 |
|
1634 |
+
#: inc/class-jobtype-dbdump.php:92
|
1635 |
+
#: inc/features/class-jobtype-dbdump-pro.php:192
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1636 |
#@ backwpup
|
1637 |
msgid "Dumpfile name"
|
1638 |
msgstr "Name der Backup-Datei"
|
1639 |
|
1640 |
+
#: inc/class-jobtype-dbdump.php:100
|
1641 |
+
#: inc/features/class-jobtype-dbdump-pro.php:200
|
1642 |
#@ backwpup
|
1643 |
msgid "Dumpfile compression"
|
1644 |
msgstr "Kompression der Backup-Datei"
|
1645 |
|
1646 |
+
#: inc/class-jobtype-dbdump.php:105
|
1647 |
+
#: inc/class-jobtype-dbdump.php:107
|
1648 |
#: inc/class-jobtype-wpexp.php:72
|
1649 |
#: inc/class-jobtype-wpexp.php:74
|
1650 |
#: inc/class-jobtype-wpplugin.php:58
|
1651 |
#: inc/class-jobtype-wpplugin.php:60
|
1652 |
+
#: inc/features/class-jobtype-dbdump-pro.php:205
|
1653 |
+
#: inc/features/class-jobtype-dbdump-pro.php:207
|
1654 |
#@ backwpup
|
1655 |
msgid "GZip"
|
1656 |
msgstr "GZip"
|
1657 |
|
1658 |
+
#: inc/class-jobtype-dbdump.php:109
|
1659 |
+
#: inc/class-jobtype-dbdump.php:111
|
1660 |
#: inc/class-jobtype-wpexp.php:76
|
1661 |
#: inc/class-jobtype-wpexp.php:78
|
1662 |
#: inc/class-jobtype-wpplugin.php:62
|
1663 |
#: inc/class-jobtype-wpplugin.php:64
|
1664 |
+
#: inc/features/class-jobtype-dbdump-pro.php:209
|
1665 |
+
#: inc/features/class-jobtype-dbdump-pro.php:211
|
1666 |
#@ backwpup
|
1667 |
msgid "BZip2"
|
1668 |
msgstr "BZip2"
|
1669 |
|
1670 |
+
#: inc/class-jobtype-dbdump.php:167
|
1671 |
+
#: inc/features/class-jobtype-dbdump-pro.php:470
|
1672 |
+
#: inc/features/class-jobtype-dbdump-pro.php:673
|
1673 |
#, php-format
|
1674 |
#@ backwpup
|
1675 |
msgid "Connected to database %1$s on %2$s"
|
1676 |
msgstr "Mit Datenbank %1$s auf %2$s verbunden"
|
1677 |
|
1678 |
+
#: inc/class-mysqldump.php:132
|
1679 |
+
#: inc/class-mysqldump.php:143
|
1680 |
+
#: inc/class-mysqldump.php:222
|
1681 |
+
#: inc/class-mysqldump.php:235
|
1682 |
+
#: inc/class-mysqldump.php:249
|
1683 |
+
#: inc/class-mysqldump.php:262
|
1684 |
+
#: inc/class-mysqldump.php:302
|
1685 |
+
#: inc/class-mysqldump.php:324
|
1686 |
+
#: inc/class-mysqldump.php:339
|
1687 |
+
#: inc/features/class-jobtype-dbdump-pro.php:679
|
1688 |
+
#: inc/features/class-jobtype-dbdump-pro.php:693
|
1689 |
+
#: inc/features/class-jobtype-dbdump-pro.php:742
|
1690 |
+
#: inc/features/class-jobtype-dbdump-pro.php:759
|
1691 |
+
#: inc/features/class-jobtype-dbdump-pro.php:800
|
1692 |
#, php-format
|
1693 |
#@ backwpup
|
1694 |
msgid "Database error %1$s for query %2$s"
|
1695 |
msgstr "Datenbankfehler %1$s für die Abfrage (Query) %2$s"
|
1696 |
|
1697 |
+
#: inc/class-jobtype-dbdump.php:179
|
1698 |
+
#: inc/features/class-jobtype-dbdump-pro.php:483
|
1699 |
#@ backwpup
|
1700 |
msgid "No tables to dump."
|
1701 |
msgstr "Es gibt keine Tabellen zu sichern"
|
1702 |
|
1703 |
+
#: inc/class-jobtype-dbdump.php:188
|
1704 |
+
#: inc/features/class-jobtype-dbdump-pro.php:495
|
1705 |
#, php-format
|
1706 |
#@ backwpup
|
1707 |
msgid "Dump database table \"%s\""
|
1708 |
msgstr "Sichere Datenbanktabelle \"%s\""
|
1709 |
|
1710 |
+
#: inc/class-jobtype-dbdump.php:211
|
1711 |
+
#: inc/features/class-jobtype-dbdump-pro.php:518
|
1712 |
+
#: inc/features/class-jobtype-dbdump-pro.php:630
|
1713 |
#@ backwpup
|
1714 |
msgid "Database dump done!"
|
1715 |
msgstr "Datenbank-Backup fertig!"
|
1735 |
msgid "Optimize WordPress Database tables only"
|
1736 |
msgstr "Optimiere nur WordPress Datenbank Tabellen"
|
1737 |
|
1738 |
+
#: inc/class-jobtype-dboptimize.php:50
|
1739 |
+
#: inc/class-jobtype-dboptimize.php:53
|
|
|
|
|
|
|
|
|
|
|
1740 |
#@ backwpup
|
1741 |
msgid "Table types to optimize"
|
1742 |
msgstr "Tabellen-Typen zum Optimieren"
|
1743 |
|
1744 |
+
#: inc/class-jobtype-dboptimize.php:57
|
1745 |
#@ backwpup
|
1746 |
msgid "Optimize MyISAM Tables"
|
1747 |
msgstr "Optimiere MyISAM Tabellen"
|
1748 |
|
1749 |
+
#: inc/class-jobtype-dboptimize.php:62
|
1750 |
#@ backwpup
|
1751 |
msgid "Optimize InnoDB tables"
|
1752 |
msgstr "Optimiere InnoDB Tabellen"
|
1753 |
|
1754 |
+
#: inc/class-jobtype-dboptimize.php:63
|
1755 |
#@ backwpup
|
1756 |
msgid "Optimize will done with ALTER TABLE `table` ENGINE=InnoDB"
|
1757 |
msgstr "Optimierung wird erledigt mit ALTER TABLE `table` ENGINE=InnoDB "
|
1758 |
|
1759 |
+
#: inc/class-jobtype-dboptimize.php:126
|
1760 |
+
#: inc/class-jobtype-dboptimize.php:128
|
1761 |
+
#: inc/class-jobtype-dboptimize.php:130
|
1762 |
#, php-format
|
1763 |
#@ backwpup
|
1764 |
msgid "Result of MyISAM table optimize for %1$s is: %2$s"
|
1765 |
msgstr "Ergebnis der MyISAM Tabellen Optmierung für %1$s ist: %2$s"
|
1766 |
|
1767 |
+
#: inc/class-jobtype-dboptimize.php:135
|
1768 |
#, php-format
|
1769 |
#@ backwpup
|
1770 |
msgid "InnoDB Table %1$s optimizing done."
|
1771 |
msgstr "InnoDB-Tabelle %1$s: Optimierung abgeschlossen."
|
1772 |
|
1773 |
+
#: inc/class-jobtype-dboptimize.php:138
|
1774 |
#, php-format
|
1775 |
#@ backwpup
|
1776 |
msgid "%2$s table %1$s not optimized."
|
1777 |
msgstr "%2$s Tabelle %1$s ist nicht optimiert."
|
1778 |
|
1779 |
+
#: inc/class-jobtype-dboptimize.php:146
|
1780 |
#@ backwpup
|
1781 |
msgid "No tables to optimize."
|
1782 |
msgstr "Es gibt keine Datenbanktabellen zum Optimieren."
|
1895 |
msgid "Added plugin list file \"%1$s\" with %2$s to backup file list."
|
1896 |
msgstr "Plugin Listendatei \"%1$s\" mit %2$s zur Backup Dateiliste hinzugefügt."
|
1897 |
|
1898 |
+
#: inc/class-page-backups.php:159
|
1899 |
+
#: inc/class-page-backups.php:288
|
1900 |
#: inc/class-page-jobs.php:56
|
1901 |
#: inc/class-page-jobs.php:130
|
1902 |
#: inc/class-page-logs.php:103
|
1905 |
msgid "Delete"
|
1906 |
msgstr "Löschen"
|
1907 |
|
1908 |
+
#: inc/class-page-backups.php:189
|
1909 |
#@ backwpup
|
1910 |
msgid "Change destination"
|
1911 |
msgstr "Ziel ändern"
|
1912 |
|
1913 |
+
#: inc/class-page-backups.php:227
|
1914 |
#@ backwpup
|
1915 |
msgid "File"
|
1916 |
msgstr "Datei"
|
1917 |
|
1918 |
+
#: inc/class-page-backups.php:229
|
1919 |
#: inc/class-page-logs.php:118
|
1920 |
#@ backwpup
|
1921 |
msgid "Size"
|
1922 |
msgstr "Größe"
|
1923 |
|
1924 |
+
#: inc/class-page-backups.php:230
|
1925 |
+
#: inc/class-page-backwpup.php:176
|
1926 |
+
#: inc/class-page-backwpup.php:237
|
1927 |
#@ backwpup
|
1928 |
msgid "Time"
|
1929 |
msgstr "Zeit"
|
1930 |
|
1931 |
+
#: inc/class-page-backups.php:290
|
1932 |
#: inc/class-page-jobs.php:219
|
1933 |
#: inc/class-page-logs.php:186
|
1934 |
#@ backwpup
|
1935 |
msgid "Download"
|
1936 |
msgstr "Herunterladen"
|
1937 |
|
1938 |
+
#: inc/class-page-backups.php:305
|
1939 |
#@ backwpup
|
1940 |
msgid "?"
|
1941 |
msgstr "?"
|
1942 |
|
1943 |
+
#: inc/class-page-backups.php:412
|
1944 |
#, php-format
|
1945 |
#@ backwpup
|
1946 |
msgid "%s Manage Backup Archives"
|
1962 |
msgid "Welcome to BackWPup"
|
1963 |
msgstr "Willkommen bei BackWPup"
|
1964 |
|
1965 |
+
#: inc/class-page-backwpup.php:122
|
1966 |
+
#: inc/features/class-page-wizard.php:256
|
1967 |
#@ backwpup
|
1968 |
msgid "Start wizard"
|
1969 |
msgstr "Assistenten starten"
|
1970 |
|
1971 |
+
#: inc/class-page-backwpup.php:135
|
1972 |
#@ backwpup
|
1973 |
msgid "Test the installation"
|
1974 |
msgstr "Die Installation testen"
|
1975 |
|
1976 |
+
#: inc/class-page-backwpup.php:136
|
1977 |
+
#: inc/class-page-backwpup.php:139
|
1978 |
#@ backwpup
|
1979 |
msgid "Create a Job"
|
1980 |
msgstr "Auftrag erstellen"
|
1981 |
|
1982 |
+
#: inc/class-page-backwpup.php:141
|
1983 |
#@ backwpup
|
1984 |
msgid "Run the created job"
|
1985 |
msgstr "Erstellten Auftrag starten"
|
1986 |
|
1987 |
+
#: inc/class-page-backwpup.php:142
|
1988 |
#@ backwpup
|
1989 |
msgid "Check the job log"
|
1990 |
msgstr "Logs des Auftrages prüfen"
|
1991 |
|
1992 |
+
#: inc/class-page-backwpup.php:235
|
1993 |
#@ backwpup
|
1994 |
msgid "Next scheduled jobs"
|
1995 |
msgstr "Nächste geplante Aufträge"
|
1996 |
|
1997 |
+
#: inc/class-page-backwpup.php:176
|
1998 |
+
#: inc/class-page-backwpup.php:238
|
1999 |
#: inc/class-page-logs.php:114
|
2000 |
#@ backwpup
|
2001 |
msgid "Job"
|
2002 |
msgstr "Auftrag"
|
2003 |
|
2004 |
+
#: inc/class-page-backwpup.php:261
|
2005 |
#, php-format
|
2006 |
#@ backwpup
|
2007 |
msgid "working since %d seconds"
|
2008 |
msgstr "in Arbeit seit %d Sek."
|
2009 |
|
2010 |
+
#: inc/class-page-backwpup.php:263
|
2011 |
+
#: inc/class-page-jobs.php:493
|
2012 |
#@ backwpup
|
2013 |
msgid "Abort"
|
2014 |
msgstr "Abbrechen"
|
2015 |
|
2016 |
+
#: inc/class-page-backwpup.php:279
|
2017 |
#@ backwpup
|
2018 |
msgid "Edit Job"
|
2019 |
msgstr "Auftrag bearbeiten"
|
2020 |
|
2021 |
+
#: inc/class-page-backwpup.php:175
|
2022 |
#@ backwpup
|
2023 |
msgid "Last logs"
|
2024 |
msgstr "Letzte Logs"
|
2025 |
|
2026 |
+
#: inc/class-page-backwpup.php:176
|
2027 |
#@ backwpup
|
2028 |
msgid "Result"
|
2029 |
msgstr "Ergebnis"
|
2030 |
|
2031 |
+
#: inc/class-page-backwpup.php:206
|
2032 |
#, php-format
|
2033 |
#@ backwpup
|
2034 |
msgid "%d ERROR"
|
2036 |
msgstr[0] "%d FEHLER"
|
2037 |
msgstr[1] "%d FEHLER"
|
2038 |
|
2039 |
+
#: inc/class-page-backwpup.php:208
|
2040 |
#, php-format
|
2041 |
#@ backwpup
|
2042 |
msgid "%d WARNING"
|
2054 |
msgid "Overview"
|
2055 |
msgstr "Überblick"
|
2056 |
|
2057 |
+
#: inc/class-page-editjob.php:176
|
2058 |
#, php-format
|
2059 |
#@ backwpup
|
2060 |
msgid "Changes for job <i>%s</i> saved."
|
2061 |
msgstr "Änderungen für den Auftrag <i>%s</i> gesichert."
|
2062 |
|
2063 |
+
#: inc/class-page-editjob.php:318
|
2064 |
#, php-format
|
2065 |
#@ backwpup
|
2066 |
msgid "ATTENTION: Job runs every %d minutes!"
|
2067 |
msgstr "ACHTUNG: Auftrag läuft alle %d Minuten!"
|
2068 |
|
2069 |
+
#: inc/class-page-editjob.php:324
|
2070 |
#, php-format
|
2071 |
#@ backwpup
|
2072 |
msgid "ATTENTION: Job runs every %d hours!"
|
2073 |
msgstr "ACHTUNG: Auftrag läuft alle %d Stunden!"
|
2074 |
|
2075 |
+
#: inc/class-page-editjob.php:328
|
2076 |
#@ backwpup
|
2077 |
msgid "ATTENTION: Can't calculate cron!"
|
2078 |
msgstr "ACHTUNG: Kann cron nicht berechnen!"
|
2079 |
|
2080 |
+
#: inc/class-page-editjob.php:331
|
2081 |
#@ backwpup
|
2082 |
msgid "Next runtime:"
|
2083 |
msgstr "Nächster Durchlauf:"
|
2084 |
|
2085 |
+
#: inc/class-page-editjob.php:369
|
2086 |
#: inc/class-page-settings.php:103
|
2087 |
#@ backwpup
|
2088 |
msgid "General"
|
2089 |
msgstr "Allgemein"
|
2090 |
|
2091 |
+
#: inc/class-page-editjob.php:369
|
2092 |
#@ backwpup
|
2093 |
msgid "Schedule"
|
2094 |
msgstr "Planen"
|
2095 |
|
2096 |
+
#: inc/class-page-editjob.php:384
|
2097 |
#, php-format
|
2098 |
#@ backwpup
|
2099 |
msgid "To: %s"
|
2100 |
msgstr "Zu: %s"
|
2101 |
|
2102 |
+
#: inc/class-page-editjob.php:390
|
2103 |
#, php-format
|
2104 |
#@ backwpup
|
2105 |
msgid "%s Job:"
|
2106 |
msgstr "%s Auftrag: "
|
2107 |
|
2108 |
+
#: inc/class-page-editjob.php:436
|
2109 |
#: inc/features/class-wizard-job.php:228
|
2110 |
#@ backwpup
|
2111 |
msgid "Job tasks"
|
2112 |
msgstr "Auftragsdetails"
|
2113 |
|
2114 |
+
#: inc/class-page-editjob.php:457
|
2115 |
+
#: inc/class-page-editjob.php:460
|
2116 |
#: inc/features/class-wizard-job.php:350
|
2117 |
#: inc/features/class-wizard-job.php:353
|
2118 |
#@ backwpup
|
2124 |
msgid "Sync file by file to destination"
|
2125 |
msgstr "Synchronisiere Datei für Datei zum Zielverzeichnis"
|
2126 |
|
2127 |
+
#: inc/class-page-editjob.php:469
|
2128 |
#: inc/features/class-wizard-job.php:361
|
2129 |
#@ backwpup
|
2130 |
msgid "Create a backup archive"
|
2131 |
msgstr "Backup erstellen"
|
2132 |
|
2133 |
+
#: inc/class-page-editjob.php:515
|
2134 |
+
#: inc/class-page-editjob.php:518
|
2135 |
#@ backwpup
|
2136 |
msgid "Archive Format"
|
2137 |
msgstr "Archiv Format"
|
2138 |
|
2139 |
+
#: inc/class-page-editjob.php:521
|
2140 |
+
#: inc/class-page-editjob.php:523
|
2141 |
#: inc/features/class-wizard-job.php:371
|
2142 |
#: inc/features/class-wizard-job.php:373
|
2143 |
#@ backwpup
|
2151 |
msgid "Disabled because missing PHP function."
|
2152 |
msgstr "Aufgrund fehlender PHP Funktion deaktiviert."
|
2153 |
|
2154 |
+
#: inc/class-page-editjob.php:524
|
2155 |
#: inc/features/class-wizard-job.php:374
|
2156 |
#@ backwpup
|
2157 |
msgid "Tar"
|
2158 |
msgstr "Tar"
|
2159 |
|
2160 |
+
#: inc/class-page-editjob.php:526
|
2161 |
+
#: inc/class-page-editjob.php:528
|
2162 |
#: inc/features/class-wizard-job.php:376
|
2163 |
#: inc/features/class-wizard-job.php:378
|
2164 |
#@ backwpup
|
2165 |
msgid "Tar GZip"
|
2166 |
msgstr "Tar GZip"
|
2167 |
|
2168 |
+
#: inc/class-page-editjob.php:530
|
2169 |
+
#: inc/class-page-editjob.php:532
|
2170 |
#: inc/features/class-wizard-job.php:380
|
2171 |
#: inc/features/class-wizard-job.php:382
|
2172 |
#@ backwpup
|
2185 |
msgid "Destinations"
|
2186 |
msgstr "Zielordner"
|
2187 |
|
2188 |
+
#: inc/class-page-editjob.php:601
|
2189 |
+
#: inc/class-page-editjob.php:604
|
2190 |
#@ backwpup
|
2191 |
msgid "Start job"
|
2192 |
msgstr "Auftrag starten"
|
2193 |
|
2194 |
+
#: inc/class-page-editjob.php:608
|
2195 |
#@ backwpup
|
2196 |
msgid "manually only"
|
2197 |
msgstr "nur manuell"
|
2198 |
|
2199 |
+
#: inc/class-page-editjob.php:612
|
2200 |
#@ backwpup
|
2201 |
msgid "with WordPress cron"
|
2202 |
msgstr "mit WordPress Cron"
|
2203 |
|
2204 |
+
#: inc/class-page-editjob.php:619
|
2205 |
#@ backwpup
|
2206 |
msgid "with a link"
|
2207 |
msgstr "mit einem Link"
|
2208 |
|
2209 |
+
#: inc/class-page-editjob.php:637
|
2210 |
#@ backwpup
|
2211 |
msgid "Schedule execution time"
|
2212 |
msgstr "Plane Ausführungszeit"
|
2213 |
|
2214 |
+
#: inc/class-page-editjob.php:641
|
2215 |
+
#: inc/class-page-editjob.php:644
|
2216 |
#@ backwpup
|
2217 |
msgid "Scheduler type"
|
2218 |
msgstr "Planungstyp"
|
2219 |
|
2220 |
+
#: inc/class-page-editjob.php:649
|
2221 |
#@ backwpup
|
2222 |
msgid "basic"
|
2223 |
msgstr "einfach"
|
2224 |
|
2225 |
+
#: inc/class-page-editjob.php:653
|
2226 |
#@ backwpup
|
2227 |
msgid "advanced"
|
2228 |
msgstr "erweitert"
|
2229 |
|
2230 |
+
#: inc/class-page-editjob.php:682
|
2231 |
+
#: inc/class-page-editjob.php:750
|
2232 |
#: inc/features/class-wizard-job.php:275
|
2233 |
#@ backwpup
|
2234 |
msgid "Scheduler"
|
2235 |
msgstr "Planer"
|
2236 |
|
2237 |
+
#: inc/class-page-editjob.php:687
|
2238 |
#: inc/class-page-jobs.php:70
|
2239 |
#: inc/class-page-logs.php:115
|
2240 |
#: inc/features/class-wizard-job.php:280
|
2242 |
msgid "Type"
|
2243 |
msgstr "Typ"
|
2244 |
|
2245 |
+
#: inc/class-page-editjob.php:692
|
2246 |
#: inc/features/class-wizard-job.php:285
|
2247 |
#@ backwpup
|
2248 |
msgid "Hour"
|
2249 |
msgstr "Stunde"
|
2250 |
|
2251 |
+
#: inc/class-page-editjob.php:695
|
2252 |
#: inc/features/class-wizard-job.php:288
|
2253 |
#@ backwpup
|
2254 |
msgid "Minute"
|
2255 |
msgstr "Minute"
|
2256 |
|
2257 |
+
#: inc/class-page-editjob.php:699
|
2258 |
#: inc/features/class-wizard-job.php:292
|
2259 |
#@ backwpup
|
2260 |
msgid "monthly"
|
2261 |
msgstr "monatlich"
|
2262 |
|
2263 |
+
#: inc/class-page-editjob.php:701
|
2264 |
#: inc/features/class-wizard-job.php:294
|
2265 |
#@ backwpup
|
2266 |
msgid "on"
|
2267 |
msgstr "am"
|
2268 |
|
2269 |
+
#: inc/class-page-editjob.php:711
|
2270 |
#: inc/features/class-wizard-job.php:304
|
2271 |
#@ backwpup
|
2272 |
msgid "weekly"
|
2273 |
msgstr "wöchentlich"
|
2274 |
|
2275 |
+
#: inc/class-page-editjob.php:713
|
2276 |
+
#: inc/class-page-editjob.php:820
|
2277 |
#: inc/features/class-wizard-job.php:306
|
2278 |
#@ backwpup
|
2279 |
msgid "Sunday"
|
2280 |
msgstr "Sonntag"
|
2281 |
|
2282 |
+
#: inc/class-page-editjob.php:714
|
2283 |
+
#: inc/class-page-editjob.php:821
|
2284 |
#: inc/features/class-wizard-job.php:307
|
2285 |
#@ backwpup
|
2286 |
msgid "Monday"
|
2287 |
msgstr "Montag"
|
2288 |
|
2289 |
+
#: inc/class-page-editjob.php:715
|
2290 |
+
#: inc/class-page-editjob.php:822
|
2291 |
#: inc/features/class-wizard-job.php:308
|
2292 |
#@ backwpup
|
2293 |
msgid "Tuesday"
|
2294 |
msgstr "Dienstag"
|
2295 |
|
2296 |
+
#: inc/class-page-editjob.php:716
|
2297 |
+
#: inc/class-page-editjob.php:823
|
2298 |
#: inc/features/class-wizard-job.php:309
|
2299 |
#@ backwpup
|
2300 |
msgid "Wednesday"
|
2301 |
msgstr "Mittwoch"
|
2302 |
|
2303 |
+
#: inc/class-page-editjob.php:717
|
2304 |
+
#: inc/class-page-editjob.php:824
|
2305 |
#: inc/features/class-wizard-job.php:310
|
2306 |
#@ backwpup
|
2307 |
msgid "Thursday"
|
2308 |
msgstr "Donnerstag"
|
2309 |
|
2310 |
+
#: inc/class-page-editjob.php:718
|
2311 |
+
#: inc/class-page-editjob.php:825
|
2312 |
#: inc/features/class-wizard-job.php:311
|
2313 |
#@ backwpup
|
2314 |
msgid "Friday"
|
2315 |
msgstr "Freitag"
|
2316 |
|
2317 |
+
#: inc/class-page-editjob.php:719
|
2318 |
+
#: inc/class-page-editjob.php:826
|
2319 |
#: inc/features/class-wizard-job.php:312
|
2320 |
#@ backwpup
|
2321 |
msgid "Saturday"
|
2322 |
msgstr "Samstag"
|
2323 |
|
2324 |
+
#: inc/class-page-editjob.php:729
|
2325 |
#: inc/features/class-wizard-job.php:322
|
2326 |
#@ backwpup
|
2327 |
msgid "daily"
|
2328 |
msgstr "täglich"
|
2329 |
|
2330 |
+
#: inc/class-page-editjob.php:739
|
2331 |
#: inc/features/class-wizard-job.php:332
|
2332 |
#@ backwpup
|
2333 |
msgid "hourly"
|
2334 |
msgstr "stündlich"
|
2335 |
|
2336 |
+
#: inc/class-page-editjob.php:755
|
2337 |
+
#: inc/class-page-editjob.php:768
|
2338 |
+
#: inc/class-page-editjob.php:780
|
2339 |
+
#: inc/class-page-editjob.php:794
|
2340 |
+
#: inc/class-page-editjob.php:816
|
2341 |
#@ backwpup
|
2342 |
msgid "Any (*)"
|
2343 |
msgstr "Alle (*)"
|
2344 |
|
2345 |
+
#: inc/class-page-editjob.php:765
|
2346 |
#@ backwpup
|
2347 |
msgid "Hours:"
|
2348 |
msgstr "Stunden:"
|
2349 |
|
2350 |
+
#: inc/class-page-editjob.php:778
|
2351 |
#@ backwpup
|
2352 |
msgid "Day of Month:"
|
2353 |
msgstr "Tag des Monats:"
|
2354 |
|
2355 |
+
#: inc/class-page-editjob.php:792
|
2356 |
#@ backwpup
|
2357 |
msgid "Month:"
|
2358 |
msgstr "Monat:"
|
2359 |
|
2360 |
+
#: inc/class-page-editjob.php:798
|
2361 |
#@ backwpup
|
2362 |
msgid "January"
|
2363 |
msgstr "Januar"
|
2364 |
|
2365 |
+
#: inc/class-page-editjob.php:799
|
2366 |
#@ backwpup
|
2367 |
msgid "February"
|
2368 |
msgstr "Februar"
|
2369 |
|
2370 |
+
#: inc/class-page-editjob.php:800
|
2371 |
#@ backwpup
|
2372 |
msgid "March"
|
2373 |
msgstr "März"
|
2374 |
|
2375 |
+
#: inc/class-page-editjob.php:801
|
2376 |
#@ backwpup
|
2377 |
msgid "April"
|
2378 |
msgstr "April"
|
2379 |
|
2380 |
+
#: inc/class-page-editjob.php:802
|
2381 |
#@ backwpup
|
2382 |
msgid "May"
|
2383 |
msgstr "Mai"
|
2384 |
|
2385 |
+
#: inc/class-page-editjob.php:803
|
2386 |
#@ backwpup
|
2387 |
msgid "June"
|
2388 |
msgstr "Juni"
|
2389 |
|
2390 |
+
#: inc/class-page-editjob.php:804
|
2391 |
#@ backwpup
|
2392 |
msgid "July"
|
2393 |
msgstr "Juli"
|
2394 |
|
2395 |
+
#: inc/class-page-editjob.php:805
|
2396 |
#@ backwpup
|
2397 |
msgid "August"
|
2398 |
msgstr "August"
|
2399 |
|
2400 |
+
#: inc/class-page-editjob.php:806
|
2401 |
#@ backwpup
|
2402 |
msgid "September"
|
2403 |
msgstr "September"
|
2404 |
|
2405 |
+
#: inc/class-page-editjob.php:807
|
2406 |
#@ backwpup
|
2407 |
msgid "October"
|
2408 |
msgstr "Oktober"
|
2409 |
|
2410 |
+
#: inc/class-page-editjob.php:808
|
2411 |
#@ backwpup
|
2412 |
msgid "November"
|
2413 |
msgstr "November"
|
2414 |
|
2415 |
+
#: inc/class-page-editjob.php:809
|
2416 |
#@ backwpup
|
2417 |
msgid "December"
|
2418 |
msgstr "Dezember"
|
2419 |
|
2420 |
+
#: inc/class-page-editjob.php:814
|
2421 |
#@ backwpup
|
2422 |
msgid "Day of Week:"
|
2423 |
msgstr "Wochentag:"
|
2424 |
|
2425 |
+
#: inc/class-page-editjob.php:850
|
2426 |
#@ backwpup
|
2427 |
msgid "Save changes"
|
2428 |
msgstr "Änderungen speichern"
|
2437 |
msgid "ID"
|
2438 |
msgstr "ID"
|
2439 |
|
2440 |
+
#: inc/class-page-editjob.php:417
|
2441 |
#: inc/class-page-jobs.php:69
|
2442 |
#@ backwpup
|
2443 |
msgid "Job Name"
|
2480 |
msgid "Cron: %s"
|
2481 |
msgstr "Cron: %s"
|
2482 |
|
2483 |
+
#: inc/class-page-backwpup.php:277
|
2484 |
#: inc/class-page-jobs.php:197
|
2485 |
#@ backwpup
|
2486 |
msgid "Not scheduled!"
|
2506 |
msgid "Copy of"
|
2507 |
msgstr "Kopie von"
|
2508 |
|
2509 |
+
#: inc/class-page-jobs.php:365
|
2510 |
#, php-format
|
2511 |
#@ backwpup
|
2512 |
msgid "Job \"%s\" started."
|
2513 |
msgstr "Auftrag \"%s\" wurde gestartet."
|
2514 |
|
2515 |
+
#: inc/class-page-jobs.php:402
|
2516 |
+
#: inc/class-wp-cli.php:52
|
2517 |
#@ backwpup
|
2518 |
msgid "Aborted by user!"
|
2519 |
msgstr "Abgebrochen vom Benutzer!"
|
2520 |
|
2521 |
+
#: inc/class-page-jobs.php:431
|
2522 |
+
#: inc/class-wp-cli.php:82
|
2523 |
#@ backwpup
|
2524 |
msgid "Job will be terminated."
|
2525 |
msgstr "Auftrag wird beendet."
|
2526 |
|
2527 |
+
#: inc/class-page-jobs.php:471
|
2528 |
#, php-format
|
2529 |
#@ backwpup
|
2530 |
msgid "%s Jobs"
|
2531 |
msgstr "%s Aufträge"
|
2532 |
|
2533 |
+
#: inc/class-page-jobs.php:490
|
2534 |
#@ backwpup
|
2535 |
msgid "Warnings:"
|
2536 |
msgstr "Warnungen:"
|
2537 |
|
2538 |
+
#: inc/class-page-jobs.php:491
|
2539 |
#@ backwpup
|
2540 |
msgid "Errors:"
|
2541 |
msgstr "Fehler:"
|
2542 |
|
2543 |
+
#: inc/class-page-jobs.php:492
|
2544 |
#@ backwpup
|
2545 |
msgid "Display working log"
|
2546 |
msgstr "Zeige Auftragslog"
|
2547 |
|
2548 |
+
#: inc/class-page-jobs.php:494
|
2549 |
#@ backwpup
|
2550 |
msgid "Close working screen"
|
2551 |
msgstr "Arbeitsfläche schließen"
|
2552 |
|
2553 |
+
#: inc/class-page-jobs.php:494
|
2554 |
#@ backwpup
|
2555 |
msgid "close"
|
2556 |
msgstr "schließen"
|
2557 |
|
2558 |
+
#: inc/class-page-jobs.php:635
|
2559 |
#@ backwpup
|
2560 |
msgid "Job end"
|
2561 |
msgstr "Auftragsende"
|
2608 |
|
2609 |
#: inc/class-destination-ftp.php:101
|
2610 |
#: inc/class-page-logs.php:212
|
2611 |
+
#: inc/class-page-settings.php:417
|
2612 |
#@ backwpup
|
2613 |
msgid "seconds"
|
2614 |
msgstr "Sekunden"
|
2778 |
msgid "unavailable"
|
2779 |
msgstr "unerreichbar"
|
2780 |
|
2781 |
+
#: inc/class-page-settings.php:411
|
2782 |
#@ backwpup
|
2783 |
msgid "Server"
|
2784 |
msgstr "Server"
|
2785 |
|
2786 |
+
#: inc/class-page-settings.php:412
|
2787 |
#@ backwpup
|
2788 |
msgid "Operating System"
|
2789 |
msgstr "Betriebssystem"
|
2790 |
|
2791 |
+
#: inc/class-page-settings.php:413
|
2792 |
#@ backwpup
|
2793 |
msgid "PHP SAPI"
|
2794 |
msgstr "PHP SAPI"
|
2795 |
|
2796 |
+
#: inc/class-page-settings.php:414
|
2797 |
#@ backwpup
|
2798 |
msgid "Current PHP user"
|
2799 |
msgstr "Aktueller PHP user"
|
2800 |
|
|
|
2801 |
#: inc/class-page-settings.php:415
|
2802 |
#: inc/class-page-settings.php:419
|
2803 |
+
#: inc/class-page-settings.php:423
|
2804 |
#@ backwpup
|
2805 |
msgid "On"
|
2806 |
msgstr "An"
|
2807 |
|
2808 |
+
#: inc/class-page-settings.php:415
|
|
|
2809 |
#: inc/class-page-settings.php:421
|
2810 |
+
#: inc/class-page-settings.php:425
|
2811 |
#@ backwpup
|
2812 |
msgid "Off"
|
2813 |
msgstr "Aus"
|
2814 |
|
2815 |
+
#: inc/class-page-settings.php:416
|
2816 |
#@ backwpup
|
2817 |
msgid "Safe Mode"
|
2818 |
msgstr "Safe Mode"
|
2819 |
|
2820 |
+
#: inc/class-page-settings.php:417
|
2821 |
#@ backwpup
|
2822 |
msgid "Maximum execution time"
|
2823 |
msgstr "Max. Ausführungszeit"
|
2824 |
|
2825 |
+
#: inc/class-page-settings.php:419
|
2826 |
+
#: inc/class-page-settings.php:421
|
2827 |
#@ backwpup
|
2828 |
msgid "Alternative WP Cron"
|
2829 |
msgstr "Alternative WP Cron"
|
2830 |
|
2831 |
+
#: inc/class-page-settings.php:427
|
2832 |
+
#: inc/class-page-settings.php:429
|
2833 |
#@ backwpup
|
2834 |
msgid "CHMOD Dir"
|
2835 |
msgstr "CHMOD Verzeichnis"
|
2836 |
|
2837 |
+
#: inc/class-page-settings.php:431
|
2838 |
#@ backwpup
|
2839 |
msgid "Server Time"
|
2840 |
msgstr "Server Zeit"
|
2841 |
|
2842 |
+
#: inc/class-page-settings.php:432
|
2843 |
#@ backwpup
|
2844 |
msgid "Blog Time"
|
2845 |
msgstr "Webseite Zeit"
|
2846 |
|
2847 |
+
#: inc/class-page-settings.php:433
|
2848 |
#@ backwpup
|
2849 |
msgid "Blog Timezone"
|
2850 |
msgstr "Webseite Zeitzone"
|
2851 |
|
2852 |
+
#: inc/class-page-settings.php:434
|
2853 |
#@ backwpup
|
2854 |
msgid "Blog Time offset"
|
2855 |
msgstr "Webseite Zeitversetzung"
|
2856 |
|
2857 |
+
#: inc/class-page-settings.php:434
|
2858 |
#, php-format
|
2859 |
#@ backwpup
|
2860 |
msgid "%s hours"
|
2861 |
msgstr "%s Stunden"
|
2862 |
|
2863 |
+
#: inc/class-page-settings.php:435
|
2864 |
#@ backwpup
|
2865 |
msgid "Blog language"
|
2866 |
msgstr "Webseiten Sprache"
|
2867 |
|
2868 |
+
#: inc/class-page-settings.php:436
|
2869 |
#@ backwpup
|
2870 |
msgid "MySQL Client encoding"
|
2871 |
msgstr "MySQL Client Encoding"
|
2872 |
|
2873 |
+
#: inc/class-page-settings.php:439
|
2874 |
#@ backwpup
|
2875 |
msgid "Blog charset"
|
2876 |
msgstr "Webseiten Charset"
|
2877 |
|
2878 |
+
#: inc/class-page-settings.php:440
|
2879 |
#@ backwpup
|
2880 |
msgid "PHP Memory limit"
|
2881 |
msgstr "PHP Memory Limit"
|
2882 |
|
2883 |
+
#: inc/class-page-settings.php:443
|
2884 |
#@ backwpup
|
2885 |
msgid "Memory in use"
|
2886 |
msgstr "Speicher in Benutzung"
|
2887 |
|
2888 |
+
#: inc/class-page-settings.php:448
|
2889 |
#@ backwpup
|
2890 |
msgid "Disabled PHP Functions:"
|
2891 |
msgstr "Deaktivierte PHP Funktionen:"
|
2892 |
|
2893 |
+
#: inc/class-page-settings.php:453
|
2894 |
#@ backwpup
|
2895 |
msgid "Loaded PHP Extensions:"
|
2896 |
msgstr "Geladene PHP Erweiterungen"
|
2900 |
msgid "Job Types"
|
2901 |
msgstr "Auftragstypen"
|
2902 |
|
2903 |
+
#: inc/class-page-settings.php:465
|
2904 |
#@ backwpup
|
2905 |
msgid "Save Changes"
|
2906 |
msgstr "Änderungen speichern"
|
2962 |
msgid "Due to a wrong license you are not allowed to activate this plugin. Please update your license at <a href=\"http://marketpress.com\">marketpress.com</a>."
|
2963 |
msgstr "Dir ist nicht erlaubt, das Plugin zu aktivieren, mit einer falschen Lizenz. Bitte aktualisiere deine Lizenz auf <a href=\"http://marketpress.de\">MarketPress.de</a>."
|
2964 |
|
2965 |
+
#: inc/features/class-destination-dropbox-pro.php:57
|
2966 |
+
#: inc/features/class-destination-dropbox-pro.php:65
|
2967 |
#: inc/features/class-destination-sugarsync-pro.php:28
|
2968 |
#@ backwpup
|
2969 |
msgid "Login:"
|
2970 |
msgstr "Login:"
|
2971 |
|
2972 |
+
#: inc/features/class-destination-dropbox-pro.php:67
|
2973 |
#@ backwpup
|
2974 |
msgid "Reauthenticate"
|
2975 |
msgstr "Neu authentifizieren"
|
2976 |
|
2977 |
+
#: inc/features/class-destination-dropbox-pro.php:69
|
2978 |
#: inc/features/class-destination-sugarsync-pro.php:55
|
2979 |
#@ backwpup
|
2980 |
msgid "Folder:"
|
2981 |
msgstr "Ordner:"
|
2982 |
|
2983 |
+
#: inc/features/class-destination-dropbox-pro.php:129
|
2984 |
#, php-format
|
2985 |
#@ backwpup
|
2986 |
msgid "%d. Try to sync files to Dropbox …"
|
2987 |
msgstr "%d. Versuche, Dateien mit Dropbox zu synchronisieren …"
|
2988 |
|
2989 |
+
#: inc/features/class-destination-dropbox-pro.php:144
|
2990 |
#@ backwpup
|
2991 |
msgid "Retrieving file list from Dropbox"
|
2992 |
msgstr "Ziehe Dateiliste von Dropbox"
|
2993 |
|
2994 |
+
#: inc/features/class-destination-dropbox-pro.php:149
|
2995 |
#@ backwpup
|
2996 |
msgid "Upload changed files to Dropbox"
|
2997 |
msgstr "Lade geänderte Datei in die Dropbox"
|
2998 |
|
2999 |
+
#: inc/features/class-destination-dropbox-pro.php:165
|
3000 |
#, php-format
|
3001 |
#@ backwpup
|
3002 |
msgid "File %s uploaded to Dropbox"
|
3003 |
msgstr "Datei %s in die Dropbox geladen"
|
3004 |
|
3005 |
+
#: inc/features/class-destination-dropbox-pro.php:180
|
3006 |
#, php-format
|
3007 |
#@ backwpup
|
3008 |
msgid "Extra file %s uploaded to Dropbox"
|
3009 |
msgstr "Extra Datei %s in die Dropbox geladen"
|
3010 |
|
3011 |
+
#: inc/features/class-destination-dropbox-pro.php:207
|
|
|
|
|
|
|
|
|
|
|
3012 |
#, php-format
|
3013 |
#@ backwpup
|
3014 |
msgid "File %s deleted from Dropbox"
|
3025 |
msgid "File %s copied"
|
3026 |
msgstr "Datei %s kopiert"
|
3027 |
|
3028 |
+
#: inc/features/class-destination-folder-pro.php:170
|
3029 |
#, php-format
|
3030 |
#@ backwpup
|
3031 |
msgid "Empty folder %s deleted"
|
3054 |
|
3055 |
#: inc/features/class-destination-msazure-pro.php:15
|
3056 |
#: inc/features/class-destination-s3-pro.php:39
|
3057 |
+
#: inc/features/class-destination-s3-v1-pro.php:39
|
3058 |
#@ backwpup
|
3059 |
msgid "Access Key:"
|
3060 |
msgstr "Zugangsschlüssel (Access Key):"
|
3149 |
msgid "Extra file %s uploaded to Rackspace Cloud."
|
3150 |
msgstr "Extra Datei %s zur Rackspace Cloud hochgeladen."
|
3151 |
|
3152 |
+
#: inc/features/class-destination-rsc-pro.php:214
|
3153 |
#, php-format
|
3154 |
#@ backwpup
|
3155 |
msgid "File %s deleted from Rackspace Cloud."
|
3156 |
msgstr "Datei %s in der Rackspace Cloud gelöscht."
|
3157 |
|
3158 |
#: inc/features/class-destination-s3-pro.php:22
|
3159 |
+
#: inc/features/class-destination-s3-v1-pro.php:22
|
3160 |
#@ backwpup
|
3161 |
msgid "Select an S3 service:"
|
3162 |
msgstr "Wähle einen S3 service: "
|
3163 |
|
3164 |
#: inc/features/class-destination-s3-pro.php:42
|
3165 |
+
#: inc/features/class-destination-s3-v1-pro.php:42
|
3166 |
#@ backwpup
|
3167 |
msgid "Secret Key:"
|
3168 |
msgstr "Secret Key:"
|
3169 |
|
3170 |
#: inc/features/class-destination-s3-pro.php:45
|
3171 |
+
#: inc/features/class-destination-s3-v1-pro.php:45
|
3172 |
#@ backwpup
|
3173 |
msgid "Bucket:"
|
3174 |
msgstr "Bucket:"
|
3175 |
|
3176 |
#: inc/features/class-destination-s3-pro.php:55
|
3177 |
+
#: inc/features/class-destination-s3-v1-pro.php:55
|
3178 |
#@ backwpup
|
3179 |
msgid "New Bucket:"
|
3180 |
msgstr "Neues Bucket: "
|
3181 |
|
3182 |
#: inc/features/class-destination-s3-pro.php:57
|
3183 |
+
#: inc/features/class-destination-s3-v1-pro.php:57
|
3184 |
#@ backwpup
|
3185 |
msgid "Folder in bucket:"
|
3186 |
msgstr "Ordner im Bucket:"
|
3187 |
|
3188 |
#: inc/features/class-destination-s3-pro.php:152
|
3189 |
+
#: inc/features/class-destination-s3-v1-pro.php:154
|
3190 |
#, php-format
|
3191 |
#@ backwpup
|
3192 |
msgid "%d. Trying to sync files to S3 Service …"
|
3193 |
msgstr "%d. Versuche, die Dateien mit dem S3-Service zu synchronisieren …"
|
3194 |
|
3195 |
#: inc/features/class-destination-s3-pro.php:174
|
3196 |
+
#: inc/features/class-destination-s3-v1-pro.php:183
|
3197 |
#@ backwpup
|
3198 |
msgid "Retrieving file list from S3."
|
3199 |
msgstr "Ziehe Dateilliste von S3."
|
3200 |
|
3201 |
#: inc/features/class-destination-s3-pro.php:227
|
3202 |
+
#: inc/features/class-destination-s3-v1-pro.php:232
|
3203 |
#@ backwpup
|
3204 |
msgid "Upload changed files to S3."
|
3205 |
msgstr "Geänderte Dateien zu S3 hochladen."
|
3206 |
|
3207 |
#: inc/features/class-destination-s3-pro.php:239
|
3208 |
+
#: inc/features/class-destination-s3-v1-pro.php:241
|
3209 |
#, php-format
|
3210 |
#@ backwpup
|
3211 |
msgid "File %s uploaded to S3."
|
3212 |
msgstr "Datei %s zu S3 hochgeladen."
|
3213 |
|
3214 |
#: inc/features/class-destination-s3-pro.php:256
|
3215 |
+
#: inc/features/class-destination-s3-v1-pro.php:255
|
3216 |
#, php-format
|
3217 |
#@ backwpup
|
3218 |
msgid "Extra file %s uploaded to S3."
|
3219 |
msgstr "Extra Datei %s zu S3 hochgeladen."
|
3220 |
|
3221 |
#: inc/features/class-destination-s3-pro.php:265
|
3222 |
+
#: inc/features/class-destination-s3-v1-pro.php:264
|
3223 |
#@ backwpup
|
3224 |
msgid "Delete nonexistent files on S3"
|
3225 |
msgstr "Es werden keine existierenden Dateien in S3 gelöscht."
|
3226 |
|
3227 |
+
#: inc/features/class-destination-s3-pro.php:273
|
3228 |
+
#: inc/features/class-destination-s3-v1-pro.php:268
|
3229 |
#, php-format
|
3230 |
#@ backwpup
|
3231 |
msgid "File %s deleted from S3."
|
3266 |
msgstr "Export"
|
3267 |
|
3268 |
#: inc/features/class-jobtype-dbcheck-pro.php:17
|
3269 |
+
#: inc/features/class-jobtype-dbdump-pro.php:85
|
3270 |
#: inc/features/class-jobtype-dboptimize-pro.php:17
|
3271 |
#@ backwpup
|
3272 |
msgid "Only WordPress tables"
|
3277 |
msgid "Check only WordPress Database tables"
|
3278 |
msgstr "Teste nur die WordPress Datenbank Tabellen"
|
3279 |
|
3280 |
+
#: inc/features/class-jobtype-dbdump-pro.php:89
|
3281 |
#@ backwpup
|
3282 |
msgid "Dump only WordPress Database tables"
|
3283 |
msgstr "Nur die WordPress Datenbank Tabellen sichern"
|
3284 |
|
3285 |
+
#: inc/features/class-jobtype-dbdump-pro.php:108
|
3286 |
#@ backwpup
|
3287 |
msgid "Database connection"
|
3288 |
msgstr "Datenbank Verbindung"
|
3289 |
|
3290 |
+
#: inc/features/class-jobtype-dbdump-pro.php:112
|
3291 |
#@ backwpup
|
3292 |
msgid "Use WordPress database connection."
|
3293 |
msgstr "Nutze WordPress Datenbank Verbindung"
|
3294 |
|
3295 |
+
#: inc/features/class-jobtype-dbdump-pro.php:119
|
3296 |
#@ backwpup
|
3297 |
msgid "User:"
|
3298 |
msgstr "Benutzer: "
|
3299 |
|
3300 |
+
#: inc/features/class-jobtype-dbdump-pro.php:126
|
3301 |
#@ backwpup
|
3302 |
msgid "Charset:"
|
3303 |
msgstr "Charset: "
|
3304 |
|
3305 |
+
#: inc/features/class-jobtype-dbdump-pro.php:137
|
3306 |
#@ backwpup
|
3307 |
msgid "Database:"
|
3308 |
msgstr "Datenbank:"
|
3309 |
|
3310 |
+
#: inc/class-jobtype-dbdump.php:208
|
3311 |
+
#: inc/features/class-jobtype-dbdump-pro.php:515
|
3312 |
+
#: inc/features/class-jobtype-dbdump-pro.php:627
|
3313 |
#, php-format
|
3314 |
#@ backwpup
|
3315 |
msgid "Added database dump \"%1$s\" with %2$s to backup file list"
|
3316 |
msgstr "Datenbank-Backup erstellt \"%1$s\" mit %2$s zur Backup-Liste"
|
3317 |
|
3318 |
+
#: inc/features/class-jobtype-dbdump-pro.php:612
|
3319 |
#@ backwpup
|
3320 |
msgid "Compressing done."
|
3321 |
msgstr "Komprimierung erledigt."
|
3322 |
|
3323 |
+
#: inc/features/class-jobtype-dbdump-pro.php:700
|
3324 |
#@ backwpup
|
3325 |
msgid "No tables for XML dump"
|
3326 |
msgstr "Es gibt keine Tabellen für ein XML-Backup"
|
3327 |
|
3328 |
+
#: inc/features/class-jobtype-dbdump-pro.php:737
|
3329 |
#, php-format
|
3330 |
#@ backwpup
|
3331 |
msgid "Dump database create view \"%s\""
|
3332 |
msgstr "Datenbank-Backup erstellt \"%s\""
|
3333 |
|
3334 |
+
#: inc/features/class-jobtype-dbdump-pro.php:794
|
3335 |
#, php-format
|
3336 |
#@ backwpup
|
3337 |
msgid "Dump table \"%s\" data"
|
3338 |
msgstr "Backup der Tabellen \"%s\""
|
3339 |
|
3340 |
+
#: inc/features/class-jobtype-dbdump-pro.php:863
|
3341 |
#, php-format
|
3342 |
#@ backwpup
|
3343 |
msgid "Added database XML dump \"%1$s\" with %2$s to backup file list"
|
3344 |
msgstr "XML-Backup der Datenbank \"%1$s\" mit %2$s zur Backup-Liste"
|
3345 |
|
3346 |
+
#: inc/features/class-jobtype-dbdump-pro.php:866
|
3347 |
#@ backwpup
|
3348 |
msgid "Database XML dump done!"
|
3349 |
msgstr "XML-Backup der Datenbank erstellt."
|
3353 |
msgid "Nothing to configure"
|
3354 |
msgstr "Nichts zu konfiguieren"
|
3355 |
|
3356 |
+
#: inc/features/class-page-wizard.php:149
|
3357 |
+
#: inc/features/class-page-wizard.php:337
|
3358 |
+
#: inc/features/class-page-wizard.php:368
|
3359 |
#@ backwpup
|
3360 |
msgid "Next >"
|
3361 |
msgstr "weiter >"
|
3362 |
|
3363 |
+
#: inc/features/class-page-wizard.php:166
|
3364 |
+
#: inc/features/class-page-wizard.php:333
|
3365 |
#@ backwpup
|
3366 |
msgid "< Previous"
|
3367 |
msgstr "< vorher"
|
3368 |
|
3369 |
+
#: inc/features/class-page-wizard.php:114
|
3370 |
+
#: inc/features/class-page-wizard.php:342
|
3371 |
#@ backwpup
|
3372 |
msgid "Cancel"
|
3373 |
msgstr "Abbrechen"
|
3478 |
msgid "A tared and BZipped archive (fast and memory less)"
|
3479 |
msgstr "Ein .tar und .bz Archiv (schnell und schlank)"
|
3480 |
|
3481 |
+
#: inc/features/class-wizard-job.php:562
|
3482 |
#, php-format
|
3483 |
#@ backwpup
|
3484 |
msgid "Wizard: %1$s"
|
3485 |
msgstr "Assistent: %1$s"
|
3486 |
|
3487 |
+
#: inc/features/class-wizard-job.php:593
|
3488 |
#@ backwpup
|
3489 |
msgid "Create Job"
|
3490 |
msgstr "Auftrag erstellen"
|
3491 |
|
3492 |
+
#: inc/features/class-wizard-job.php:618
|
3493 |
+
#: inc/features/class-wizard-job.php:619
|
3494 |
#@ backwpup
|
3495 |
msgid "Database Backup and XML Export (Daily)"
|
3496 |
msgstr "DB Sicherung & XML Export (täglich)"
|
3497 |
|
3498 |
+
#: inc/features/class-wizard-job.php:636
|
3499 |
+
#: inc/features/class-wizard-job.php:637
|
3500 |
#@ backwpup
|
3501 |
msgid "Database Check and Optimization (Weekly)"
|
3502 |
msgstr "DB-Check & Optimierung (wöchentlich)"
|
3503 |
|
3504 |
+
#: inc/features/class-wizard-job.php:646
|
3505 |
+
#: inc/features/class-wizard-job.php:647
|
3506 |
#@ backwpup
|
3507 |
msgid "Uploads Backup"
|
3508 |
msgstr "Sicherung der Uploads"
|
3509 |
|
3510 |
+
#: inc/features/class-wizard-job.php:661
|
3511 |
+
#: inc/features/class-wizard-job.php:662
|
3512 |
#@ backwpup
|
3513 |
msgid "All Files Backup"
|
3514 |
msgstr "Sicherung aller Dateien"
|
3515 |
|
3516 |
+
#: inc/features/class-wizard-job.php:692
|
3517 |
+
#: inc/features/class-wizard-job.php:693
|
3518 |
#@ backwpup
|
3519 |
msgid "Custom configuration"
|
3520 |
msgstr "Benutzerdefinierte Konfiguration"
|
3657 |
msgid "http://inpsyde.com"
|
3658 |
msgstr "http://inpsyde.com"
|
3659 |
|
3660 |
+
#: inc/class-adminbar.php:53
|
3661 |
#@ backwpupadminbar
|
3662 |
msgid "running"
|
3663 |
msgstr "läuft"
|
3664 |
|
3665 |
+
#: inc/class-job.php:178
|
3666 |
#@ backwpup
|
3667 |
msgid "Job Start"
|
3668 |
msgstr "Auftragsstart"
|
3669 |
|
3670 |
+
#: inc/class-job.php:309
|
3671 |
#@ backwpup
|
3672 |
msgid "No destination correctly defined for backup! Please correct job settings."
|
3673 |
msgstr "Es wurde kein korrektes Backupziel definiert! Bitte überprüfe die Auftragseinstellungen."
|
3748 |
msgid "Plugin list file name"
|
3749 |
msgstr "Plugin listen Datei Name"
|
3750 |
|
3751 |
+
#: inc/class-page-backwpup.php:138
|
3752 |
#@ backwpup
|
3753 |
msgid "Check the installation"
|
3754 |
msgstr "Überprüfe die Installation"
|
3763 |
msgid "Security option for BackWPup"
|
3764 |
msgstr "Sicherheitseinstellungen für BackWPup"
|
3765 |
|
3766 |
+
#: inc/class-page-settings.php:376
|
3767 |
#@ backwpup
|
3768 |
msgid "Server self connect:"
|
3769 |
msgstr "Verbindung zum Server selbst:"
|
3770 |
|
3771 |
+
#: inc/class-page-jobs.php:356
|
3772 |
+
#: inc/class-page-settings.php:379
|
3773 |
#, php-format
|
3774 |
#@ backwpup
|
3775 |
msgid "The HTTP response test get a error \"%s\""
|
3776 |
msgstr "Der HTTP Antwort Test bekommt diesen Fehler \"%s\""
|
3777 |
|
3778 |
+
#: inc/class-page-jobs.php:358
|
3779 |
+
#: inc/class-page-settings.php:381
|
3780 |
#, php-format
|
3781 |
#@ backwpup
|
3782 |
msgid "The HTTP response test get a false http status (%s)"
|
3783 |
msgstr "Der HTTP Antwort Test bekommt den falschen http Status (%s)"
|
3784 |
|
3785 |
+
#: inc/class-page-settings.php:393
|
|
|
|
|
|
|
|
|
|
|
|
|
3786 |
#@ backwpup
|
3787 |
msgid "Temp folder:"
|
3788 |
msgstr "Temp Verzeichnis:"
|
3789 |
|
3790 |
+
#: inc/class-page-settings.php:395
|
3791 |
#, php-format
|
3792 |
#@ backwpup
|
3793 |
msgid "Temp folder %s not exist and can't created."
|
3794 |
msgstr "Temp Verzeichnis %s existiert nicht und konnte nicht erstellt werden."
|
3795 |
|
3796 |
+
#: inc/class-page-settings.php:397
|
3797 |
#, php-format
|
3798 |
#@ backwpup
|
3799 |
msgid "Temp folder %s not writable."
|
3800 |
msgstr "Temp Verzeichnis %s ist nicht beschreibbar."
|
3801 |
|
3802 |
+
#: inc/class-page-settings.php:403
|
3803 |
#@ backwpup
|
3804 |
msgid "Logs folder:"
|
3805 |
msgstr "Logdateien Verzeichnis:"
|
3806 |
|
3807 |
+
#: inc/class-page-settings.php:405
|
3808 |
#, php-format
|
3809 |
#@ backwpup
|
3810 |
msgid "Logs folder %s not exist and can't created."
|
3811 |
msgstr "Logdateien Verzeichnis %s existiert nicht und kann nicht erstellt werden"
|
3812 |
|
3813 |
+
#: inc/class-page-settings.php:407
|
3814 |
#, php-format
|
3815 |
#@ backwpup
|
3816 |
msgid "Logs folder %s not writable."
|
3817 |
msgstr "Logdateien Verzeichnis %s nicht beschreibbar."
|
3818 |
|
3819 |
+
#: inc/class-page-settings.php:423
|
3820 |
+
#: inc/class-page-settings.php:425
|
3821 |
#@ backwpup
|
3822 |
msgid "Disabled WP Cron"
|
3823 |
msgstr "WP Cron abgeschaltet"
|
3824 |
|
3825 |
+
#: inc/class-job.php:282
|
3826 |
#, php-format
|
3827 |
#@ backwpup
|
3828 |
msgid "[INFO] Maximum script execution time is %1$d seconds"
|
3834 |
msgid "Runtime: %d seconds"
|
3835 |
msgstr "Ausführungszeit: %d Sekunden"
|
3836 |
|
3837 |
+
#: inc/class-job.php:623
|
3838 |
#@ backwpup
|
3839 |
msgid "Second process start terminated, because a other job is already running!"
|
3840 |
msgstr "Ein zweiter Prozess start wurde abgebrochen, weil der alte Auftrag noch läuft!"
|
3841 |
|
3842 |
+
#: inc/class-job.php:875
|
3843 |
#, php-format
|
3844 |
#@ backwpup
|
3845 |
msgid "Signal %d is sent to script!"
|
3846 |
msgstr "Signal %d wurde zum Script gesendet!"
|
3847 |
|
3848 |
+
#: inc/class-page-backups.php:312
|
3849 |
#: inc/class-page-jobs.php:210
|
3850 |
#: inc/class-page-logs.php:181
|
3851 |
#, php-format
|
3859 |
msgid "%1$s at %2$s by WP-Cron"
|
3860 |
msgstr "%1$s um %2$s mit WP-Cron"
|
3861 |
|
3862 |
+
#: inc/class-admin.php:240
|
3863 |
#@ backwpup
|
3864 |
msgid "About"
|
3865 |
msgstr "Über"
|
3869 |
msgid "Manual"
|
3870 |
msgstr "Handbuch"
|
3871 |
|
3872 |
+
#: inc/class-job.php:280
|
3873 |
#@ backwpup
|
3874 |
msgid "[INFO] BackWPup job started form commandline interface"
|
3875 |
msgstr "[INFO] BackWPup-Auftrag per Kommandozeile gestartet"
|
3876 |
|
3877 |
+
#: inc/class-job.php:539
|
3878 |
#@ default
|
3879 |
msgid "Job Started"
|
3880 |
msgstr ""
|
3953 |
msgid "Backup now!"
|
3954 |
msgstr "Sichern Sie Ihre Daten jetzt!"
|
3955 |
|
3956 |
+
#: inc/class-page-editjob.php:628
|
3957 |
#@ backwpup
|
3958 |
msgid "Start job with CLI"
|
3959 |
msgstr "Auftrag per CLI starten"
|
3963 |
msgid "Nothing to abort!"
|
3964 |
msgstr "Es gibt nichts abzubrechen!"
|
3965 |
|
3966 |
+
#: inc/class-wp-cli.php:97
|
3967 |
+
#: inc/class-wp-cli.php:118
|
3968 |
#, php-format
|
3969 |
#@ backwpup
|
3970 |
msgid "ID: %1$d Name: %2$s"
|
3971 |
msgstr "ID: %1$d Name: %2$s"
|
3972 |
|
3973 |
+
#: inc/class-wp-cli.php:119
|
3974 |
#, php-format
|
3975 |
#@ backwpup
|
3976 |
msgid "Warnings: %1$d Errors: %2$d"
|
3977 |
msgstr "Warnungen: %1$d Fehler: %2$d"
|
3978 |
|
3979 |
+
#: inc/features/class-jobtype-dbdump-pro.php:183
|
3980 |
#@ backwpup
|
3981 |
msgid "Path to <em>mysqldump</em> file"
|
3982 |
msgstr "Pfad zum <em>mysqldump</em>"
|
3991 |
msgid "Test if BackWPup can work without problems."
|
3992 |
msgstr "Prüfen Sie, ob BackWPup problemlos laufen kann."
|
3993 |
|
3994 |
+
#: inc/features/class-wizard-systemtest.php:110
|
3995 |
#, php-format
|
3996 |
#@ backwpup
|
3997 |
msgctxt "%1 = extension name, %2 = file suffix"
|
3998 |
msgid "We recommend to install the %1$s extension to generate %2$s archives."
|
3999 |
msgstr "Wir empfehlen, die Erweiterung %1$s für %2$s-Archive zu installieren."
|
4000 |
|
4001 |
+
#: inc/features/class-wizard-systemtest.php:133
|
4002 |
#, php-format
|
4003 |
#@ backwpup
|
4004 |
msgctxt "Link to PHP manual"
|
4005 |
msgid "Please disable the deprecated <a href=\"%s\">PHP safe mode</a>."
|
4006 |
msgstr "Bitte deaktiviere den veralteten <a href=\"%s\">PHP-safe-mode</a>."
|
4007 |
|
4008 |
+
#: inc/features/class-wizard-systemtest.php:141
|
4009 |
#@ backwpup
|
4010 |
msgid "We recommend to install the PHP FTP extension to use the FTP backup destination."
|
4011 |
msgstr "Wir empfehlen, die PHP-Erweiterung FTP zu installieren, um das Speicherziel FTP zu verwenden."
|
4022 |
msgid "Logs folder %s does not exist and cannot be created. Please create it and set proper write permissions."
|
4023 |
msgstr "Das Logverzeichnis %s existiert nicht, und es kann auch nicht erstellt werden. Bitte erstellen Sie es, und setzen Sie die passenden Schreibrechte."
|
4024 |
|
4025 |
+
#: inc/features/class-wizard-systemtest.php:179
|
4026 |
#, php-format
|
4027 |
#@ backwpup
|
4028 |
msgid "The HTTP response test result is an error: \"%s\"."
|
4029 |
msgstr "Das Ergebnis des HTTP-Tests ist ein Fehler: %s"
|
4030 |
|
4031 |
+
#: inc/features/class-wizard-systemtest.php:183
|
4032 |
#, php-format
|
4033 |
#@ backwpup
|
4034 |
msgid "The HTTP response test result is a wrong HTTP status: %s. It should be the staus 200."
|
4035 |
msgstr "Das Ergebnis des HTTP-Tests ist ein falscher HTTP-Status: %s. Es sollte der Status 200 sein."
|
4036 |
|
4037 |
+
#: inc/features/class-wizard-systemtest.php:201
|
|
|
|
|
|
|
|
|
|
|
|
|
4038 |
#@ backwpup
|
4039 |
msgid "WP-Cron seems to be broken. But it is needed to run scheduled jobs."
|
4040 |
msgstr "WP-Cron scheint nicht zu funktionieren. Es wird aber gebraucht, damit geplante Aufträge ausgeführt werden."
|
4041 |
|
4042 |
+
#: inc/features/class-wizard-systemtest.php:206
|
4043 |
#@ backwpup
|
4044 |
msgid "All tests passed without errors."
|
4045 |
msgstr "Alle Tests liefen fehlerfrei."
|
4046 |
|
4047 |
+
#: inc/features/class-wizard-systemtest.php:209
|
4048 |
#@ backwpup
|
4049 |
msgid "There is no error, but some warnings. BackWPup will work, but with limitations."
|
4050 |
msgstr "Es gibt keine Fehler, aber einige Warnungen. BackWPup wird eingeschränkt funktionieren."
|
4051 |
|
4052 |
+
#: inc/features/class-wizard-systemtest.php:212
|
4053 |
#@ backwpup
|
4054 |
msgid "There are errors. Please correct them, or BackWPup cannot work."
|
4055 |
msgstr "Es gab Fehler. Bitte korrigieren Sie diese, damit BackWPup arbeiten kann."
|
4064 |
msgid "New Job"
|
4065 |
msgstr "Bitte geben Sie einen Namen ein"
|
4066 |
|
4067 |
+
#: inc/class-page-editjob.php:753
|
4068 |
#@ backwpup
|
4069 |
msgid "Minutes:"
|
4070 |
msgstr "Minuten:"
|
4115 |
msgid "All your passwords"
|
4116 |
msgstr "All Ihre Passwörter"
|
4117 |
|
4118 |
+
#: inc/class-page-editjob.php:465
|
4119 |
#@ backwpup
|
4120 |
msgid "Synchronize file by file to destination"
|
4121 |
msgstr "Synchronisiere Datei für Datei zum Auftragsziel"
|
4122 |
|
4123 |
+
#: inc/class-page-editjob.php:475
|
4124 |
#@ backwpup
|
4125 |
msgid "Archive name"
|
4126 |
msgstr "Archivname"
|
4135 |
msgid "A job is already running."
|
4136 |
msgstr "Ein Auftrag läuft gerade."
|
4137 |
|
4138 |
+
#: inc/class-wp-cli.php:94
|
4139 |
#@ backwpup
|
4140 |
msgid "List of jobs"
|
4141 |
msgstr "Auftragsliste"
|
4142 |
|
4143 |
+
#: inc/class-wp-cli.php:120
|
4144 |
#, php-format
|
4145 |
#@ backwpup
|
4146 |
msgid "Steps in percent: %1$d percent of step: %2$d"
|
4147 |
msgstr "Schritte in Prozent: %1$d Prozent des Schritts: %2$d"
|
4148 |
|
4149 |
+
#: inc/class-wp-cli.php:121
|
4150 |
#, php-format
|
4151 |
#@ backwpup
|
4152 |
msgid "On step: %s"
|
4153 |
msgstr "Bei Schritt: %s"
|
4154 |
|
4155 |
+
#: inc/class-wp-cli.php:122
|
4156 |
#, php-format
|
4157 |
#@ backwpup
|
4158 |
msgid "Last message: %s"
|
4159 |
msgstr "Letzte Nachricht: %s"
|
4160 |
|
4161 |
+
#: inc/class-admin.php:397
|
4162 |
#, php-format
|
4163 |
#@ backwpup
|
4164 |
msgctxt "link to Inpsyde.com, link text: Inpsyde GmbH"
|
4165 |
msgid "A project of %s"
|
4166 |
msgstr "Ein Projekt der %s"
|
4167 |
|
4168 |
+
#: inc/class-admin.php:398
|
4169 |
#, php-format
|
4170 |
#@ backwpup
|
4171 |
msgctxt "developer name, link text: Daniel Hüsken"
|
4198 |
msgid "You can back up all your attachments, also all system files, plugins and themes in a single file. You can <a href=\"%s\">create a job</a> to update a backup copy of your file system only when files are changed."
|
4199 |
msgstr "Sie können all Ihre Anhänge sichern, ebenso alle Systemdateien, Plugins und Themes – in einer einzigen Datei. Sie können einen <a href=\\\"%s\\\">Auftrag erstellen</a>, um die Sicherungskopie nur dann zu aktualisieren, wenn sich tatsächlich eine Datei geändert hat."
|
4200 |
|
4201 |
+
#: inc/class-page-editjob.php:621
|
4202 |
#@ backwpup
|
4203 |
msgid "Copy the link for an external start. This option has to be activated to make the link work."
|
4204 |
msgstr "Kopieren Sie den Link für einen externen Auftragsstart. Diese Option muss erst aktiviert werden, damit der Link funktioniert."
|
4205 |
|
4206 |
+
#: inc/class-page-editjob.php:631
|
4207 |
#, php-format
|
4208 |
#@ backwpup
|
4209 |
msgid "Use <a href=\"http://wp-cli.org/\">WP-CLI</a> to run jobs from commandline or <a href=\"%s\">get the start script</a>."
|
4210 |
msgstr "Verwenden Sie <a href=\"http://wp-cli.org/\">WP-CLI</a>, um Aufträge per Kommandozeile auszulösen, oder <a href=\"%s\">dieses Start-Script</a>."
|
4211 |
|
4212 |
+
#: inc/class-page-editjob.php:502
|
4213 |
#@ backwpup
|
4214 |
msgid "Replacement patterns:"
|
4215 |
msgstr "Ersetzungsmuster:"
|
4216 |
|
4217 |
+
#: inc/class-page-settings.php:441
|
4218 |
#@ backwpup
|
4219 |
msgid "WP memory limit"
|
4220 |
msgstr "WordPress-Memory-Limit"
|
4221 |
|
4222 |
+
#: inc/class-page-settings.php:442
|
4223 |
#@ backwpup
|
4224 |
msgid "WP Maximum memory limit"
|
4225 |
msgstr "Maximales WordPress-Memory-Limit"
|
4230 |
msgid "https://marketpress.com/product/backwpup-pro/"
|
4231 |
msgstr "https://marketpress.de/product/backwpup-pro/"
|
4232 |
|
4233 |
+
#: inc/class-admin.php:123
|
4234 |
#: inc/class-help.php:29
|
4235 |
#@ backwpup
|
4236 |
msgid "https://marketpress.com/documentation/backwpup-pro/"
|
4237 |
msgstr "https://marketpress.de/dokumentation/backwpup-pro/"
|
4238 |
|
4239 |
+
#: inc/class-admin.php:125
|
4240 |
#: inc/class-help.php:26
|
4241 |
#@ backwpup
|
4242 |
msgid "https://marketpress.com/support/forum/plugins/backwpup-pro/"
|
4243 |
msgstr "https://marketpress.de/support/forum/plugins/backwpup-pro/"
|
4244 |
|
4245 |
+
#: inc/class-admin.php:125
|
4246 |
#: inc/class-help.php:26
|
4247 |
#@ backwpup
|
4248 |
msgid "Pro Support"
|
4263 |
msgid "First set up a job, and plan what you want to save. Please note: the plugin author gives no warranty for your data."
|
4264 |
msgstr "Erstellen Sie erst einen Auftrag, und planen Sie, was Sie sichern möchten. Bitte beachten Sie: Die Pluginautoren übernehmen keine Gewähr für Ihre Daten."
|
4265 |
|
4266 |
+
#: inc/class-page-editjob.php:309
|
4267 |
#@ backwpup
|
4268 |
msgid "Working as <a href=\"http://wikipedia.org/wiki/Cron\">Cron</a> schedule:"
|
4269 |
msgstr "Als <a href=\\\"http://de.wikipedia.org/wiki/Cron\\\">Cron-Job</a> ausführen:"
|
4278 |
msgid "Compress log files with GZip."
|
4279 |
msgstr "Komprimiere Logdateien mit Gzip."
|
4280 |
|
4281 |
+
#: inc/features/class-page-wizard.php:233
|
4282 |
#, php-format
|
4283 |
#@ backwpup
|
4284 |
msgctxt "Plugin Name"
|
4285 |
msgid "%s Wizards"
|
4286 |
msgstr "%s-Assistenten"
|
4287 |
|
4288 |
+
#: inc/features/class-page-wizard.php:272
|
4289 |
#, php-format
|
4290 |
#@ backwpup
|
4291 |
msgctxt "Plugin Name"
|
4302 |
msgid "Settings reset to default"
|
4303 |
msgstr "Die Einstellungen wurden zurückgesetzt."
|
4304 |
|
4305 |
+
#: inc/class-page-settings.php:467
|
4306 |
#@ backwpup
|
4307 |
msgid "Reset all settings to default"
|
4308 |
msgstr "Alle Einstellungen zurücksetzen"
|
4309 |
|
4310 |
+
#: inc/features/class-page-wizard.php:345
|
4311 |
#@ backwpup
|
4312 |
msgid "Back to overview"
|
4313 |
msgstr "Zurück zur Übersicht"
|
4322 |
msgid "Include special files"
|
4323 |
msgstr "Spezielle Dateien einschließen"
|
4324 |
|
4325 |
+
#: inc/features/class-jobtype-dbdump-pro.php:754
|
4326 |
#, php-format
|
4327 |
#@ backwpup
|
4328 |
msgid "Dump database structure \"%s\""
|
4353 |
msgid "Cannot open archive file"
|
4354 |
msgstr "Kann Archivdatei nicht öffnen"
|
4355 |
|
4356 |
+
#: inc/class-create-archive.php:241
|
4357 |
+
#: inc/class-create-archive.php:255
|
4358 |
+
#: inc/class-create-archive.php:426
|
4359 |
#, php-format
|
4360 |
#@ backwpup
|
4361 |
msgid "Cannot open source file %s to archive"
|
4362 |
msgstr "Konnte Quelle %s zum Archivieren nicht öffnen"
|
4363 |
|
4364 |
#: inc/class-create-archive.php:165
|
4365 |
+
#: inc/class-create-archive.php:289
|
4366 |
#, php-format
|
4367 |
#@ backwpup
|
4368 |
msgid "PclZip archive add error: %s"
|
4369 |
msgstr "Fehler beim Hinzufügen zum PclZip-Archive: %s"
|
4370 |
|
4371 |
+
#: inc/class-create-archive.php:398
|
4372 |
#, php-format
|
4373 |
#@ backwpup
|
4374 |
msgctxt "Text of ZipArchive status Message"
|
4375 |
msgid "ZipArchive returns status: %s"
|
4376 |
msgstr "Das Zip-Archive liefert den Status: %s"
|
4377 |
|
4378 |
+
#: inc/class-job.php:1613
|
4379 |
#, php-format
|
4380 |
#@ backwpup
|
4381 |
msgid "%d. Trying to create backup archive …"
|
4382 |
msgstr "%d. Versuche, Backup zu erstellen …"
|
4383 |
|
4384 |
+
#: inc/class-job.php:1620
|
4385 |
#, php-format
|
4386 |
#@ backwpup
|
4387 |
msgctxt "Archive compression method"
|
4388 |
msgid "Compression method is %s"
|
4389 |
msgstr "Komprimierungsmethode ist %s"
|
4390 |
|
4391 |
+
#: inc/class-job.php:1674
|
4392 |
#@ backwpup
|
4393 |
msgid "Backup archive created."
|
4394 |
msgstr "Backup wurde erstellt."
|
4404 |
msgid "Could not find content for this page. Please try again later."
|
4405 |
msgstr "Konnte den Inhalt der Seite nicht finden. Bitte versuchen Sie es später."
|
4406 |
|
4407 |
+
#: inc/features/class-jobtype-dbdump-pro.php:177
|
4408 |
#@ backwpup
|
4409 |
msgid "SQL File"
|
4410 |
msgstr "SQL-Datei"
|
4411 |
|
4412 |
+
#: inc/features/class-jobtype-dbdump-pro.php:178
|
4413 |
#@ backwpup
|
4414 |
msgid "XML File (phpMyAdmin schema)"
|
4415 |
msgstr "XML-Datei (phpMyAdmin-Schema9"
|
4416 |
|
4417 |
+
#: inc/features/class-jobtype-dbdump-pro.php:599
|
4418 |
#, php-format
|
4419 |
#@ backwpup
|
4420 |
msgctxt "Executed shell_exec() command"
|
4421 |
msgid "CLI Exec: %s"
|
4422 |
msgstr "CLI-Exec: %s"
|
4423 |
|
4424 |
+
#: inc/features/class-jobtype-dbdump-pro.php:602
|
4425 |
#, php-format
|
4426 |
#@ backwpup
|
4427 |
msgctxt "Output of a shell_exec()"
|
4442 |
msgid "Method to archive file %s not detected"
|
4443 |
msgstr "Methode zum Archivieren der Datei %s nicht gefunden"
|
4444 |
|
4445 |
+
#: inc/class-create-archive.php:221
|
4446 |
#@ backwpup
|
4447 |
msgid "File name cannot be empty"
|
4448 |
msgstr "Der Dateiname kann nicht leer sein."
|
4449 |
|
4450 |
+
#: inc/class-create-archive.php:236
|
4451 |
+
#: inc/class-create-archive.php:250
|
4452 |
+
#: inc/class-create-archive.php:330
|
4453 |
+
#: inc/class-create-archive.php:334
|
4454 |
#@ backwpup
|
4455 |
msgid "This archive method can only add one file"
|
4456 |
msgstr "Diese Archive-Methode kann nur eine einziges Datei sichern."
|
4462 |
msgid "Cannot set DB charset to %s"
|
4463 |
msgstr "Kann Datenbank-Zeichenkodierung nicht auf %s setzen."
|
4464 |
|
4465 |
+
#: inc/class-page-backwpup.php:150
|
4466 |
#@ backwpup
|
4467 |
msgid "One click backup"
|
4468 |
msgstr "Ein-Klick-Backup"
|
4475 |
msgid "Could not connect to remote host, code %d. Please try again later."
|
4476 |
msgstr "Konnte nicht zum Remote-Host verbinden, code: %s. Bitte versuchen Sie es später."
|
4477 |
|
4478 |
+
#: inc/class-create-archive.php:226
|
4479 |
#, php-format
|
4480 |
#@ backwpup
|
4481 |
msgctxt "File path to add to archive"
|
4482 |
msgid "File %s does not exist or is not readable"
|
4483 |
msgstr "Die Datei %s existiert nicht, oder sie ist nicht lesbar."
|
4484 |
|
4485 |
+
#: inc/class-page-backwpup.php:152
|
4486 |
#@ backwpup
|
4487 |
msgid "Download database backup"
|
4488 |
msgstr "Datenbank-Backup herunterladen"
|
4501 |
msgid "Your license for the plugin %s is not valid. The auto-update has been deactivated."
|
4502 |
msgstr "Der Lizenzschlüssel für das Plugin %s ist ungültig. Die automatische Aktualisierung wurde abgeschaltet."
|
4503 |
|
4504 |
+
#: inc/class-job.php:268
|
4505 |
#, php-format
|
4506 |
#@ backwpup
|
4507 |
msgctxt "Plugin name; Plugin Version; WordPress Version"
|
4518 |
msgid "Please go to your plugin page and active the license to have the autoupdates enabled."
|
4519 |
msgstr "Bitte gehen Sie auf die Plugin-Seite, und aktivieren Sie die Lizenz, um automatische Aktualisierungen zu aktivieren."
|
4520 |
|
4521 |
+
#: inc/class-admin.php:127
|
4522 |
#: inc/class-help.php:28
|
4523 |
#@ backwpup
|
4524 |
msgid "http://wordpress.org/support/plugin/backwpup/"
|
4525 |
msgstr "http://wordpress.org/support/plugin/backwpup/"
|
4526 |
|
4527 |
+
#: inc/class-admin.php:127
|
4528 |
#: inc/class-help.php:28
|
4529 |
#@ backwpup
|
4530 |
msgid "Support"
|
4535 |
msgid "Plugin on wordpress.org"
|
4536 |
msgstr "Plugin auf wordpress.org"
|
4537 |
|
4538 |
+
#: inc/class-job.php:1559
|
4539 |
#, php-format
|
4540 |
#@ backwpup
|
4541 |
msgctxt "Folder name"
|
4542 |
msgid "Folder %s not exists"
|
4543 |
msgstr "Verzeichnis %s existiert nicht"
|
4544 |
|
4545 |
+
#: inc/class-job.php:1563
|
4546 |
#, php-format
|
4547 |
#@ backwpup
|
4548 |
msgctxt "Folder name"
|
4749 |
#: inc/class-destination-s3-v1.php:395
|
4750 |
#: inc/class-destination-s3.php:392
|
4751 |
#: inc/features/class-destination-s3-pro.php:164
|
4752 |
+
#: inc/features/class-destination-s3-v1-pro.php:173
|
4753 |
#, php-format
|
4754 |
#@ backwpup
|
4755 |
msgid "Connected to S3 Bucket \"%1$s\" in %2$s"
|
4760 |
msgid "Sender name"
|
4761 |
msgstr "Absender NAme"
|
4762 |
|
4763 |
+
#: inc/class-create-archive.php:316
|
4764 |
#@ backwpup
|
4765 |
msgid "Folder name cannot be empty"
|
4766 |
msgstr "Der Verzeichnis Name darf nicht leer sein"
|
4767 |
|
4768 |
+
#: inc/class-create-archive.php:321
|
4769 |
#, php-format
|
4770 |
#@ backwpup
|
4771 |
msgctxt "Folder path to add to archive"
|
4772 |
msgid "Folder %s does not exist or is not readable"
|
4773 |
msgstr "Verzeichnis %s existiert nicht oder ist nicht lesbar"
|
4774 |
|
4775 |
+
#: inc/class-create-archive.php:507
|
4776 |
#, php-format
|
4777 |
#@ backwpup
|
4778 |
msgid "Folder name \"%1$s\" too long to be saved correctly in %2$s archive!"
|
4779 |
msgstr "Verzeichnis Name \"%1$s\" ist zu lang um ihn koreckt zu speichern im %2$s Archiv"
|
4780 |
|
4781 |
+
#: inc/class-create-archive.php:509
|
4782 |
#, php-format
|
4783 |
#@ backwpup
|
4784 |
msgid "Folder path \"%1$s\" too long to be saved correctly in %2$s archive!"
|
4807 |
msgid "Backups folder %s does not exist and cannot be created. Please create it and set proper write permissions."
|
4808 |
msgstr "Backups Verzeichnis %s existiert nicht und kann nicht angelegt werden. Bitte überprüfen Sie die Berechtigungen."
|
4809 |
|
4810 |
+
#: inc/class-page-jobs.php:492
|
4811 |
#@ backwpup
|
4812 |
msgid "Working job log"
|
4813 |
msgstr "Auftrags lLog"
|
4817 |
msgid "The file name of an archive cannot be empty."
|
4818 |
msgstr "Der Dateiname eines Archivs kann nicht leer sein."
|
4819 |
|
4820 |
+
#: inc/class-admin.php:280
|
4821 |
+
#: inc/class-admin.php:286
|
4822 |
#@ backwpup
|
4823 |
msgid "Cheating, huh?"
|
4824 |
msgstr "Mogeln, wie?"
|
4825 |
|
4826 |
+
#: inc/class-admin.php:431
|
4827 |
#, php-format
|
4828 |
#@ backwpup
|
4829 |
msgid "You have activated or updated BackWPup. Please check <a href=\"%s\">this page</a>."
|
4830 |
msgstr "Du hast BackWPup aktiviert oder aktualisiert. Bitte gehe zu <a href=\"%s\">dieser Seite</a>."
|
4831 |
|
4832 |
+
#: inc/class-adminbar.php:69
|
4833 |
#@ backwpupadminbar
|
4834 |
msgid "Now Running"
|
4835 |
msgstr ""
|
4846 |
msgid "Aborted, because no progress for 2 hours!"
|
4847 |
msgstr "Abgebrochen, da seit 2 Stunden kein Fortschritt!"
|
4848 |
|
4849 |
+
#: inc/features/class-destination-dropbox-pro.php:36
|
4850 |
#@ backwpup
|
4851 |
msgid "Dropbox authentication not approved!"
|
4852 |
msgstr "Dropbox-Authentifizierung nicht angenommen!"
|
4853 |
|
4854 |
+
#: inc/class-destination-dropbox.php:238
|
4855 |
#, php-format
|
4856 |
#@ backwpup
|
4857 |
msgid "%d. Try to send backup file to Dropbox …"
|
4858 |
msgstr "%d. Versuche, das Backup zur Dropbox zu senden …"
|
4859 |
|
4860 |
+
#: inc/class-destination-dropbox.php:246
|
4861 |
+
#: inc/features/class-destination-dropbox-pro.php:137
|
4862 |
#, php-format
|
4863 |
#@ backwpup
|
4864 |
msgid "Authenticated with Dropbox of user %s"
|
4865 |
msgstr "Authentifiziert mit Dropbox von Benutzer %s"
|
4866 |
|
4867 |
+
#: inc/class-destination-dropbox.php:251
|
4868 |
#@ backwpup
|
4869 |
msgid "Your Dropbox appears to be full."
|
4870 |
msgstr "Deine Dropbox scheint voll zu sein."
|
4871 |
|
4872 |
+
#: inc/class-destination-dropbox.php:256
|
4873 |
+
#: inc/features/class-destination-dropbox-pro.php:141
|
4874 |
#, php-format
|
4875 |
#@ backwpup
|
4876 |
msgid "%s available on your Dropbox"
|
4877 |
msgstr "%s verfügbar in deiner Dropbox"
|
4878 |
|
4879 |
+
#: inc/class-destination-dropbox.php:260
|
4880 |
#@ backwpup
|
4881 |
msgid "Uploading to Dropbox …"
|
4882 |
msgstr "Hochladen zur Dropbox hat begonnen …"
|
4883 |
|
4884 |
+
#: inc/class-destination-dropbox.php:270
|
4885 |
#@ backwpup
|
4886 |
msgid "Uploaded file size and local file size don't match."
|
4887 |
msgstr "Größe der lokalen und der hochgeladenen Datei ist nicht identisch."
|
4888 |
|
4889 |
+
#: inc/class-destination-dropbox.php:319
|
4890 |
#, php-format
|
4891 |
#@ backwpup
|
4892 |
msgid "Error while deleting file from Dropbox: %s"
|
4893 |
msgstr "Fehler beim Löschen der Datei aus der Dropbox: %s"
|
4894 |
|
4895 |
+
#: inc/class-destination-dropbox.php:322
|
4896 |
#, php-format
|
4897 |
#@ backwpup
|
4898 |
msgid "One file deleted from Dropbox"
|
4974 |
msgid "- Use site settings: retrieves the e-mail settings of your site. -PHP mail(): needs more PHP memory"
|
4975 |
msgstr "- Verwende Website-Einstelllung: verwendet die Einstellungen der Website. - PHP mail(): verbraucht viel PHP Memory\\\""
|
4976 |
|
4977 |
+
#: inc/class-destination-email.php:225
|
4978 |
#, php-format
|
4979 |
#@ backwpup
|
4980 |
msgid "%d. Trying to send backup with e-mail…"
|
4981 |
msgstr "%d. Versuche, Backup als E-Mail zu senden…"
|
4982 |
|
4983 |
+
#: inc/class-destination-email.php:230
|
4984 |
#@ backwpup
|
4985 |
msgid "Backup archive too big to be sent by e-mail!"
|
4986 |
msgstr "Das Datensicherungsarchiv ist zu groß zum Senden via E-Mail!"
|
4987 |
|
4988 |
+
#: inc/class-destination-email.php:237
|
4989 |
#, php-format
|
4990 |
#@ backwpup
|
4991 |
msgid "Sending e-mail to %s…"
|
4992 |
msgstr "Sende E-Mail an %s…"
|
4993 |
|
4994 |
+
#: inc/class-destination-email.php:326
|
4995 |
+
#: inc/class-destination-email.php:447
|
4996 |
#@ backwpup
|
4997 |
msgid "Error while sending e-mail!"
|
4998 |
msgstr "Fehler beim Senden der E-Mail"
|
4999 |
|
5000 |
+
#: inc/class-destination-email.php:332
|
5001 |
+
#: inc/class-destination-email.php:449
|
5002 |
#@ backwpup
|
5003 |
msgid "E-Mail sent."
|
5004 |
msgstr "E-Mail gesendet."
|
5005 |
|
5006 |
+
#: inc/class-destination-email.php:434
|
5007 |
#@ backwpup
|
5008 |
msgid "If this message reaches your inbox, sending backup archives via e-mail should work for you."
|
5009 |
msgstr "Wenn dich diese Nachricht erreicht, funktioniert das Senden der Sicherungsarchive per E-Mail."
|
5106 |
msgstr[0] "Eine Datei vom FTP-Server gelöscht"
|
5107 |
msgstr[1] "%d Dateien vom FTP-Server gelöscht"
|
5108 |
|
5109 |
+
#: inc/class-destination-msazure.php:222
|
5110 |
#, php-format
|
5111 |
#@ backwpup
|
5112 |
msgid "%d. Try sending backup to a Microsoft Azure (Blob) …"
|
5113 |
msgstr "%d. Versuche, das Backup zu Microsoft Azure (Blob) zu senden …"
|
5114 |
|
5115 |
+
#: inc/class-destination-msazure.php:247
|
5116 |
#@ backwpup
|
5117 |
msgid "Starting upload to MS Azure …"
|
5118 |
msgstr "Hochladen zu MS Azure hat begonnen …"
|
5119 |
|
5120 |
+
#: inc/class-destination-msazure.php:380
|
5121 |
#@ backwpup
|
5122 |
msgid "Missing account name!"
|
5123 |
msgstr "Kontoname (Benutzername) nicht angegeben!"
|
5124 |
|
5125 |
+
#: inc/class-destination-msazure.php:386
|
5126 |
#@ backwpup
|
5127 |
msgid "No container found!"
|
5128 |
msgstr "Kein Container gefunden!"
|
5129 |
|
5130 |
+
#: inc/class-destination-rsc.php:451
|
5131 |
#@ backwpup
|
5132 |
msgid "Missing username!"
|
5133 |
msgstr "Fehlender Benutzername!"
|
5134 |
|
5135 |
+
#: inc/class-destination-rsc.php:457
|
5136 |
#@ backwpup
|
5137 |
msgid "A container could not be found!"
|
5138 |
msgstr "Kein Container gefunden!"
|
5205 |
msgid "%1$s version %2$s. A project by <a href=\"http://inpsyde.com\">Inpsyde GmbH</a>. Developed by <a href=\"http://danielhuesken.de\">Daniel Hüsken</a>."
|
5206 |
msgstr "%1$s version %2$s. Ein Projekt der <a href=\"http://inpsyde.com\">Inpsyde GmbH</a>. Entwickler: <a href=\"http://danielhuesken.de\">Daniel Hüsken</a>."
|
5207 |
|
5208 |
+
#: inc/class-job.php:879
|
5209 |
#@ backwpup
|
5210 |
msgid "Script stopped! Will start again."
|
5211 |
msgstr "Script angehalten! Wird neu gestartet."
|
5212 |
|
5213 |
+
#: inc/class-jobtype-dbcheck.php:79
|
|
|
|
|
|
|
|
|
|
|
5214 |
#, php-format
|
5215 |
#@ backwpup
|
5216 |
msgid "%d. Trying to check database …"
|
5217 |
msgstr "%d. Versuche, die Datenbank zu prüfen …"
|
5218 |
|
5219 |
+
#: inc/class-jobtype-dbcheck.php:111
|
5220 |
#, php-format
|
5221 |
#@ backwpup
|
5222 |
msgid "Table %1$s is a view. Not checked."
|
5227 |
msgid "Creates an .sql database dump file"
|
5228 |
msgstr "Erstellt ein Datenbank-Backup (.sql, .xml)"
|
5229 |
|
5230 |
+
#: inc/class-jobtype-dbdump.php:155
|
5231 |
+
#: inc/features/class-jobtype-dbdump-pro.php:451
|
5232 |
#, php-format
|
5233 |
#@ backwpup
|
5234 |
msgid "%d. Try to dump database …"
|
5235 |
msgstr "%d. Versuche, Datenbank-Backup zu erstellen …"
|
5236 |
|
5237 |
+
#: inc/class-jobtype-dboptimize.php:58
|
5238 |
#@ backwpup
|
5239 |
msgid "Optimize will be done with OPTIMIZE TABLE `table`."
|
5240 |
msgstr "Optimierung wird erstellt mit OPTIMIZE TABLE `table`."
|
5241 |
|
5242 |
+
#: inc/class-jobtype-dboptimize.php:90
|
5243 |
#, php-format
|
5244 |
#@ backwpup
|
5245 |
msgid "%d. Trying to optimize database …"
|
5246 |
msgstr "%d. Versuche die Datenbank zu optimieren …"
|
5247 |
|
5248 |
+
#: inc/class-jobtype-dboptimize.php:119
|
5249 |
#, php-format
|
5250 |
#@ backwpup
|
5251 |
msgid "Views cannot optimize! View %1$s"
|
5252 |
msgstr "Views kann nicht optimieren! View %1$s"
|
5253 |
|
5254 |
+
#: inc/class-jobtype-dboptimize.php:143
|
5255 |
#@ backwpup
|
5256 |
msgid "Database optimization done!"
|
5257 |
msgstr "Datenbank-Backup fertig!"
|
5305 |
msgstr "Alle Plugin-Informationen"
|
5306 |
|
5307 |
#: inc/class-mysqldump.php:90
|
5308 |
+
#: inc/features/class-jobtype-dbdump-pro.php:666
|
5309 |
#, php-format
|
5310 |
#@ backwpup
|
5311 |
msgid "Cannot connect to MySQL database %1$d: %2$s"
|
5312 |
msgstr "Kann keine Verbindung zur Datenbank %1$d herstellen: %2$s"
|
5313 |
|
5314 |
+
#: inc/class-mysqldump.php:401
|
5315 |
#@ backwpup
|
5316 |
msgid "Error while writing file!"
|
5317 |
msgstr "Fehler beim Schreiben!"
|
5342 |
msgid "Google Storage is now a part of S3 service settings"
|
5343 |
msgstr "Google Storage ist jetzt Teil der S3-Einstellungen"
|
5344 |
|
5345 |
+
#: inc/class-page-backups.php:147
|
5346 |
#@ backwpup
|
5347 |
msgid "No files could be found. (List will be generated during next backup.)"
|
5348 |
msgstr "Keine Dateien gefunden. (Liste wird beim nächsten Backup generiert.)"
|
5349 |
|
5350 |
+
#: inc/class-page-backups.php:288
|
5351 |
#@ backwpup
|
5352 |
msgid ""
|
5353 |
"You are about to delete this backup archive. \n"
|
5356 |
"Sie sind dabei dieses Datensicherungsarchiv zu löschen. \n"
|
5357 |
" 'Abbrechen' um zu stoppen, 'OK' um zu löschen."
|
5358 |
|
5359 |
+
#: inc/class-page-backups.php:334
|
5360 |
+
#: inc/class-page-backups.php:346
|
5361 |
#: inc/class-page-editjob.php:41
|
5362 |
#: inc/class-page-jobs.php:312
|
5363 |
#@ backwpup
|
5364 |
msgid "Sorry, you don't have permissions to do that."
|
5365 |
msgstr "Sie haben nicht die notwendigen Berechtigungen für diese Aktion."
|
5366 |
|
5367 |
+
#: inc/class-page-backwpup.php:131
|
5368 |
#@ backwpup
|
5369 |
msgid "First Steps"
|
5370 |
msgstr "Erste Schritte"
|
5371 |
|
5372 |
+
#: inc/class-page-backwpup.php:152
|
5373 |
#@ backwpup
|
5374 |
msgid "Generate a database backup of WordPress tables and download it right away!"
|
5375 |
msgstr "Generieren Sie ein Datenbank-Backup der WordPress-Tabellen und laden Sie es gleich herunter!"
|
5376 |
|
5377 |
+
#: inc/class-page-backwpup.php:210
|
5378 |
#@ backwpup
|
5379 |
msgid "OK"
|
5380 |
msgstr "OK"
|
5381 |
|
5382 |
+
#: inc/class-page-editjob.php:421
|
5383 |
#@ backwpup
|
5384 |
msgid "Please name this job."
|
5385 |
msgstr "Bitte benennen Sie diesen Auftrag."
|
5386 |
|
5387 |
+
#: inc/class-page-editjob.php:429
|
5388 |
#@ backwpup
|
5389 |
msgid "Job Tasks"
|
5390 |
msgstr "Auftragsdetails"
|
5391 |
|
5392 |
+
#: inc/class-page-editjob.php:433
|
5393 |
#: inc/features/class-wizard-job.php:225
|
5394 |
#@ backwpup
|
5395 |
msgid "This job is a …"
|
5396 |
msgstr "Dieser Auftrag ist ein …"
|
5397 |
|
5398 |
+
#: inc/class-page-editjob.php:452
|
5399 |
#@ backwpup
|
5400 |
msgid "Backup File Creation"
|
5401 |
msgstr "Erstellen der Backup-Datei"
|
5402 |
|
5403 |
+
#: inc/class-page-editjob.php:482
|
5404 |
#, php-format
|
5405 |
#@ backwpup
|
5406 |
msgid "%d = Two digit day of the month, with leading zeros"
|
5407 |
msgstr "%d = Zweistelliger Tag des Monats, mit führenden Nullen"
|
5408 |
|
5409 |
+
#: inc/class-page-editjob.php:483
|
5410 |
#, php-format
|
5411 |
#@ backwpup
|
5412 |
msgid "%j = Day of the month, without leading zeros"
|
5413 |
msgstr "%j = Tag des Monats, ohne führende Nullen"
|
5414 |
|
5415 |
+
#: inc/class-page-editjob.php:484
|
5416 |
#, php-format
|
5417 |
#@ backwpup
|
5418 |
msgid "%m = Day of the month, with leading zeros"
|
5419 |
msgstr "%m = Tag des Monats, mit führenden Nullen"
|
5420 |
|
5421 |
+
#: inc/class-page-editjob.php:485
|
5422 |
#, php-format
|
5423 |
#@ backwpup
|
5424 |
msgid "%n = Representation of the month (without leading zeros)"
|
5425 |
msgstr "%n = Monat als Zahl (ohne führende Nullen)"
|
5426 |
|
5427 |
+
#: inc/class-page-editjob.php:486
|
5428 |
#, php-format
|
5429 |
#@ backwpup
|
5430 |
msgid "%Y = Four digit representation for the year"
|
5431 |
msgstr "%Y = Vierstellige Jahreszahl"
|
5432 |
|
5433 |
+
#: inc/class-page-editjob.php:487
|
5434 |
#, php-format
|
5435 |
#@ backwpup
|
5436 |
msgid "%y = Two digit representation of the year"
|
5437 |
msgstr "%y = Zweistellige Jahreszahl"
|
5438 |
|
5439 |
+
#: inc/class-page-editjob.php:488
|
5440 |
#, php-format
|
5441 |
#@ backwpup
|
5442 |
msgid "%a = Lowercase ante meridiem (am) and post meridiem (pm)"
|
5443 |
msgstr "%a = Kleingeschriebenes ante meridiem (am) und post meridiem (pm)"
|
5444 |
|
5445 |
+
#: inc/class-page-editjob.php:489
|
5446 |
#, php-format
|
5447 |
#@ backwpup
|
5448 |
msgid "%A = Uppercase ante meridiem (AM) and post meridiem (PM)"
|
5449 |
msgstr "%A = Großgeschriebenes ante meridiem (AM) and post meridiem (PM)"
|
5450 |
|
5451 |
+
#: inc/class-page-editjob.php:490
|
5452 |
#, php-format
|
5453 |
#@ backwpup
|
5454 |
msgid "%B = Swatch Internet Time"
|
5455 |
msgstr "%B = Swatch Internet Time"
|
5456 |
|
5457 |
+
#: inc/class-page-editjob.php:491
|
5458 |
#, php-format
|
5459 |
#@ backwpup
|
5460 |
msgid "%g = Hour in 12-hour format, without leading zeros"
|
5461 |
msgstr "%g = Stunde im Zwölfstunden-Format, ohne führende Nullen"
|
5462 |
|
5463 |
+
#: inc/class-page-editjob.php:492
|
5464 |
#, php-format
|
5465 |
#@ backwpup
|
5466 |
msgid "%G = Hour in 24-hour format, without leading zeros"
|
5467 |
msgstr "%G = Stunde im 24-Stunden-Format, ohne führende Nullen"
|
5468 |
|
5469 |
+
#: inc/class-page-editjob.php:493
|
5470 |
#, php-format
|
5471 |
#@ backwpup
|
5472 |
msgid "%h = Hour in 12-hour format, with leading zeros"
|
5473 |
msgstr "%h = Stunde im Zwölfstunden-Format, mit führenden Nullen"
|
5474 |
|
5475 |
+
#: inc/class-page-editjob.php:494
|
5476 |
#, php-format
|
5477 |
#@ backwpup
|
5478 |
msgid "%H = Hour in 24-hour format, with leading zeros"
|
5479 |
msgstr "%H = Stunde im 24-Stunden-Format, mit führenden Nullen"
|
5480 |
|
5481 |
+
#: inc/class-page-editjob.php:495
|
5482 |
#, php-format
|
5483 |
#@ backwpup
|
5484 |
msgid "%i = Two digit representation of the minute"
|
5485 |
msgstr "%i = Zweistellige Minute"
|
5486 |
|
5487 |
+
#: inc/class-page-editjob.php:496
|
5488 |
#, php-format
|
5489 |
#@ backwpup
|
5490 |
msgid "%s = Two digit representation of the second"
|
5491 |
msgstr "%s = Zweistellige Sekunde"
|
5492 |
|
5493 |
+
#: inc/class-page-editjob.php:497
|
5494 |
#, php-format
|
5495 |
#@ backwpup
|
5496 |
msgid "%u = Two digit representation of the microsecond"
|
5497 |
msgstr "%u = Zweistellige Mikrosekunde"
|
5498 |
|
5499 |
+
#: inc/class-page-editjob.php:498
|
5500 |
#, php-format
|
5501 |
#@ backwpup
|
5502 |
msgid "%U = UNIX timestamp (seconds since January 1 1970 00:00:00 GMT)"
|
5503 |
msgstr "%U = UNIX-Zeitstempel (Sekunden seit dem 1. Januar 1970, 00:00:00 GMT)"
|
5504 |
|
5505 |
+
#: inc/class-page-editjob.php:521
|
5506 |
#@ backwpup
|
5507 |
msgid "PHP Zip functions will be used if available (needs less memory). Otherwise the PCLZip class will be used."
|
5508 |
msgstr "PHP-Zip-Funktionen werden verwendet, sofern verfügbar (schneller). Ansonsten wird die Klasse PCLZip verwendet."
|
5509 |
|
5510 |
+
#: inc/class-page-editjob.php:523
|
5511 |
+
#: inc/class-page-editjob.php:528
|
5512 |
+
#: inc/class-page-editjob.php:532
|
5513 |
#@ backwpup
|
5514 |
msgid "Disabled due to missing PHP function."
|
5515 |
msgstr "Deaktiviert wegen nicht verfügbarer PHP-Funktion."
|
5516 |
|
5517 |
+
#: inc/class-page-editjob.php:524
|
5518 |
#@ backwpup
|
5519 |
msgid "A tarballed, not compressed archive (fast and less memory)"
|
5520 |
msgstr "Ein TAR-Archiv, nicht komprimiert (schnell und speicherschonend)"
|
5521 |
|
5522 |
+
#: inc/class-page-editjob.php:526
|
5523 |
#@ backwpup
|
5524 |
msgid "A tarballed, GZipped archive (fast and less memory)"
|
5525 |
msgstr "Ein TAR-GZ-Archiv (schnell und speicherschonend)"
|
5526 |
|
5527 |
+
#: inc/class-page-editjob.php:530
|
5528 |
#@ backwpup
|
5529 |
msgid "A tarballed, BZipped archive (fast and less memory)"
|
5530 |
msgstr "Ein TAR-BZ-Archiv (schnell und speicherschonend)"
|
5531 |
|
5532 |
+
#: inc/class-page-editjob.php:538
|
5533 |
#@ backwpup
|
5534 |
msgid "Job Destination"
|
5535 |
msgstr "Zielordner des Auftrags"
|
5536 |
|
5537 |
+
#: inc/class-page-editjob.php:542
|
5538 |
+
#: inc/class-page-editjob.php:545
|
5539 |
#@ backwpup
|
5540 |
msgid "Where should your backup file be stored?"
|
5541 |
msgstr "Wo soll die Backup-Datei gespeichert werden?"
|
5542 |
|
5543 |
+
#: inc/class-page-editjob.php:561
|
5544 |
#@ backwpup
|
5545 |
msgid "Log Files"
|
5546 |
msgstr "Protokoll-Dateien"
|
5547 |
|
5548 |
+
#: inc/class-page-editjob.php:565
|
5549 |
#@ backwpup
|
5550 |
msgid "Send log to e-mail address"
|
5551 |
msgstr "Protokoll-Datei an E-Mail-Adresse senden"
|
5552 |
|
5553 |
+
#: inc/class-page-editjob.php:569
|
5554 |
#@ backwpup
|
5555 |
msgid "Leave empty to not have log sent."
|
5556 |
msgstr "Leer lassen, um kein Protokoll zu senden."
|
5557 |
|
5558 |
+
#: inc/class-page-editjob.php:573
|
5559 |
#@ backwpup
|
5560 |
msgid "E-Mail FROM field"
|
5561 |
msgstr "VON-Feld der E-Mail"
|
5562 |
|
5563 |
+
#: inc/class-page-editjob.php:581
|
5564 |
#@ backwpup
|
5565 |
msgid "Errors only"
|
5566 |
msgstr "Nur Fehler"
|
5567 |
|
5568 |
+
#: inc/class-page-editjob.php:586
|
5569 |
#@ backwpup
|
5570 |
msgid "Send e-mail with log only when errors occur during job execution."
|
5571 |
msgstr "Sende eine E-Mail mit Protokoll nur, wenn während des Auftrags ein Fehler aufgetreten ist."
|
5572 |
|
5573 |
+
#: inc/class-page-editjob.php:597
|
5574 |
#@ backwpup
|
5575 |
msgid "Job Schedule"
|
5576 |
msgstr "Auftragsplanung"
|
5577 |
|
5578 |
+
#: inc/class-page-editjob.php:632
|
5579 |
#@ backwpup
|
5580 |
msgid "Generate a server script file to let the job start with the server’s cron on command line interface. Alternatively use WP-CLI commands."
|
5581 |
msgstr "Erzeugen Sie ein Serverscript, um einen Auftrag per Kommandoziele auszulösen, oder benutzen Sie WP-CLI."
|
5582 |
|
5583 |
+
#: inc/class-page-jobs.php:489
|
5584 |
#, php-format
|
5585 |
#@ backwpup
|
5586 |
msgid "Job currently running: %s"
|
5587 |
msgstr "Aktueller Auftrag wird bearbeitet: %s"
|
5588 |
|
|
|
|
|
|
|
|
|
|
|
|
|
5589 |
#: inc/class-page-settings.php:120
|
5590 |
#@ backwpup
|
5591 |
msgid "Display Settings"
|
5663 |
msgid "Job ID does not exist!"
|
5664 |
msgstr "Auftragsnummer existiert nicht!"
|
5665 |
|
5666 |
+
#: inc/class-wp-cli.php:113
|
5667 |
#@ backwpup
|
5668 |
msgid "No job running"
|
5669 |
msgstr "Laufender Auftrag"
|
5670 |
|
5671 |
+
#: inc/class-wp-cli.php:116
|
5672 |
#@ backwpup
|
5673 |
msgid "Running job"
|
5674 |
msgstr "Laufender Auftrag"
|
5675 |
|
5676 |
+
#: inc/features/class-destination-dropbox-pro.php:195
|
5677 |
#, php-format
|
5678 |
#@ backwpup
|
5679 |
msgid "Folder %s deleted from Dropbox"
|
5716 |
msgid "Extra file %s copied"
|
5717 |
msgstr "Zusätzliche Datei %s kopiert"
|
5718 |
|
5719 |
+
#: inc/features/class-destination-folder-pro.php:114
|
5720 |
#, php-format
|
5721 |
#@ backwpup
|
5722 |
msgid "File %s deleted from folder"
|
5744 |
msgstr "Nicht vorhandene Dateien von der Rackspace Cloud löschen."
|
5745 |
|
5746 |
#: inc/features/class-destination-s3-pro.php:36
|
5747 |
+
#: inc/features/class-destination-s3-v1-pro.php:36
|
5748 |
#@ backwpup
|
5749 |
msgid "or set an S3 Server URL:"
|
5750 |
msgstr "oder setze eine S3-Server-URL:"
|
5751 |
|
5752 |
+
#: inc/features/class-jobtype-dbdump-pro.php:188
|
|
|
|
|
|
|
|
|
|
|
5753 |
#@ backwpup
|
5754 |
msgid "Path to mysqldump file, so a backup can be made with it. If it is correct and <em>shell_exec</em> is active, the backup will be generated with a system command. If <em>shell_exec</em> ist not active, this is disabled"
|
5755 |
msgstr "Pfad zur MySQL-Datei, mit der ein Backup erstellt werden kann. Wenn es korrekt ist und <em>shell_exec</em> funktioniert, kann das Backup mit einem Systemkommando ausgelöst werden. Dies wird deaktiviert, wenn <em>shell_exec</em> nicht verfügbar ist."
|
5756 |
|
5757 |
+
#: inc/features/class-jobtype-dbdump-pro.php:532
|
5758 |
#, php-format
|
5759 |
#@ backwpup
|
5760 |
msgid "%d. Try to dump MySQL system …"
|
5761 |
msgstr "%d. Erstelle MySQL-System-Backup …"
|
5762 |
|
5763 |
+
#: inc/features/class-jobtype-dbdump-pro.php:606
|
5764 |
#@ backwpup
|
5765 |
msgid "Compressing file …"
|
5766 |
msgstr "Datei wird komprimiert …"
|
5767 |
|
5768 |
+
#: inc/features/class-jobtype-dbdump-pro.php:645
|
5769 |
#, php-format
|
5770 |
#@ backwpup
|
5771 |
msgid "%d. Try to dump database XML …"
|
5776 |
msgid "Optimize only WordPress database tables"
|
5777 |
msgstr "Optimiere nur Tabellen der WordPress-Datenbank"
|
5778 |
|
|
|
|
|
|
|
|
|
|
|
5779 |
#: inc/features/class-jobtype-file-pro.php:15
|
5780 |
#@ backwpup
|
5781 |
msgid "Backup WordPress main files"
|
5831 |
msgid "Select one or more tasks for your backup job."
|
5832 |
msgstr "Wählen Sie eine oder mehrere Aufgaben für Ihren Backup-Auftrag."
|
5833 |
|
5834 |
+
#: inc/features/class-wizard-job.php:581
|
5835 |
#, php-format
|
5836 |
#@ backwpup
|
5837 |
msgid "New job named %s generated."
|
5838 |
msgstr "Neuer Auftrag mit dem Namen %s erstellt."
|
5839 |
|
5840 |
+
#: inc/features/class-wizard-job.php:676
|
5841 |
#@ backwpup
|
5842 |
msgid "Essential files + list of plugins"
|
5843 |
msgstr "Essenzielle Dateien und Plugin-Liste"
|
5844 |
|
5845 |
+
#: inc/features/class-wizard-job.php:677
|
5846 |
#@ backwpup
|
5847 |
msgid "Backup essential files and folders, plus a list of installed plugins."
|
5848 |
msgstr "Sichern Sie die essenziellen Dateien und Ordner, sowie eine Liste der installierten Plugins."
|
5883 |
msgid "This is not a BackWPup XML file"
|
5884 |
msgstr "Dies ist keine BackWPup-XML-Datei"
|
5885 |
|
5886 |
+
#: inc/features/class-wizard-systemtest.php:86
|
5887 |
#, php-format
|
5888 |
#@ backwpup
|
5889 |
msgid "You must run WordPress version 3.2 or higher to use this plugin. You are using version %s now."
|
5890 |
msgstr "Sie müssen WordPress in der Version 3.2 oder höher verwenden, um dieses Plugin zu benutzen. Momentan verwenden Sie Version %s."
|
5891 |
|
5892 |
+
#: inc/features/class-wizard-systemtest.php:91
|
5893 |
#, php-format
|
5894 |
#@ backwpup
|
5895 |
msgid "You must run PHP version 5.2.6 or higher to use this plugin. You are using version %s now."
|
5896 |
msgstr "Sie benötigen PHP in der Version 5.2.6 oder höher, um das Plugin zu benutzen. Momentan haben Sie Version %s."
|
5897 |
|
5898 |
+
#: inc/features/class-wizard-systemtest.php:95
|
5899 |
#, php-format
|
5900 |
#@ backwpup
|
5901 |
msgid "We recommend to run a PHP version above 5.3.2 to get the full plugin functionality. You are using version %s now."
|
5902 |
msgstr "Wir empfehlen, PHP in der Version 5.3.2 oder höher zu verwenden, um die volle Funktionalität des Plugins zu erhalten. Momentan verwenden Sie Version %s."
|
5903 |
|
5904 |
+
#: inc/features/class-wizard-systemtest.php:100
|
5905 |
#, php-format
|
5906 |
#@ backwpup
|
5907 |
msgid "You must have the MySQLi extension installed and a MySQL server version of 5.0.7 or higher to use this plugin. You are using version %s now."
|
5908 |
msgstr "Sie müssen die MySQLi-Erweiterung und MySQL-Server in der Version 5.0.7 oder höher installiert haben, um dieses Plugin zu benutzen. Momentan verwenden Sie Version %s."
|
5909 |
|
5910 |
+
#: inc/features/class-wizard-systemtest.php:105
|
5911 |
#@ backwpup
|
5912 |
msgid "You must have the PHP cURL extension installed to get the full plugin functionality."
|
5913 |
msgstr "Um dieses Plugin vollumfänglich zu nutzen, müssen Sie die Erweiterung PHP-cURL installiert haben."
|
5914 |
|
5915 |
+
#: inc/features/class-wizard-systemtest.php:149
|
5916 |
#, php-format
|
5917 |
#@ backwpup
|
5918 |
msgid "Temp folder %s not read or writable. Please set proper writing permissions."
|
5919 |
msgstr "Das Temporäre Verzeichnis %s ist nicht lesbar oder beschreibbar. Bitte setze Schreibberechtigung."
|
5920 |
|
5921 |
+
#: inc/features/class-wizard-systemtest.php:154
|
5922 |
#, php-format
|
5923 |
#@ backwpup
|
5924 |
msgid "Temp folder %s does not exist and cannot be created. Please create it and set proper writing permissions."
|
5925 |
msgstr "Das temporäre Verzeichnis %s existiert nicht, und es kann auch nicht erstellt werden. Bitte erstellen Sie es, und setzen Sie die passenden Schreibrechte."
|
5926 |
|
5927 |
+
#: inc/features/class-wizard-systemtest.php:161
|
5928 |
#, php-format
|
5929 |
#@ backwpup
|
5930 |
msgid "Logs folder %s is not readable or writable. Please set proper writing permissions."
|
5931 |
msgstr "Das Verzeichnis %s für Protokoll-Dateien ist nicht lesbar oder beschreibbar. Bitte setze Schreibberechtigung."
|
5932 |
|
5933 |
+
#: inc/features/class-wizard-systemtest.php:165
|
5934 |
#, php-format
|
5935 |
#@ backwpup
|
5936 |
msgid "Logs folder %s does not exist and cannot be created. Please create it and set proper writing permissions."
|
5980 |
msgid "Auto = Uses PHP class ZipArchive if available; otherwise uses PclZip.<br />ZipArchive = Uses less memory, but many open files at a time.<br />PclZip = Uses more memory, but only 2 open files at a time."
|
5981 |
msgstr "Auto = Nutzt die PHP-Klasse ZipArchive falls verfügbar; andernfalls wird PclZip genutzt.<br />ZipArchive = Benötigt weniger Memory, aber viele offene Dateien gleichzeitig.<br />PclZip = Benötigt mehr Memory, aber nur 2 zur gleichen Zeit offene Dateien."
|
5982 |
|
5983 |
+
#: inc/class-page-editjob.php:577
|
5984 |
#@ backwpup
|
5985 |
msgid "E-Mail \"From\" field (Name < you@your-email-address.tld >)"
|
5986 |
msgstr "\"VON\"-Feld der E-Mail (Name < email@adresse.tld >)"
|
5987 |
|
5988 |
+
#: inc/class-jobtype-dbdump.php:61
|
5989 |
+
#: inc/features/class-jobtype-dbdump-pro.php:104
|
5990 |
+
#@ backwpup
|
5991 |
+
msgid "Settings for database backup"
|
5992 |
+
msgstr "Einstellungen für das Datenbank Backup"
|
5993 |
+
|
5994 |
+
#: inc/class-jobtype-dbdump.php:65
|
5995 |
+
#: inc/features/class-jobtype-dbdump-pro.php:150
|
5996 |
+
#@ backwpup
|
5997 |
+
msgid "Tables to backup"
|
5998 |
+
msgstr "Tabellen zu sichern"
|
5999 |
+
|
6000 |
+
#: inc/features/class-jobtype-dbdump-pro.php:174
|
6001 |
+
#@ backwpup
|
6002 |
+
msgid "Database Backup type"
|
6003 |
+
msgstr "Datenbank Backup Type"
|
6004 |
+
|
6005 |
#. translators: plugin header field 'Version'
|
6006 |
#: backwpup.php:0
|
6007 |
#@ backwpup
|
6008 |
+
msgid "3.0.8"
|
6009 |
msgstr ""
|
6010 |
|
6011 |
+
#: inc/class-admin.php:448
|
6012 |
#@ backwpup
|
6013 |
+
msgid "BackWPup Role"
|
6014 |
+
msgstr "BackWPup Rolle"
|
6015 |
|
6016 |
+
#: inc/class-admin.php:452
|
6017 |
#@ backwpup
|
6018 |
+
msgid "None"
|
6019 |
+
msgstr "Keine"
|
6020 |
|
6021 |
+
#: inc/class-admin.php:463
|
|
|
6022 |
#@ backwpup
|
6023 |
+
msgid "Role that the user have on BackWPup"
|
6024 |
+
msgstr "Rolle die dieser Benutzer hat bei BackWPup"
|
6025 |
|
6026 |
+
#: inc/class-destination-dropbox.php:39
|
|
|
6027 |
#@ backwpup
|
6028 |
+
msgid "Dropbox authentication not approved"
|
6029 |
+
msgstr "Dropbox authentifizierung nicht akzeptiert"
|
6030 |
|
6031 |
+
#: inc/class-job.php:1161
|
6032 |
+
#: inc/class-page-jobs.php:637
|
6033 |
+
#, php-format
|
6034 |
#@ backwpup
|
6035 |
+
msgid "Job has ended with errors in %s seconds. You must resolve the errors for correct execution."
|
6036 |
+
msgstr "Job mit Fehlern beendet in %s Sekunden. Sie müssen die Fehler für eine korrekte Ausführung beheben."
|
6037 |
+
|
6038 |
+
#: inc/class-job.php:1163
|
6039 |
+
#: inc/class-page-jobs.php:639
|
6040 |
+
#, php-format
|
6041 |
+
#@ backwpup
|
6042 |
+
msgid "Job has done with warnings in %s seconds. Please resolve them for correct execution."
|
6043 |
+
msgstr "Job mit Warnungen beendet in %s Sekunden. Sie beheben Sie die Warnungen für eine korrekte Ausführung."
|
6044 |
+
|
6045 |
+
#: inc/class-page-settings.php:384
|
6046 |
+
#: inc/features/class-wizard-systemtest.php:188
|
6047 |
+
#, php-format
|
6048 |
+
#@ backwpup
|
6049 |
+
msgid "The BackWPup HTTP response header gives back the false value \"%s\""
|
6050 |
+
msgstr "Der BackWPup HTTP Antwort Kopf gibt einen falschen wert zurück \"%s\""
|
6051 |
+
|
6052 |
+
#: inc/class-wp-cli.php:46
|
6053 |
+
#: inc/class-wp-cli.php:115
|
6054 |
+
#@ backwpup
|
6055 |
+
msgid "Running file can't read. tra again."
|
6056 |
+
msgstr "Laufzeit Datei kann nicht gelesen werden. Bitte versuchen Sie es erneut."
|
6057 |
+
|
6058 |
+
#: inc/features/class-destination-dropbox-pro.php:190
|
6059 |
+
#@ backwpup
|
6060 |
+
msgid "Delete not existing files from Dropbox"
|
6061 |
+
msgstr "Lösche nicht mehr existirende Dateien von der Dropbox"
|
6062 |
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: inpsyde, danielhuesken, Bueltge, nullbyte
|
|
3 |
Tags: backup, dump, database, file, ftp, xml, time, upload, multisite, cloud, dropbox, storage, S3
|
4 |
Requires at least: 3.2
|
5 |
Tested up to: 3.5.1
|
6 |
-
Stable tag: 3.0.
|
7 |
License: GPLv3
|
8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
|
@@ -179,6 +179,23 @@ Please check all settings after the update:
|
|
179 |
|
180 |
|
181 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
182 |
= Version 3.0.8 =
|
183 |
* Fixed: Selected database tables not save on tab change
|
184 |
* Fixed: Database tables selection on new job
|
3 |
Tags: backup, dump, database, file, ftp, xml, time, upload, multisite, cloud, dropbox, storage, S3
|
4 |
Requires at least: 3.2
|
5 |
Tested up to: 3.5.1
|
6 |
+
Stable tag: 3.0.9
|
7 |
License: GPLv3
|
8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
|
179 |
|
180 |
|
181 |
== Changelog ==
|
182 |
+
= Version 3.0.9 =
|
183 |
+
* Fixed: Fixed bug in Dropbox temp file fallback
|
184 |
+
* Fixed: Not working if WP-Cron Control active
|
185 |
+
* PRO Fixed: Synchronisation of files to Dropbox
|
186 |
+
* PRO Changed: About page only displays on new installation not on updates
|
187 |
+
* Added: Sending auth cookie for self requests
|
188 |
+
* Added: Displaying off last error or waring in execution screen
|
189 |
+
* Added: Job end message depending on error's or waring's
|
190 |
+
* Added: Setting of BackWPup role in the user settings
|
191 |
+
* Improved: Wait time after job start
|
192 |
+
* Improved: Rights management to work better with Role management Plugins
|
193 |
+
* Changed: Sessions now only used for wizards in pro version
|
194 |
+
* Removed: Maintenance Mode support, because to many problems and not really needed
|
195 |
+
* Updated: RSC SDK to Version 1.5.4
|
196 |
+
* Updated: AWS SDK to Version 1.6.2
|
197 |
+
* Updated: AWS SDK to Version 2.3.0 (PHP 5.3.3+)
|
198 |
+
|
199 |
= Version 3.0.8 =
|
200 |
* Fixed: Selected database tables not save on tab change
|
201 |
* Fixed: Database tables selection on new job
|
sdk/Aws/Aws/Common/Aws.php
CHANGED
@@ -27,7 +27,7 @@ class Aws extends ServiceBuilderLoader
|
|
27 |
/**
|
28 |
* @var string Current version of the SDK
|
29 |
*/
|
30 |
-
const VERSION = '2.
|
31 |
|
32 |
/**
|
33 |
* Create a new service locator for the AWS SDK
|
27 |
/**
|
28 |
* @var string Current version of the SDK
|
29 |
*/
|
30 |
+
const VERSION = '2.3.0';
|
31 |
|
32 |
/**
|
33 |
* Create a new service locator for the AWS SDK
|
sdk/Aws/Aws/Common/Client/AbstractClient.php
CHANGED
@@ -189,24 +189,28 @@ abstract class AbstractClient extends Client implements AwsClientInterface
|
|
189 |
{
|
190 |
$config = $this->getConfig();
|
191 |
$formerRegion = $config->get(Options::REGION);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
192 |
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
$signature = $this->getSignature();
|
199 |
-
if ($signature instanceof EndpointSignatureInterface) {
|
200 |
-
/** @var $signature EndpointSignatureInterface */
|
201 |
-
$signature->setRegionName($region);
|
202 |
}
|
203 |
|
204 |
-
// Dispatch an event that the region has been changed
|
205 |
-
$this->dispatch('client.region_changed', array(
|
206 |
-
'region' => $region,
|
207 |
-
'former_region' => $formerRegion,
|
208 |
-
));
|
209 |
-
|
210 |
return $this;
|
211 |
}
|
212 |
|
@@ -231,11 +235,7 @@ abstract class AbstractClient extends Client implements AwsClientInterface
|
|
231 |
}
|
232 |
|
233 |
/**
|
234 |
-
*
|
235 |
-
*
|
236 |
-
* @param WaiterFactoryInterface $waiterFactory Factory used to create waiters
|
237 |
-
*
|
238 |
-
* @return self
|
239 |
*/
|
240 |
public function setWaiterFactory(WaiterFactoryInterface $waiterFactory)
|
241 |
{
|
@@ -245,9 +245,7 @@ abstract class AbstractClient extends Client implements AwsClientInterface
|
|
245 |
}
|
246 |
|
247 |
/**
|
248 |
-
*
|
249 |
-
*
|
250 |
-
* @return WaiterFactoryInterface
|
251 |
*/
|
252 |
public function getWaiterFactory()
|
253 |
{
|
@@ -264,4 +262,12 @@ abstract class AbstractClient extends Client implements AwsClientInterface
|
|
264 |
|
265 |
return $this->waiterFactory;
|
266 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
267 |
}
|
189 |
{
|
190 |
$config = $this->getConfig();
|
191 |
$formerRegion = $config->get(Options::REGION);
|
192 |
+
$global = $this->serviceDescription->getData('globalEndpoint');
|
193 |
+
|
194 |
+
// Only change the region if the service does not have a global endpoint
|
195 |
+
if (!$global || $this->serviceDescription->getData('namespace') === 'S3') {
|
196 |
+
$baseUrl = self::getEndpoint($this->serviceDescription, $region, $config->get(Options::SCHEME));
|
197 |
+
$this->setBaseUrl($baseUrl);
|
198 |
+
$config->set(Options::BASE_URL, $baseUrl)->set(Options::REGION, $region);
|
199 |
+
|
200 |
+
// Update the signature if necessary
|
201 |
+
$signature = $this->getSignature();
|
202 |
+
if ($signature instanceof EndpointSignatureInterface) {
|
203 |
+
/** @var $signature EndpointSignatureInterface */
|
204 |
+
$signature->setRegionName($region);
|
205 |
+
}
|
206 |
|
207 |
+
// Dispatch an event that the region has been changed
|
208 |
+
$this->dispatch('client.region_changed', array(
|
209 |
+
'region' => $region,
|
210 |
+
'former_region' => $formerRegion,
|
211 |
+
));
|
|
|
|
|
|
|
|
|
212 |
}
|
213 |
|
|
|
|
|
|
|
|
|
|
|
|
|
214 |
return $this;
|
215 |
}
|
216 |
|
235 |
}
|
236 |
|
237 |
/**
|
238 |
+
* {@inheritdoc}
|
|
|
|
|
|
|
|
|
239 |
*/
|
240 |
public function setWaiterFactory(WaiterFactoryInterface $waiterFactory)
|
241 |
{
|
245 |
}
|
246 |
|
247 |
/**
|
248 |
+
* {@inheritdoc}
|
|
|
|
|
249 |
*/
|
250 |
public function getWaiterFactory()
|
251 |
{
|
262 |
|
263 |
return $this->waiterFactory;
|
264 |
}
|
265 |
+
|
266 |
+
/**
|
267 |
+
* {@inheritdoc}
|
268 |
+
*/
|
269 |
+
public function getApiVersion()
|
270 |
+
{
|
271 |
+
return $this->serviceDescription->getApiVersion();
|
272 |
+
}
|
273 |
}
|
sdk/Aws/Aws/Common/Client/AwsClientInterface.php
CHANGED
@@ -108,4 +108,11 @@ interface AwsClientInterface extends ClientInterface
|
|
108 |
* @return WaiterInterface
|
109 |
*/
|
110 |
public function getWaiter($waiter, array $input = array());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
}
|
108 |
* @return WaiterInterface
|
109 |
*/
|
110 |
public function getWaiter($waiter, array $input = array());
|
111 |
+
|
112 |
+
/**
|
113 |
+
* Get the API version of the client (e.g. 2006-03-01)
|
114 |
+
*
|
115 |
+
* @return string
|
116 |
+
*/
|
117 |
+
public function getApiVersion();
|
118 |
}
|
sdk/Aws/Aws/Common/Client/ClientBuilder.php
CHANGED
@@ -18,6 +18,7 @@ namespace Aws\Common\Client;
|
|
18 |
|
19 |
use Aws\Common\Credentials\Credentials;
|
20 |
use Aws\Common\Enum\ClientOptions as Options;
|
|
|
21 |
use Aws\Common\Exception\ExceptionListener;
|
22 |
use Aws\Common\Exception\InvalidArgumentException;
|
23 |
use Aws\Common\Exception\NamespaceExceptionFactory;
|
@@ -32,6 +33,10 @@ use Aws\Common\Signature\SignatureV3Https;
|
|
32 |
use Aws\Common\Signature\SignatureV4;
|
33 |
use Guzzle\Common\Collection;
|
34 |
use Guzzle\Plugin\Backoff\BackoffPlugin;
|
|
|
|
|
|
|
|
|
35 |
use Guzzle\Service\Client;
|
36 |
use Guzzle\Service\Description\ServiceDescription;
|
37 |
use Guzzle\Service\Resource\ResourceIteratorClassFactory;
|
@@ -194,17 +199,38 @@ class ClientBuilder
|
|
194 |
(self::$commonConfigRequirements + $this->configRequirements)
|
195 |
);
|
196 |
|
197 |
-
//
|
198 |
-
$
|
|
|
199 |
|
200 |
// Resolve credentials
|
201 |
if (!$credentials = $config->get('credentials')) {
|
202 |
$credentials = Credentials::factory($config);
|
203 |
}
|
204 |
|
|
|
|
|
|
|
|
|
|
|
|
|
205 |
$backoff = $config->get(Options::BACKOFF);
|
206 |
if ($backoff === null) {
|
207 |
-
$backoff = BackoffPlugin
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
208 |
$config->set(Options::BACKOFF, $backoff);
|
209 |
}
|
210 |
|
@@ -221,12 +247,12 @@ class ClientBuilder
|
|
221 |
|
222 |
/** @var $client AwsClientInterface */
|
223 |
$client = new $clientClass($credentials, $signature, $config);
|
224 |
-
$client->setDescription($
|
225 |
|
226 |
// Add exception marshaling so that more descriptive exception are thrown
|
227 |
if ($this->clientNamespace) {
|
228 |
$exceptionFactory = new NamespaceExceptionFactory(
|
229 |
-
$this->exceptionParser
|
230 |
"{$this->clientNamespace}\\Exception",
|
231 |
"{$this->clientNamespace}\\Exception\\{$serviceName}Exception"
|
232 |
);
|
@@ -324,6 +350,10 @@ class ClientBuilder
|
|
324 |
{
|
325 |
$description = $config->get(Options::SERVICE_DESCRIPTION);
|
326 |
if (!($description instanceof ServiceDescription)) {
|
|
|
|
|
|
|
|
|
327 |
$description = ServiceDescription::factory($description);
|
328 |
$config->set(Options::SERVICE_DESCRIPTION, $description);
|
329 |
}
|
@@ -343,15 +373,16 @@ class ClientBuilder
|
|
343 |
);
|
344 |
}
|
345 |
|
|
|
346 |
$region = $config->get(Options::REGION);
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
$region =
|
355 |
$config->set(Options::REGION, $region);
|
356 |
}
|
357 |
|
18 |
|
19 |
use Aws\Common\Credentials\Credentials;
|
20 |
use Aws\Common\Enum\ClientOptions as Options;
|
21 |
+
use Aws\Common\Enum\Region;
|
22 |
use Aws\Common\Exception\ExceptionListener;
|
23 |
use Aws\Common\Exception\InvalidArgumentException;
|
24 |
use Aws\Common\Exception\NamespaceExceptionFactory;
|
33 |
use Aws\Common\Signature\SignatureV4;
|
34 |
use Guzzle\Common\Collection;
|
35 |
use Guzzle\Plugin\Backoff\BackoffPlugin;
|
36 |
+
use Guzzle\Plugin\Backoff\CurlBackoffStrategy;
|
37 |
+
use Guzzle\Plugin\Backoff\ExponentialBackoffStrategy;
|
38 |
+
use Guzzle\Plugin\Backoff\HttpBackoffStrategy;
|
39 |
+
use Guzzle\Plugin\Backoff\TruncatedBackoffStrategy;
|
40 |
use Guzzle\Service\Client;
|
41 |
use Guzzle\Service\Description\ServiceDescription;
|
42 |
use Guzzle\Service\Resource\ResourceIteratorClassFactory;
|
199 |
(self::$commonConfigRequirements + $this->configRequirements)
|
200 |
);
|
201 |
|
202 |
+
// Resolve endpoint and signature from the config and service description
|
203 |
+
$description = $this->updateConfigFromDescription($config);
|
204 |
+
$signature = $this->getSignature($description, $config);
|
205 |
|
206 |
// Resolve credentials
|
207 |
if (!$credentials = $config->get('credentials')) {
|
208 |
$credentials = Credentials::factory($config);
|
209 |
}
|
210 |
|
211 |
+
// Resolve exception parser
|
212 |
+
if (!$this->exceptionParser) {
|
213 |
+
$this->exceptionParser = new DefaultXmlExceptionParser();
|
214 |
+
}
|
215 |
+
|
216 |
+
// Resolve backoff strategy
|
217 |
$backoff = $config->get(Options::BACKOFF);
|
218 |
if ($backoff === null) {
|
219 |
+
$backoff = new BackoffPlugin(
|
220 |
+
// Retry failed requests up to 3 times if it is determined that the request can be retried
|
221 |
+
new TruncatedBackoffStrategy(3,
|
222 |
+
// Retry failed requests with 400-level responses due to throttling
|
223 |
+
new ThrottlingErrorChecker($this->exceptionParser,
|
224 |
+
// Retry failed requests with 500-level responses
|
225 |
+
new HttpBackoffStrategy(array(500, 503, 509),
|
226 |
+
// Retry failed requests due to transient network or cURL problems
|
227 |
+
new CurlBackoffStrategy(null,
|
228 |
+
new ExponentialBackoffStrategy()
|
229 |
+
)
|
230 |
+
)
|
231 |
+
)
|
232 |
+
)
|
233 |
+
);
|
234 |
$config->set(Options::BACKOFF, $backoff);
|
235 |
}
|
236 |
|
247 |
|
248 |
/** @var $client AwsClientInterface */
|
249 |
$client = new $clientClass($credentials, $signature, $config);
|
250 |
+
$client->setDescription($description);
|
251 |
|
252 |
// Add exception marshaling so that more descriptive exception are thrown
|
253 |
if ($this->clientNamespace) {
|
254 |
$exceptionFactory = new NamespaceExceptionFactory(
|
255 |
+
$this->exceptionParser,
|
256 |
"{$this->clientNamespace}\\Exception",
|
257 |
"{$this->clientNamespace}\\Exception\\{$serviceName}Exception"
|
258 |
);
|
350 |
{
|
351 |
$description = $config->get(Options::SERVICE_DESCRIPTION);
|
352 |
if (!($description instanceof ServiceDescription)) {
|
353 |
+
// Inject the version into the sprintf template if it is a string
|
354 |
+
if (is_string($description)) {
|
355 |
+
$description = sprintf($description, $config->get(Options::VERSION));
|
356 |
+
}
|
357 |
$description = ServiceDescription::factory($description);
|
358 |
$config->set(Options::SERVICE_DESCRIPTION, $description);
|
359 |
}
|
373 |
);
|
374 |
}
|
375 |
|
376 |
+
// Make sure a valid region is set
|
377 |
$region = $config->get(Options::REGION);
|
378 |
+
$global = $description->getData('globalEndpoint');
|
379 |
+
if (!$global && !$region) {
|
380 |
+
throw new InvalidArgumentException(
|
381 |
+
'A region is required when using ' . $description->getData('serviceFullName')
|
382 |
+
. '. Set "region" to one of: ' . implode(', ', array_keys($description->getData('regions')))
|
383 |
+
);
|
384 |
+
} elseif ($global && (!$region || $description->getData('namespace') !== 'S3')) {
|
385 |
+
$region = Region::US_EAST_1;
|
386 |
$config->set(Options::REGION, $region);
|
387 |
}
|
388 |
|
sdk/Aws/Aws/Common/Client/ThrottlingErrorChecker.php
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
4 |
+
*
|
5 |
+
* Licensed under the Apache License, Version 2.0 (the "License").
|
6 |
+
* You may not use this file except in compliance with the License.
|
7 |
+
* A copy of the License is located at
|
8 |
+
*
|
9 |
+
* http://aws.amazon.com/apache2.0
|
10 |
+
*
|
11 |
+
* or in the "license" file accompanying this file. This file is distributed
|
12 |
+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
13 |
+
* express or implied. See the License for the specific language governing
|
14 |
+
* permissions and limitations under the License.
|
15 |
+
*/
|
16 |
+
|
17 |
+
namespace Aws\Common\Client;
|
18 |
+
|
19 |
+
use Aws\Common\Exception\Parser\ExceptionParserInterface;
|
20 |
+
use Guzzle\Http\Exception\HttpException;
|
21 |
+
use Guzzle\Http\Message\RequestInterface;
|
22 |
+
use Guzzle\Http\Message\Response;
|
23 |
+
use Guzzle\Plugin\Backoff\BackoffStrategyInterface;
|
24 |
+
use Guzzle\Plugin\Backoff\AbstractBackoffStrategy;
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Backoff logic that handles throttling exceptions from services
|
28 |
+
*/
|
29 |
+
class ThrottlingErrorChecker extends AbstractBackoffStrategy
|
30 |
+
{
|
31 |
+
/** @var array Whitelist of exception codes (as indexes) that indicate throttling */
|
32 |
+
protected static $throttlingExceptions = array(
|
33 |
+
'RequestLimitExceeded' => true,
|
34 |
+
'Throttling' => true,
|
35 |
+
'ThrottlingException' => true,
|
36 |
+
'ProvisionedThroughputExceededException' => true,
|
37 |
+
'RequestThrottled' => true,
|
38 |
+
);
|
39 |
+
|
40 |
+
/**
|
41 |
+
* @var ExceptionParserInterface Exception parser used to parse exception responses
|
42 |
+
*/
|
43 |
+
protected $exceptionParser;
|
44 |
+
|
45 |
+
public function __construct(ExceptionParserInterface $exceptionParser, BackoffStrategyInterface $next = null)
|
46 |
+
{
|
47 |
+
$this->exceptionParser = $exceptionParser;
|
48 |
+
if ($next) {
|
49 |
+
$this->setNext($next);
|
50 |
+
}
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* {@inheritdoc}
|
55 |
+
*/
|
56 |
+
public function makesDecision()
|
57 |
+
{
|
58 |
+
return true;
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* {@inheritdoc}
|
63 |
+
*/
|
64 |
+
protected function getDelay(
|
65 |
+
$retries,
|
66 |
+
RequestInterface $request,
|
67 |
+
Response $response = null,
|
68 |
+
HttpException $e = null
|
69 |
+
) {
|
70 |
+
if ($response && $response->isClientError()) {
|
71 |
+
$parts = $this->exceptionParser->parse($response);
|
72 |
+
|
73 |
+
return isset(self::$throttlingExceptions[$parts['code']]) ? true : null;
|
74 |
+
}
|
75 |
+
}
|
76 |
+
}
|
sdk/Aws/Aws/Common/Client/UploadBodyListener.php
CHANGED
@@ -83,10 +83,6 @@ class UploadBodyListener implements EventSubscriberInterface
|
|
83 |
|
84 |
if (null !== $body) {
|
85 |
$body = EntityBody::factory($body);
|
86 |
-
// Apply a ContentType parameter to the command if one is not present
|
87 |
-
if (!$command->get('ContentType') && $command->getOperation()->hasParam('ContentType')) {
|
88 |
-
$command->set('ContentType', $body->getContentType());
|
89 |
-
}
|
90 |
}
|
91 |
|
92 |
// Prepare the body parameter and remove the source file parameter
|
83 |
|
84 |
if (null !== $body) {
|
85 |
$body = EntityBody::factory($body);
|
|
|
|
|
|
|
|
|
86 |
}
|
87 |
|
88 |
// Prepare the body parameter and remove the source file parameter
|
sdk/Aws/Aws/Common/Client/UserAgentListener.php
CHANGED
@@ -50,7 +50,10 @@ class UserAgentListener implements EventSubscriberInterface
|
|
50 |
$request = $command->getRequest();
|
51 |
$userAgent = (string) $request->getHeader('User-Agent');
|
52 |
foreach ((array) $userAgentAppends as $append) {
|
53 |
-
$
|
|
|
|
|
|
|
54 |
}
|
55 |
$request->setHeader('User-Agent', $userAgent);
|
56 |
}
|
50 |
$request = $command->getRequest();
|
51 |
$userAgent = (string) $request->getHeader('User-Agent');
|
52 |
foreach ((array) $userAgentAppends as $append) {
|
53 |
+
$append = ' ' . $append;
|
54 |
+
if (strpos($userAgent, $append) === false) {
|
55 |
+
$userAgent .= $append;
|
56 |
+
}
|
57 |
}
|
58 |
$request->setHeader('User-Agent', $userAgent);
|
59 |
}
|
sdk/Aws/Aws/Common/Enum/ClientOptions.php
CHANGED
@@ -143,4 +143,9 @@ class ClientOptions extends Enum
|
|
143 |
* @var bool Set to false to disable validation
|
144 |
*/
|
145 |
const VALIDATION = 'validation';
|
|
|
|
|
|
|
|
|
|
|
146 |
}
|
143 |
* @var bool Set to false to disable validation
|
144 |
*/
|
145 |
const VALIDATION = 'validation';
|
146 |
+
|
147 |
+
/**
|
148 |
+
* @var string API version used by the client
|
149 |
+
*/
|
150 |
+
const VERSION = 'version';
|
151 |
}
|
sdk/Aws/Aws/Common/Resources/aws-config.php
CHANGED
@@ -69,6 +69,13 @@ return array(
|
|
69 |
'class' => 'Aws\DynamoDb\DynamoDbClient'
|
70 |
),
|
71 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
'ec2' => array(
|
73 |
'alias' => 'Ec2',
|
74 |
'extends' => 'default_settings',
|
69 |
'class' => 'Aws\DynamoDb\DynamoDbClient'
|
70 |
),
|
71 |
|
72 |
+
'dynamodb_20111205' => array(
|
73 |
+
'extends' => 'dynamodb',
|
74 |
+
'params' => array(
|
75 |
+
'version' => '2011-12-05'
|
76 |
+
)
|
77 |
+
),
|
78 |
+
|
79 |
'ec2' => array(
|
80 |
'alias' => 'Ec2',
|
81 |
'extends' => 'default_settings',
|
sdk/Aws/Aws/Glacier/GlacierClient.php
CHANGED
@@ -54,6 +54,8 @@ use Guzzle\Service\Resource\Model;
|
|
54 |
*/
|
55 |
class GlacierClient extends AbstractClient
|
56 |
{
|
|
|
|
|
57 |
/**
|
58 |
* Factory method to create a new Amazon Glacier client using an array of configuration options:
|
59 |
*
|
@@ -101,7 +103,8 @@ class GlacierClient extends AbstractClient
|
|
101 |
$client = ClientBuilder::factory(__NAMESPACE__)
|
102 |
->setConfig($config)
|
103 |
->setConfigDefaults(array(
|
104 |
-
Options::
|
|
|
105 |
// Set default value for "accountId" for all requests
|
106 |
'command.params' => array(
|
107 |
'accountId' => '-',
|
54 |
*/
|
55 |
class GlacierClient extends AbstractClient
|
56 |
{
|
57 |
+
const LATEST_API_VERSION = '2012-06-01';
|
58 |
+
|
59 |
/**
|
60 |
* Factory method to create a new Amazon Glacier client using an array of configuration options:
|
61 |
*
|
103 |
$client = ClientBuilder::factory(__NAMESPACE__)
|
104 |
->setConfig($config)
|
105 |
->setConfigDefaults(array(
|
106 |
+
Options::VERSION => self::LATEST_API_VERSION,
|
107 |
+
Options::SERVICE_DESCRIPTION => __DIR__ . '/Resources/glacier-%s.php',
|
108 |
// Set default value for "accountId" for all requests
|
109 |
'command.params' => array(
|
110 |
'accountId' => '-',
|
sdk/Aws/Aws/S3/Model/PostObject.php
CHANGED
@@ -83,8 +83,6 @@ class PostObject extends Collection
|
|
83 |
* @param S3Client $client
|
84 |
* @param $bucket
|
85 |
* @param array $options
|
86 |
-
*
|
87 |
-
* @throws InvalidArgumentException if the bucket name is invalid
|
88 |
*/
|
89 |
public function __construct(S3Client $client, $bucket, array $options = array())
|
90 |
{
|
@@ -208,16 +206,10 @@ class PostObject extends Collection
|
|
208 |
* @param string $bucket
|
209 |
*
|
210 |
* @return PostObject
|
211 |
-
*
|
212 |
-
* @throws InvalidArgumentException
|
213 |
*/
|
214 |
public function setBucket($bucket)
|
215 |
{
|
216 |
-
|
217 |
-
$this->bucket = $bucket;
|
218 |
-
} else {
|
219 |
-
throw new InvalidArgumentException('The bucket name provided was invalid.');
|
220 |
-
}
|
221 |
|
222 |
return $this;
|
223 |
}
|
83 |
* @param S3Client $client
|
84 |
* @param $bucket
|
85 |
* @param array $options
|
|
|
|
|
86 |
*/
|
87 |
public function __construct(S3Client $client, $bucket, array $options = array())
|
88 |
{
|
206 |
* @param string $bucket
|
207 |
*
|
208 |
* @return PostObject
|
|
|
|
|
209 |
*/
|
210 |
public function setBucket($bucket)
|
211 |
{
|
212 |
+
$this->bucket = $bucket;
|
|
|
|
|
|
|
|
|
213 |
|
214 |
return $this;
|
215 |
}
|
sdk/Aws/Aws/S3/S3Client.php
CHANGED
@@ -100,6 +100,8 @@ use Guzzle\Service\Command\Factory\CompositeFactory;
|
|
100 |
*/
|
101 |
class S3Client extends AbstractClient
|
102 |
{
|
|
|
|
|
103 |
/**
|
104 |
* @var array Aliases for S3 operations
|
105 |
*/
|
@@ -198,7 +200,8 @@ class S3Client extends AbstractClient
|
|
198 |
->setConfig($config)
|
199 |
->setConfigDefaults(array(
|
200 |
Options::SIGNATURE => new S3Signature(),
|
201 |
-
Options::
|
|
|
202 |
))
|
203 |
->setExceptionParser(new S3ExceptionParser())
|
204 |
->setIteratorsConfig(array(
|
@@ -270,7 +273,7 @@ class S3Client extends AbstractClient
|
|
270 |
// Cannot look like an IP address
|
271 |
|| preg_match('/^\d+\.\d+\.\d+\.\d+$/', $bucket)
|
272 |
// Cannot include special characters, must start and end with lower alnum
|
273 |
-
|| !preg_match('/^[a-z0-9]
|
274 |
return false;
|
275 |
}
|
276 |
|
@@ -411,6 +414,18 @@ class S3Client extends AbstractClient
|
|
411 |
return explode('/', $key && $key[0] == '/' ? substr($key, 1) : $key);
|
412 |
}
|
413 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
414 |
/**
|
415 |
* Determines whether or not a resource exists using a command
|
416 |
*
|
100 |
*/
|
101 |
class S3Client extends AbstractClient
|
102 |
{
|
103 |
+
const LATEST_API_VERSION = '2006-03-01';
|
104 |
+
|
105 |
/**
|
106 |
* @var array Aliases for S3 operations
|
107 |
*/
|
200 |
->setConfig($config)
|
201 |
->setConfigDefaults(array(
|
202 |
Options::SIGNATURE => new S3Signature(),
|
203 |
+
Options::VERSION => self::LATEST_API_VERSION,
|
204 |
+
Options::SERVICE_DESCRIPTION => __DIR__ . '/Resources/s3-%s.php'
|
205 |
))
|
206 |
->setExceptionParser(new S3ExceptionParser())
|
207 |
->setIteratorsConfig(array(
|
273 |
// Cannot look like an IP address
|
274 |
|| preg_match('/^\d+\.\d+\.\d+\.\d+$/', $bucket)
|
275 |
// Cannot include special characters, must start and end with lower alnum
|
276 |
+
|| !preg_match('/^[a-z0-9][a-z0-9\-.]*[a-z0-9]?$/', $bucket)) {
|
277 |
return false;
|
278 |
}
|
279 |
|
414 |
return explode('/', $key && $key[0] == '/' ? substr($key, 1) : $key);
|
415 |
}
|
416 |
|
417 |
+
/**
|
418 |
+
* Register the Amazon S3 stream wrapper and associates it with this client object
|
419 |
+
*
|
420 |
+
* @return self
|
421 |
+
*/
|
422 |
+
public function registerStreamWrapper()
|
423 |
+
{
|
424 |
+
StreamWrapper::register($this);
|
425 |
+
|
426 |
+
return $this;
|
427 |
+
}
|
428 |
+
|
429 |
/**
|
430 |
* Determines whether or not a resource exists using a command
|
431 |
*
|
sdk/Aws/Aws/S3/StreamWrapper.php
ADDED
@@ -0,0 +1,738 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
4 |
+
*
|
5 |
+
* Licensed under the Apache License, Version 2.0 (the "License").
|
6 |
+
* You may not use this file except in compliance with the License.
|
7 |
+
* A copy of the License is located at
|
8 |
+
*
|
9 |
+
* http://aws.amazon.com/apache2.0
|
10 |
+
*
|
11 |
+
* or in the "license" file accompanying this file. This file is distributed
|
12 |
+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
13 |
+
* express or implied. See the License for the specific language governing
|
14 |
+
* permissions and limitations under the License.
|
15 |
+
*/
|
16 |
+
|
17 |
+
namespace Aws\S3;
|
18 |
+
|
19 |
+
use Aws\Common\Exception\RuntimeException;
|
20 |
+
use Aws\S3\Exception\S3Exception;
|
21 |
+
use Aws\S3\Exception\NoSuchKeyException;
|
22 |
+
use Aws\S3\Iterator\ListObjectsIterator;
|
23 |
+
use Guzzle\Http\QueryString;
|
24 |
+
use Guzzle\Http\EntityBody;
|
25 |
+
use Guzzle\Http\CachingEntityBody;
|
26 |
+
use Guzzle\Stream\PhpStreamRequestFactory;
|
27 |
+
use Guzzle\Service\Command\CommandInterface;
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Amazon S3 stream wrapper to use "s3://<bucket>/<key>" files with PHP streams, supporting "r", "w", "a", "x".
|
31 |
+
*
|
32 |
+
* # Supported stream related PHP functions:
|
33 |
+
* - fopen, fclose, fread, fwrite, fseek, ftell, feof, fflush
|
34 |
+
* - opendir, closedir, readdir, rewinddir
|
35 |
+
* - copy, rename, unlink
|
36 |
+
* - mkdir, rmdir, rmdir (recursive)
|
37 |
+
* - file_get_contents, file_put_contents
|
38 |
+
* - file_exists, filesize, is_file, is_dir
|
39 |
+
*
|
40 |
+
* # Opening "r" (read only) streams:
|
41 |
+
*
|
42 |
+
* Read only streams are truly streaming by default and will not allow you to seek. This is because data
|
43 |
+
* read from the stream is not kept in memory or on the local filesystem. You can force a "r" stream to be seekable
|
44 |
+
* by setting the "seekable" stream context option true. This will allow true streaming of data from Amazon S3, but
|
45 |
+
* will maintain a buffer of previously read bytes in a 'php://temp' stream to allow seeking to previously read bytes
|
46 |
+
* from the stream.
|
47 |
+
*
|
48 |
+
* You may pass any GetObject parameters as 's3' stream context options. These options will affect how the data is
|
49 |
+
* downloaded from Amazon S3.
|
50 |
+
*
|
51 |
+
* # Opening "w" and "x" (write only) streams:
|
52 |
+
*
|
53 |
+
* Because Amazon S3 requires a Content-Length header, write only streams will maintain a 'php://temp' stream to buffer
|
54 |
+
* data written to the stream until the stream is flushed (usually by closing the stream with fclose).
|
55 |
+
*
|
56 |
+
* You may pass any PutObject parameters as 's3' stream context options. These options will affect how the data is
|
57 |
+
* uploaded to Amazon S3.
|
58 |
+
*
|
59 |
+
* When opening an "x" stream, the file must exist on Amazon S3 for the stream to open successfully.
|
60 |
+
*
|
61 |
+
* # Opening "a" (write only append) streams:
|
62 |
+
*
|
63 |
+
* Similar to "w" streams, opening append streams requires that the data be buffered in a "php://temp" stream. Append
|
64 |
+
* streams will attempt to download the contents of an object in Amazon S3, seek to the end of the object, then allow
|
65 |
+
* you to append to the contents of the object. The data will then be uploaded using a PutObject operation when the
|
66 |
+
* stream is flushed (usually with fclose).
|
67 |
+
*
|
68 |
+
* You may pass any GetObject and/or PutObject parameters as 's3' stream context options. These options will affect how
|
69 |
+
* the data is downloaded and uploaded from Amazon S3.
|
70 |
+
*
|
71 |
+
* Stream context options:
|
72 |
+
*
|
73 |
+
* - "seekable": Set to true to create a seekable "r" (read only) stream by using a php://temp stream buffer
|
74 |
+
* - "throw_exceptions": Set to true to throw exceptions instead of trigger_errors
|
75 |
+
* - For "unlink" only: Any option that can be passed to the DeleteObject operation
|
76 |
+
*/
|
77 |
+
class StreamWrapper
|
78 |
+
{
|
79 |
+
/**
|
80 |
+
* @var resource|null Stream context (this is set by PHP when a context is used)
|
81 |
+
*/
|
82 |
+
public $context;
|
83 |
+
|
84 |
+
/**
|
85 |
+
* @var S3Client Client used to send requests
|
86 |
+
*/
|
87 |
+
protected static $client;
|
88 |
+
|
89 |
+
/**
|
90 |
+
* @var string Mode the stream was opened with
|
91 |
+
*/
|
92 |
+
protected $mode;
|
93 |
+
|
94 |
+
/**
|
95 |
+
* @var EntityBody Underlying stream resource
|
96 |
+
*/
|
97 |
+
protected $body;
|
98 |
+
|
99 |
+
/**
|
100 |
+
* @var array Current parameters to use with the flush operation
|
101 |
+
*/
|
102 |
+
protected $params;
|
103 |
+
|
104 |
+
/**
|
105 |
+
* @var ListObjectsIterator Iterator used with opendir() and subsequent readdir() calls
|
106 |
+
*/
|
107 |
+
protected $objectIterator;
|
108 |
+
|
109 |
+
/**
|
110 |
+
* @var string The bucket that was opened when opendir() was called
|
111 |
+
*/
|
112 |
+
protected $openedBucket;
|
113 |
+
|
114 |
+
/**
|
115 |
+
* @var string The prefix of the bucket that was opened with opendir()
|
116 |
+
*/
|
117 |
+
protected $openedBucketPrefix;
|
118 |
+
|
119 |
+
/**
|
120 |
+
* @var array The next key to retrieve when using a directory iterator. Helps for fast directory traversal.
|
121 |
+
*/
|
122 |
+
protected static $nextStat = array();
|
123 |
+
|
124 |
+
/**
|
125 |
+
* Register the 's3://' stream wrapper
|
126 |
+
*
|
127 |
+
* @param S3Client $client Client to use with the stream wrapper
|
128 |
+
*/
|
129 |
+
public static function register(S3Client $client)
|
130 |
+
{
|
131 |
+
if (!in_array('s3', stream_get_wrappers())) {
|
132 |
+
stream_wrapper_register('s3', __CLASS__, STREAM_IS_URL);
|
133 |
+
}
|
134 |
+
|
135 |
+
self::$client = $client;
|
136 |
+
}
|
137 |
+
|
138 |
+
/**
|
139 |
+
* Close the stream
|
140 |
+
*/
|
141 |
+
public function stream_close()
|
142 |
+
{
|
143 |
+
$this->body = null;
|
144 |
+
}
|
145 |
+
|
146 |
+
/**
|
147 |
+
* @param string $path
|
148 |
+
* @param string $mode
|
149 |
+
* @param int $options
|
150 |
+
* @param string $opened_path
|
151 |
+
*
|
152 |
+
* @return bool
|
153 |
+
*/
|
154 |
+
public function stream_open($path, $mode, $options, &$opened_path)
|
155 |
+
{
|
156 |
+
// We don't care about the binary flag
|
157 |
+
$this->mode = $mode = rtrim($mode, 'bt');
|
158 |
+
$this->params = $params = $this->getParams($path);
|
159 |
+
$errors = array();
|
160 |
+
|
161 |
+
if (!$params['Key']) {
|
162 |
+
$errors[] = 'Cannot open a bucket. You must specify a path in the form of s3://bucket/key';
|
163 |
+
}
|
164 |
+
|
165 |
+
if (strpos($mode, '+')) {
|
166 |
+
$errors[] = 'The Amazon S3 stream wrapper does not allow simultaneous reading and writing.';
|
167 |
+
}
|
168 |
+
|
169 |
+
if (!in_array($mode, array('r', 'w', 'a', 'x'))) {
|
170 |
+
$errors[] = "Mode not supported: {$mode}. Use one 'r', 'w', 'a', or 'x'.";
|
171 |
+
}
|
172 |
+
|
173 |
+
// When using mode "x" validate if the file exists before attempting to read
|
174 |
+
if ($mode == 'x' && !self::$client->doesObjectExist($params['Bucket'], $params['Key'], $this->getOptions())) {
|
175 |
+
$errors[] = "{$path} does not exist on Amazon S3";
|
176 |
+
}
|
177 |
+
|
178 |
+
if (!$errors) {
|
179 |
+
if ($mode == 'r') {
|
180 |
+
$this->openReadStream($params, $errors);
|
181 |
+
} elseif ($mode == 'a') {
|
182 |
+
$this->openAppendStream($params, $errors);
|
183 |
+
} else {
|
184 |
+
$this->openWriteStream($params, $errors);
|
185 |
+
}
|
186 |
+
}
|
187 |
+
|
188 |
+
return $errors ? $this->triggerError($errors) : true;
|
189 |
+
}
|
190 |
+
|
191 |
+
/**
|
192 |
+
* @return bool
|
193 |
+
*/
|
194 |
+
public function stream_eof()
|
195 |
+
{
|
196 |
+
return $this->body->feof();
|
197 |
+
}
|
198 |
+
|
199 |
+
/**
|
200 |
+
* @return bool
|
201 |
+
*/
|
202 |
+
public function stream_flush()
|
203 |
+
{
|
204 |
+
if ($this->mode == 'r') {
|
205 |
+
return fflush($this->body->getStream());
|
206 |
+
}
|
207 |
+
|
208 |
+
$this->body->rewind();
|
209 |
+
$params = $this->params;
|
210 |
+
$params['Body'] = $this->body;
|
211 |
+
|
212 |
+
try {
|
213 |
+
self::$client->putObject($params);
|
214 |
+
return true;
|
215 |
+
} catch (\Exception $e) {
|
216 |
+
return $this->triggerError($e->getMessage());
|
217 |
+
}
|
218 |
+
}
|
219 |
+
|
220 |
+
/**
|
221 |
+
* Read data from the underlying stream
|
222 |
+
*
|
223 |
+
* @param int $count Amount of bytes to read
|
224 |
+
*
|
225 |
+
* @return string
|
226 |
+
*/
|
227 |
+
public function stream_read($count)
|
228 |
+
{
|
229 |
+
return $this->body->read($count);
|
230 |
+
}
|
231 |
+
|
232 |
+
/**
|
233 |
+
* Seek to a specific byte in the stream
|
234 |
+
*
|
235 |
+
* @param int $offset Seek offset
|
236 |
+
* @param int $whence Whence (SEEK_SET, SEEK_CUR, SEEK_END)
|
237 |
+
*
|
238 |
+
* @return bool
|
239 |
+
*/
|
240 |
+
public function stream_seek($offset, $whence = SEEK_SET)
|
241 |
+
{
|
242 |
+
return $this->body->seek($offset, $whence);
|
243 |
+
}
|
244 |
+
|
245 |
+
/**
|
246 |
+
* Get the current position of the stream
|
247 |
+
*
|
248 |
+
* @return int Returns the current position in the stream
|
249 |
+
*/
|
250 |
+
public function stream_tell()
|
251 |
+
{
|
252 |
+
return $this->body->ftell();
|
253 |
+
}
|
254 |
+
|
255 |
+
/**
|
256 |
+
* Write data the to the stream
|
257 |
+
*
|
258 |
+
* @param string $data
|
259 |
+
*
|
260 |
+
* @return int Returns the number of bytes written to the stream
|
261 |
+
*/
|
262 |
+
public function stream_write($data)
|
263 |
+
{
|
264 |
+
return $this->body->write($data);
|
265 |
+
}
|
266 |
+
|
267 |
+
/**
|
268 |
+
* Delete a specific object
|
269 |
+
*
|
270 |
+
* @param string $path
|
271 |
+
* @return bool
|
272 |
+
*/
|
273 |
+
public function unlink($path)
|
274 |
+
{
|
275 |
+
try {
|
276 |
+
$this->clearStatInfo($path);
|
277 |
+
self::$client->deleteObject($this->getParams($path));
|
278 |
+
return true;
|
279 |
+
} catch (\Exception $e) {
|
280 |
+
return $this->triggerError($e->getMessage());
|
281 |
+
}
|
282 |
+
}
|
283 |
+
|
284 |
+
/**
|
285 |
+
* @return array
|
286 |
+
*/
|
287 |
+
public function stream_stat()
|
288 |
+
{
|
289 |
+
return fstat($this->body->getStream());
|
290 |
+
}
|
291 |
+
|
292 |
+
/**
|
293 |
+
* Provides information for is_dir, is_file, filesize, etc. Works on buckets, keys, and prefixes
|
294 |
+
*
|
295 |
+
* @param string $path
|
296 |
+
* @param int $flags
|
297 |
+
*
|
298 |
+
* @return array Returns an array of stat data
|
299 |
+
* @link http://www.php.net/manual/en/streamwrapper.url-stat.php
|
300 |
+
*/
|
301 |
+
public function url_stat($path, $flags)
|
302 |
+
{
|
303 |
+
// Check if this path is in the url_stat cache
|
304 |
+
if (isset(self::$nextStat[$path])) {
|
305 |
+
return self::$nextStat[$path];
|
306 |
+
}
|
307 |
+
|
308 |
+
$parts = $this->getParams($path);
|
309 |
+
|
310 |
+
// Stat a bucket or just s3://
|
311 |
+
if (!$parts['Key'] && (!$parts['Bucket'] || self::$client->doesBucketExist($parts['Bucket']))) {
|
312 |
+
return $this->formatUrlStat($path);
|
313 |
+
}
|
314 |
+
|
315 |
+
// You must pass either a bucket or a bucket + key
|
316 |
+
if (!$parts['Key']) {
|
317 |
+
return $this->triggerError("File or directory not found: {$path}", $flags);
|
318 |
+
}
|
319 |
+
|
320 |
+
try {
|
321 |
+
try {
|
322 |
+
// Attempt to stat and cache regular object
|
323 |
+
return $this->formatUrlStat(self::$client->headObject($parts)->toArray());
|
324 |
+
} catch (NoSuchKeyException $e) {
|
325 |
+
// Maybe this isn't an actual key, but a prefix. Do a prefix listing of objects to determine.
|
326 |
+
$result = self::$client->listObjects(array(
|
327 |
+
'Bucket' => $parts['Bucket'],
|
328 |
+
'Prefix' => $parts['Key'],
|
329 |
+
'MaxKeys' => 1
|
330 |
+
));
|
331 |
+
if (!$result['Contents'] && !$result['CommonPrefixes']) {
|
332 |
+
return $this->triggerError("File or directory not found: {$path}", $flags);
|
333 |
+
}
|
334 |
+
// This is a directory prefix
|
335 |
+
return $this->formatUrlStat($path);
|
336 |
+
}
|
337 |
+
} catch (\Exception $e) {
|
338 |
+
return $this->triggerError($e->getMessage(), $flags);
|
339 |
+
}
|
340 |
+
}
|
341 |
+
|
342 |
+
/**
|
343 |
+
* Support for mkdir().
|
344 |
+
*
|
345 |
+
* @param string $path Directory which should be created.
|
346 |
+
* @param int $mode Permissions. 700-range permissions map to ACL_PUBLIC. 600-range permissions map to
|
347 |
+
* ACL_AUTH_READ. All other permissions map to ACL_PRIVATE. Expects octal form.
|
348 |
+
* @param int $options A bitwise mask of values, such as STREAM_MKDIR_RECURSIVE. (unused)
|
349 |
+
*
|
350 |
+
* @return bool
|
351 |
+
* @link http://www.php.net/manual/en/streamwrapper.mkdir.php
|
352 |
+
*/
|
353 |
+
public function mkdir($path, $mode, $options)
|
354 |
+
{
|
355 |
+
$params = $this->getParams($path);
|
356 |
+
$this->clearStatInfo($path);
|
357 |
+
|
358 |
+
if (!$params['Bucket'] || $params['Key']) {
|
359 |
+
return false;
|
360 |
+
}
|
361 |
+
|
362 |
+
try {
|
363 |
+
if (!isset($params['ACL'])) {
|
364 |
+
$mode = decoct($mode);
|
365 |
+
if ($mode >= 700 and $mode <= 799) {
|
366 |
+
$params['ACL'] = 'public-read';
|
367 |
+
} elseif ($mode >= 600 && $mode <= 699) {
|
368 |
+
$params['ACL'] = 'authenticated-read';
|
369 |
+
} else {
|
370 |
+
$params['ACL'] = 'private';
|
371 |
+
}
|
372 |
+
}
|
373 |
+
self::$client->createBucket($params);
|
374 |
+
return true;
|
375 |
+
} catch (\Exception $e) {
|
376 |
+
return $this->triggerError($e->getMessage());
|
377 |
+
}
|
378 |
+
}
|
379 |
+
|
380 |
+
/**
|
381 |
+
* Remove a bucket from Amazon S3
|
382 |
+
*
|
383 |
+
* @param string $path the directory path
|
384 |
+
*
|
385 |
+
* @return bool true if directory was successfully removed
|
386 |
+
* @link http://www.php.net/manual/en/streamwrapper.rmdir.php
|
387 |
+
*/
|
388 |
+
public function rmdir($path)
|
389 |
+
{
|
390 |
+
$params = $this->getParams($path);
|
391 |
+
if (!$params['Bucket']) {
|
392 |
+
return $this->triggerError('You cannot delete s3://. Please specify a bucket.');
|
393 |
+
} elseif ($params['Key']) {
|
394 |
+
return $this->triggerError('rmdir() only supports bucket deletion');
|
395 |
+
}
|
396 |
+
|
397 |
+
try {
|
398 |
+
self::$client->deleteBucket(array('Bucket' => $params['Bucket']));
|
399 |
+
$this->clearStatInfo($path);
|
400 |
+
return true;
|
401 |
+
} catch (\Exception $e) {
|
402 |
+
return $this->triggerError($e->getMessage());
|
403 |
+
}
|
404 |
+
}
|
405 |
+
|
406 |
+
/**
|
407 |
+
* Support for opendir().
|
408 |
+
*
|
409 |
+
* @param string $path The path to the directory (e.g. "s3://dir[</prefix>]")
|
410 |
+
* @param string $options Whether or not to enforce safe_mode (0x04). Unused.
|
411 |
+
*
|
412 |
+
* @return bool true on success
|
413 |
+
* @see http://www.php.net/manual/en/function.opendir.php
|
414 |
+
*/
|
415 |
+
public function dir_opendir($path, $options)
|
416 |
+
{
|
417 |
+
// Reset the cache
|
418 |
+
$this->clearStatInfo();
|
419 |
+
$params = $this->getParams($path);
|
420 |
+
$delim = $this->getOptions('delimiter') ?: '/';
|
421 |
+
if ($params['Key']) {
|
422 |
+
$params['Key'] = rtrim($params['Key'], $delim) . $delim;
|
423 |
+
}
|
424 |
+
|
425 |
+
$this->openedBucket = $params['Bucket'];
|
426 |
+
$this->openedBucketPrefix = $params['Key'];
|
427 |
+
$this->objectIterator = self::$client->getIterator('ListObjects', array(
|
428 |
+
'Bucket' => $params['Bucket'],
|
429 |
+
'Delimiter' => $delim,
|
430 |
+
'Prefix' => $params['Key']
|
431 |
+
), array(
|
432 |
+
'return_prefixes' => true,
|
433 |
+
'sort_results' => true
|
434 |
+
));
|
435 |
+
|
436 |
+
$this->objectIterator->next();
|
437 |
+
|
438 |
+
return true;
|
439 |
+
}
|
440 |
+
|
441 |
+
/**
|
442 |
+
* Close the directory listing handles
|
443 |
+
*
|
444 |
+
* @return bool true on success
|
445 |
+
*/
|
446 |
+
public function dir_closedir()
|
447 |
+
{
|
448 |
+
$this->objectIterator = null;
|
449 |
+
|
450 |
+
return true;
|
451 |
+
}
|
452 |
+
|
453 |
+
/**
|
454 |
+
* This method is called in response to rewinddir()
|
455 |
+
*
|
456 |
+
* @return boolean true on success
|
457 |
+
*/
|
458 |
+
public function dir_rewinddir()
|
459 |
+
{
|
460 |
+
$this->clearStatInfo();
|
461 |
+
$this->objectIterator->rewind();
|
462 |
+
|
463 |
+
return true;
|
464 |
+
}
|
465 |
+
|
466 |
+
/**
|
467 |
+
* This method is called in response to readdir()
|
468 |
+
*
|
469 |
+
* @return string Should return a string representing the next filename, or false if there is no next file.
|
470 |
+
*
|
471 |
+
* @link http://www.php.net/manual/en/function.readdir.php
|
472 |
+
*/
|
473 |
+
public function dir_readdir()
|
474 |
+
{
|
475 |
+
$result = false;
|
476 |
+
if ($this->objectIterator->valid()) {
|
477 |
+
$current = $this->objectIterator->current();
|
478 |
+
if (isset($current['Prefix'])) {
|
479 |
+
// Include "directories"
|
480 |
+
$result = str_replace($this->openedBucketPrefix, '', $current['Prefix']);
|
481 |
+
$key = "s3://{$this->openedBucket}/{$current['Prefix']}";
|
482 |
+
$stat = $this->formatUrlStat($current['Prefix']);
|
483 |
+
} else {
|
484 |
+
// Remove the prefix from the result to emulate other stream wrappers
|
485 |
+
$result = str_replace($this->openedBucketPrefix, '', $current['Key']);
|
486 |
+
$key = "s3://{$this->openedBucket}/{$current['Key']}";
|
487 |
+
$stat = $this->formatUrlStat($current);
|
488 |
+
}
|
489 |
+
|
490 |
+
// Cache the object data for quick url_stat lookups used with RecursiveDirectoryIterator
|
491 |
+
self::$nextStat = array($key => $stat);
|
492 |
+
$this->objectIterator->next();
|
493 |
+
}
|
494 |
+
|
495 |
+
return $result;
|
496 |
+
}
|
497 |
+
|
498 |
+
/**
|
499 |
+
* Called in response to rename() to rename a file or directory. Currently only supports renaming objects.
|
500 |
+
*
|
501 |
+
* @param string $path_from the path to the file to rename
|
502 |
+
* @param string $path_to the new path to the file
|
503 |
+
*
|
504 |
+
* @return bool true if file was successfully renamed
|
505 |
+
* @link http://www.php.net/manual/en/function.rename.php
|
506 |
+
*/
|
507 |
+
public function rename($path_from, $path_to)
|
508 |
+
{
|
509 |
+
$partsFrom = $this->getParams($path_from);
|
510 |
+
$partsTo = $this->getParams($path_to);
|
511 |
+
$this->clearStatInfo($path_from);
|
512 |
+
$this->clearStatInfo($path_to);
|
513 |
+
|
514 |
+
if (!$partsFrom['Key'] || !$partsTo['Key']) {
|
515 |
+
return $this->triggerError('The Amazon S3 stream wrapper only supports copying objects');
|
516 |
+
}
|
517 |
+
|
518 |
+
try {
|
519 |
+
// Copy the object and allow overriding default parameters if desired, but by default copy metadata
|
520 |
+
self::$client->copyObject($this->getOptions() + array(
|
521 |
+
'Bucket' => $partsTo['Bucket'],
|
522 |
+
'Key' => $partsTo['Key'],
|
523 |
+
'CopySource' => '/' . $partsFrom['Bucket'] . '/' . rawurlencode($partsFrom['Key']),
|
524 |
+
'MetadataDirective' => 'COPY'
|
525 |
+
));
|
526 |
+
// Delete the original object
|
527 |
+
self::$client->deleteObject(array(
|
528 |
+
'Bucket' => $partsFrom['Bucket'],
|
529 |
+
'Key' => $partsFrom['Key']
|
530 |
+
) + $this->getOptions());
|
531 |
+
} catch (\Exception $e) {
|
532 |
+
return $this->triggerError($e->getMessage());
|
533 |
+
}
|
534 |
+
|
535 |
+
return true;
|
536 |
+
}
|
537 |
+
|
538 |
+
/**
|
539 |
+
* Get the stream context options available to the current stream
|
540 |
+
*
|
541 |
+
* @return array
|
542 |
+
*/
|
543 |
+
protected function getOptions()
|
544 |
+
{
|
545 |
+
$context = $this->context ?: stream_context_get_default();
|
546 |
+
$options = stream_context_get_options($context);
|
547 |
+
|
548 |
+
return isset($options['s3']) ? $options['s3'] : array();
|
549 |
+
}
|
550 |
+
|
551 |
+
/**
|
552 |
+
* Get a specific stream context option
|
553 |
+
*
|
554 |
+
* @param string $name Name of the option to retrieve
|
555 |
+
*
|
556 |
+
* @return mixed|null
|
557 |
+
*/
|
558 |
+
protected function getOption($name)
|
559 |
+
{
|
560 |
+
$options = $this->getOptions();
|
561 |
+
|
562 |
+
return isset($options[$name]) ? $options[$name] : null;
|
563 |
+
}
|
564 |
+
|
565 |
+
/**
|
566 |
+
* Get the bucket and key from the passed path (e.g. s3://bucket/key)
|
567 |
+
*
|
568 |
+
* @param string $path Path passed to the stream wrapper
|
569 |
+
*
|
570 |
+
* @return array Hash of 'Bucket', 'Key', and custom params
|
571 |
+
*/
|
572 |
+
protected function getParams($path)
|
573 |
+
{
|
574 |
+
$parts = explode('/', substr($path, 5), 2);
|
575 |
+
|
576 |
+
$params = $this->getOptions();
|
577 |
+
unset($params['seekable']);
|
578 |
+
unset($params['throw_exceptions']);
|
579 |
+
|
580 |
+
return array(
|
581 |
+
'Bucket' => $parts[0],
|
582 |
+
'Key' => isset($parts[1]) ? $parts[1] : null
|
583 |
+
) + $params;
|
584 |
+
}
|
585 |
+
|
586 |
+
/**
|
587 |
+
* Serialize and sign a command, returning a request object
|
588 |
+
*
|
589 |
+
* @param CommandInterface $command Command to sign
|
590 |
+
*
|
591 |
+
* @return RequestInterface
|
592 |
+
*/
|
593 |
+
protected function getSignedRequest($command)
|
594 |
+
{
|
595 |
+
$request = $command->prepare();
|
596 |
+
$request->dispatch('request.before_send', array('request' => $request));
|
597 |
+
|
598 |
+
return $request;
|
599 |
+
}
|
600 |
+
|
601 |
+
/**
|
602 |
+
* Initialize the stream wrapper for a read only stream
|
603 |
+
*
|
604 |
+
* @param array $params Operation parameters
|
605 |
+
* @param array $errors Any encountered errors to append to
|
606 |
+
*
|
607 |
+
* @return bool
|
608 |
+
*/
|
609 |
+
protected function openReadStream(array $params, array &$errors)
|
610 |
+
{
|
611 |
+
// Create the command and serialize the request
|
612 |
+
$request = $this->getSignedRequest(self::$client->getCommand('GetObject', $params));
|
613 |
+
// Create a stream that uses the EntityBody object
|
614 |
+
$factory = $this->getOption('stream_factory') ?: new PhpStreamRequestFactory();
|
615 |
+
$this->body = $factory->fromRequest($request, array(), array('stream_class' => 'Guzzle\Http\EntityBody'));
|
616 |
+
|
617 |
+
// Wrap the body in a caching entity body if seeking is allowed
|
618 |
+
if ($this->getOption('seekable')) {
|
619 |
+
$this->body = new CachingEntityBody($this->body);
|
620 |
+
}
|
621 |
+
|
622 |
+
return true;
|
623 |
+
}
|
624 |
+
|
625 |
+
/**
|
626 |
+
* Initialize the stream wrapper for a write only stream
|
627 |
+
*
|
628 |
+
* @param array $params Operation parameters
|
629 |
+
* @param array $errors Any encountered errors to append to
|
630 |
+
*
|
631 |
+
* @return bool
|
632 |
+
*/
|
633 |
+
protected function openWriteStream(array $params, array &$errors)
|
634 |
+
{
|
635 |
+
$this->body = new EntityBody(fopen('php://temp', 'r+'));
|
636 |
+
}
|
637 |
+
|
638 |
+
/**
|
639 |
+
* Initialize the stream wrapper for an append stream
|
640 |
+
*
|
641 |
+
* @param array $params Operation parameters
|
642 |
+
* @param array $errors Any encountered errors to append to
|
643 |
+
*
|
644 |
+
* @return bool
|
645 |
+
*/
|
646 |
+
protected function openAppendStream(array $params, array &$errors)
|
647 |
+
{
|
648 |
+
try {
|
649 |
+
// Get the body of the object
|
650 |
+
$this->body = self::$client->getObject($params)->get('Body');
|
651 |
+
$this->body->seek(0, SEEK_END);
|
652 |
+
} catch (S3Exception $e) {
|
653 |
+
// The object does not exist, so use a simple write stream
|
654 |
+
$this->openWriteStream($params, $errors);
|
655 |
+
}
|
656 |
+
|
657 |
+
return true;
|
658 |
+
}
|
659 |
+
|
660 |
+
/**
|
661 |
+
* Trigger one or more errors
|
662 |
+
*
|
663 |
+
* @param string|array $errors Errors to trigger
|
664 |
+
* @param mixed $flags If set to STREAM_URL_STAT_QUIET, then no error or exception occurs
|
665 |
+
*
|
666 |
+
* @return bool Returns false
|
667 |
+
* @throws RuntimeException if throw_errors is true
|
668 |
+
*/
|
669 |
+
protected function triggerError($errors, $flags = null)
|
670 |
+
{
|
671 |
+
if ($flags != STREAM_URL_STAT_QUIET) {
|
672 |
+
if ($this->getOption('throw_exceptions')) {
|
673 |
+
throw new RuntimeException(implode("\n", (array) $errors));
|
674 |
+
} else {
|
675 |
+
trigger_error(implode("\n", (array) $errors), E_USER_WARNING);
|
676 |
+
}
|
677 |
+
}
|
678 |
+
|
679 |
+
return false;
|
680 |
+
}
|
681 |
+
|
682 |
+
/**
|
683 |
+
* Prepare a url_stat result array
|
684 |
+
*
|
685 |
+
* @param string|array $result Data to add
|
686 |
+
*
|
687 |
+
* @return array Returns the modified url_stat result
|
688 |
+
*/
|
689 |
+
protected function formatUrlStat($result = null)
|
690 |
+
{
|
691 |
+
static $statTemplate = array(
|
692 |
+
0 => 0, 'dev' => 0,
|
693 |
+
1 => 0, 'ino' => 0,
|
694 |
+
2 => 0, 'mode' => 0,
|
695 |
+
3 => 0, 'nlink' => 0,
|
696 |
+
4 => 0, 'uid' => 0,
|
697 |
+
5 => 0, 'gid' => 0,
|
698 |
+
6 => -1, 'rdev' => -1,
|
699 |
+
7 => 0, 'size' => 0,
|
700 |
+
8 => 0, 'atime' => 0,
|
701 |
+
9 => 0, 'mtime' => 0,
|
702 |
+
10 => 0, 'ctime' => 0,
|
703 |
+
11 => -1, 'blksize' => -1,
|
704 |
+
12 => -1, 'blocks' => -1,
|
705 |
+
);
|
706 |
+
|
707 |
+
$stat = $statTemplate;
|
708 |
+
|
709 |
+
// Determine what type of data is being cached
|
710 |
+
if (!$result || is_string($result)) {
|
711 |
+
// Directory with 0777 access - see "man 2 stat".
|
712 |
+
$stat['mode'] = $stat[2] = 0040777;
|
713 |
+
} elseif (is_array($result) && isset($result['LastModified'])) {
|
714 |
+
// ListObjects or HeadObject result
|
715 |
+
$stat['mtime'] = $stat[9] = $stat['ctime'] = $stat[10] = strtotime($result['LastModified']);
|
716 |
+
$stat['size'] = $stat[7] = (isset($result['ContentLength']) ? $result['ContentLength'] : $result['Size']);
|
717 |
+
// Regular file with 0777 access - see "man 2 stat".
|
718 |
+
$stat['mode'] = $stat[2] = 0100777;
|
719 |
+
} else {
|
720 |
+
$stat['mode'] = $stat[2] = 0100777;
|
721 |
+
}
|
722 |
+
|
723 |
+
return $stat;
|
724 |
+
}
|
725 |
+
|
726 |
+
/**
|
727 |
+
* Clear the next stat result from the cache
|
728 |
+
*
|
729 |
+
* @param string $path If a path is specific, clearstatcache() will be called
|
730 |
+
*/
|
731 |
+
protected function clearStatInfo($path = null)
|
732 |
+
{
|
733 |
+
self::$nextStat = array();
|
734 |
+
if ($path) {
|
735 |
+
clearstatcache(true, $path);
|
736 |
+
}
|
737 |
+
}
|
738 |
+
}
|
sdk/Aws/Guzzle/Batch/composer.json
CHANGED
@@ -25,7 +25,7 @@
|
|
25 |
"target-dir": "Guzzle/Batch",
|
26 |
"extra": {
|
27 |
"branch-alias": {
|
28 |
-
"dev-master": "3.
|
29 |
}
|
30 |
}
|
31 |
}
|
25 |
"target-dir": "Guzzle/Batch",
|
26 |
"extra": {
|
27 |
"branch-alias": {
|
28 |
+
"dev-master": "3.4-dev"
|
29 |
}
|
30 |
}
|
31 |
}
|
sdk/Aws/Guzzle/Cache/composer.json
CHANGED
@@ -21,7 +21,7 @@
|
|
21 |
"target-dir": "Guzzle/Cache",
|
22 |
"extra": {
|
23 |
"branch-alias": {
|
24 |
-
"dev-master": "3.
|
25 |
}
|
26 |
}
|
27 |
}
|
21 |
"target-dir": "Guzzle/Cache",
|
22 |
"extra": {
|
23 |
"branch-alias": {
|
24 |
+
"dev-master": "3.4-dev"
|
25 |
}
|
26 |
}
|
27 |
}
|
sdk/Aws/Guzzle/Common/Exception/ExceptionCollection.php
CHANGED
@@ -35,17 +35,21 @@ class ExceptionCollection extends \Exception implements GuzzleException, \Iterat
|
|
35 |
*/
|
36 |
public function add($e)
|
37 |
{
|
|
|
|
|
|
|
|
|
38 |
if ($e instanceof self) {
|
39 |
foreach ($e as $exception) {
|
40 |
$this->exceptions[] = $exception;
|
|
|
41 |
}
|
42 |
} elseif ($e instanceof \Exception) {
|
43 |
$this->exceptions[] = $e;
|
|
|
44 |
}
|
45 |
|
46 |
-
$this->message =
|
47 |
-
return $e->getMessage();
|
48 |
-
}, $this->exceptions));
|
49 |
|
50 |
return $this;
|
51 |
}
|
35 |
*/
|
36 |
public function add($e)
|
37 |
{
|
38 |
+
if ($this->message) {
|
39 |
+
$this->message .= "\n";
|
40 |
+
}
|
41 |
+
|
42 |
if ($e instanceof self) {
|
43 |
foreach ($e as $exception) {
|
44 |
$this->exceptions[] = $exception;
|
45 |
+
$this->message .= $e->getMessage() . "\n";
|
46 |
}
|
47 |
} elseif ($e instanceof \Exception) {
|
48 |
$this->exceptions[] = $e;
|
49 |
+
$this->message .= $e->getMessage();
|
50 |
}
|
51 |
|
52 |
+
$this->message = rtrim($this->message);
|
|
|
|
|
53 |
|
54 |
return $this;
|
55 |
}
|
sdk/Aws/Guzzle/Common/Version.php
CHANGED
@@ -7,5 +7,5 @@ namespace Guzzle\Common;
|
|
7 |
*/
|
8 |
class Version
|
9 |
{
|
10 |
-
const VERSION = '3.2
|
11 |
}
|
7 |
*/
|
8 |
class Version
|
9 |
{
|
10 |
+
const VERSION = '3.4.2';
|
11 |
}
|
sdk/Aws/Guzzle/Common/composer.json
CHANGED
@@ -14,7 +14,7 @@
|
|
14 |
"target-dir": "Guzzle/Common",
|
15 |
"extra": {
|
16 |
"branch-alias": {
|
17 |
-
"dev-master": "3.
|
18 |
}
|
19 |
}
|
20 |
}
|
14 |
"target-dir": "Guzzle/Common",
|
15 |
"extra": {
|
16 |
"branch-alias": {
|
17 |
+
"dev-master": "3.4-dev"
|
18 |
}
|
19 |
}
|
20 |
}
|
sdk/Aws/Guzzle/Http/AbstractEntityBodyDecorator.php
CHANGED
@@ -15,7 +15,7 @@ class AbstractEntityBodyDecorator implements EntityBodyInterface
|
|
15 |
protected $body;
|
16 |
|
17 |
/**
|
18 |
-
* Wrap
|
19 |
*
|
20 |
* @param EntityBodyInterface $body Entity body to decorate
|
21 |
*/
|
@@ -39,7 +39,6 @@ class AbstractEntityBodyDecorator implements EntityBodyInterface
|
|
39 |
* @param array $args Method arguments
|
40 |
*
|
41 |
* @return mixed
|
42 |
-
* @codeCoverageIgnore
|
43 |
*/
|
44 |
public function __call($method, array $args = null)
|
45 |
{
|
@@ -48,16 +47,24 @@ class AbstractEntityBodyDecorator implements EntityBodyInterface
|
|
48 |
|
49 |
/**
|
50 |
* {@inheritdoc}
|
51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
*/
|
53 |
public function setRewindFunction($callable)
|
54 |
{
|
55 |
-
|
|
|
|
|
56 |
}
|
57 |
|
58 |
/**
|
59 |
* {@inheritdoc}
|
60 |
-
* @codeCoverageIgnore
|
61 |
*/
|
62 |
public function rewind()
|
63 |
{
|
@@ -66,7 +73,6 @@ class AbstractEntityBodyDecorator implements EntityBodyInterface
|
|
66 |
|
67 |
/**
|
68 |
* {@inheritdoc}
|
69 |
-
* @codeCoverageIgnore
|
70 |
*/
|
71 |
public function compress($filter = 'zlib.deflate')
|
72 |
{
|
@@ -75,7 +81,6 @@ class AbstractEntityBodyDecorator implements EntityBodyInterface
|
|
75 |
|
76 |
/**
|
77 |
* {@inheritdoc}
|
78 |
-
* @codeCoverageIgnore
|
79 |
*/
|
80 |
public function uncompress($filter = 'zlib.inflate')
|
81 |
{
|
@@ -87,7 +92,7 @@ class AbstractEntityBodyDecorator implements EntityBodyInterface
|
|
87 |
*/
|
88 |
public function getContentLength()
|
89 |
{
|
90 |
-
return $this->
|
91 |
}
|
92 |
|
93 |
/**
|
@@ -118,7 +123,6 @@ class AbstractEntityBodyDecorator implements EntityBodyInterface
|
|
118 |
|
119 |
/**
|
120 |
* {@inheritdoc}
|
121 |
-
* @codeCoverageIgnore
|
122 |
*/
|
123 |
public function getMetaData($key = null)
|
124 |
{
|
@@ -135,11 +139,12 @@ class AbstractEntityBodyDecorator implements EntityBodyInterface
|
|
135 |
|
136 |
/**
|
137 |
* {@inheritdoc}
|
138 |
-
* @codeCoverageIgnore
|
139 |
*/
|
140 |
public function setStream($stream, $size = 0)
|
141 |
{
|
142 |
-
|
|
|
|
|
143 |
}
|
144 |
|
145 |
/**
|
@@ -206,6 +211,15 @@ class AbstractEntityBodyDecorator implements EntityBodyInterface
|
|
206 |
return $this->body->isConsumed();
|
207 |
}
|
208 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
209 |
/**
|
210 |
* {@inheritdoc}
|
211 |
*/
|
@@ -224,16 +238,16 @@ class AbstractEntityBodyDecorator implements EntityBodyInterface
|
|
224 |
|
225 |
/**
|
226 |
* {@inheritdoc}
|
227 |
-
* @codeCoverageIgnore
|
228 |
*/
|
229 |
public function setSize($size)
|
230 |
{
|
231 |
-
|
|
|
|
|
232 |
}
|
233 |
|
234 |
/**
|
235 |
* {@inheritdoc}
|
236 |
-
* @codeCoverageIgnore
|
237 |
*/
|
238 |
public function seek($offset, $whence = SEEK_SET)
|
239 |
{
|
@@ -242,7 +256,6 @@ class AbstractEntityBodyDecorator implements EntityBodyInterface
|
|
242 |
|
243 |
/**
|
244 |
* {@inheritdoc}
|
245 |
-
* @codeCoverageIgnore
|
246 |
*/
|
247 |
public function read($length)
|
248 |
{
|
@@ -251,7 +264,6 @@ class AbstractEntityBodyDecorator implements EntityBodyInterface
|
|
251 |
|
252 |
/**
|
253 |
* {@inheritdoc}
|
254 |
-
* @codeCoverageIgnore
|
255 |
*/
|
256 |
public function write($string)
|
257 |
{
|
@@ -260,10 +272,35 @@ class AbstractEntityBodyDecorator implements EntityBodyInterface
|
|
260 |
|
261 |
/**
|
262 |
* {@inheritdoc}
|
263 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
264 |
*/
|
265 |
public function ftell()
|
266 |
{
|
267 |
return $this->body->ftell();
|
268 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
269 |
}
|
15 |
protected $body;
|
16 |
|
17 |
/**
|
18 |
+
* Wrap an entity body
|
19 |
*
|
20 |
* @param EntityBodyInterface $body Entity body to decorate
|
21 |
*/
|
39 |
* @param array $args Method arguments
|
40 |
*
|
41 |
* @return mixed
|
|
|
42 |
*/
|
43 |
public function __call($method, array $args = null)
|
44 |
{
|
47 |
|
48 |
/**
|
49 |
* {@inheritdoc}
|
50 |
+
*/
|
51 |
+
public function close()
|
52 |
+
{
|
53 |
+
return $this->body->close();
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* {@inheritdoc}
|
58 |
*/
|
59 |
public function setRewindFunction($callable)
|
60 |
{
|
61 |
+
$this->body->setRewindFunction($callable);
|
62 |
+
|
63 |
+
return $this;
|
64 |
}
|
65 |
|
66 |
/**
|
67 |
* {@inheritdoc}
|
|
|
68 |
*/
|
69 |
public function rewind()
|
70 |
{
|
73 |
|
74 |
/**
|
75 |
* {@inheritdoc}
|
|
|
76 |
*/
|
77 |
public function compress($filter = 'zlib.deflate')
|
78 |
{
|
81 |
|
82 |
/**
|
83 |
* {@inheritdoc}
|
|
|
84 |
*/
|
85 |
public function uncompress($filter = 'zlib.inflate')
|
86 |
{
|
92 |
*/
|
93 |
public function getContentLength()
|
94 |
{
|
95 |
+
return $this->getSize();
|
96 |
}
|
97 |
|
98 |
/**
|
123 |
|
124 |
/**
|
125 |
* {@inheritdoc}
|
|
|
126 |
*/
|
127 |
public function getMetaData($key = null)
|
128 |
{
|
139 |
|
140 |
/**
|
141 |
* {@inheritdoc}
|
|
|
142 |
*/
|
143 |
public function setStream($stream, $size = 0)
|
144 |
{
|
145 |
+
$this->body->setStream($stream, $size);
|
146 |
+
|
147 |
+
return $this;
|
148 |
}
|
149 |
|
150 |
/**
|
211 |
return $this->body->isConsumed();
|
212 |
}
|
213 |
|
214 |
+
/**
|
215 |
+
* Alias of isConsumed()
|
216 |
+
* {@inheritdoc}
|
217 |
+
*/
|
218 |
+
public function feof()
|
219 |
+
{
|
220 |
+
return $this->isConsumed();
|
221 |
+
}
|
222 |
+
|
223 |
/**
|
224 |
* {@inheritdoc}
|
225 |
*/
|
238 |
|
239 |
/**
|
240 |
* {@inheritdoc}
|
|
|
241 |
*/
|
242 |
public function setSize($size)
|
243 |
{
|
244 |
+
$this->body->setSize($size);
|
245 |
+
|
246 |
+
return $this;
|
247 |
}
|
248 |
|
249 |
/**
|
250 |
* {@inheritdoc}
|
|
|
251 |
*/
|
252 |
public function seek($offset, $whence = SEEK_SET)
|
253 |
{
|
256 |
|
257 |
/**
|
258 |
* {@inheritdoc}
|
|
|
259 |
*/
|
260 |
public function read($length)
|
261 |
{
|
264 |
|
265 |
/**
|
266 |
* {@inheritdoc}
|
|
|
267 |
*/
|
268 |
public function write($string)
|
269 |
{
|
272 |
|
273 |
/**
|
274 |
* {@inheritdoc}
|
275 |
+
*/
|
276 |
+
public function readLine($maxLength = null)
|
277 |
+
{
|
278 |
+
return $this->body->readLine($maxLength);
|
279 |
+
}
|
280 |
+
|
281 |
+
/**
|
282 |
+
* {@inheritdoc}
|
283 |
*/
|
284 |
public function ftell()
|
285 |
{
|
286 |
return $this->body->ftell();
|
287 |
}
|
288 |
+
|
289 |
+
/**
|
290 |
+
* {@inheritdoc}
|
291 |
+
*/
|
292 |
+
public function getCustomData($key)
|
293 |
+
{
|
294 |
+
return $this->body->getCustomData($key);
|
295 |
+
}
|
296 |
+
|
297 |
+
/**
|
298 |
+
* {@inheritdoc}
|
299 |
+
*/
|
300 |
+
public function setCustomData($key, $value)
|
301 |
+
{
|
302 |
+
$this->body->setCustomData($key, $value);
|
303 |
+
|
304 |
+
return $this;
|
305 |
+
}
|
306 |
}
|
sdk/Aws/Guzzle/Http/CachingEntityBody.php
ADDED
@@ -0,0 +1,277 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Guzzle\Http;
|
4 |
+
|
5 |
+
use Guzzle\Common\Exception\RuntimeException;
|
6 |
+
|
7 |
+
/**
|
8 |
+
* EntityBody decorator that can cache previously read bytes from a sequentially read tstream
|
9 |
+
*/
|
10 |
+
class CachingEntityBody extends AbstractEntityBodyDecorator
|
11 |
+
{
|
12 |
+
/**
|
13 |
+
* @var EntityBody Remote stream used to actually pull data onto the buffer
|
14 |
+
*/
|
15 |
+
protected $remoteStream;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* @var int The number of bytes to skip reading due to a write on the temporary buffer
|
19 |
+
*/
|
20 |
+
protected $skipReadBytes = 0;
|
21 |
+
|
22 |
+
/**
|
23 |
+
* We will treat the buffer object as the body of the entity body
|
24 |
+
* {@inheritdoc}
|
25 |
+
*/
|
26 |
+
public function __construct(EntityBodyInterface $body)
|
27 |
+
{
|
28 |
+
$this->remoteStream = $body;
|
29 |
+
$this->body = new EntityBody(fopen('php://temp', 'r+'));
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Will give the contents of the buffer followed by the exhausted remote stream.
|
34 |
+
*
|
35 |
+
* Warning: Loads the entire stream into memory
|
36 |
+
*
|
37 |
+
* @return string
|
38 |
+
*/
|
39 |
+
public function __toString()
|
40 |
+
{
|
41 |
+
$pos = $this->ftell();
|
42 |
+
$this->rewind();
|
43 |
+
|
44 |
+
$str = '';
|
45 |
+
while (!$this->isConsumed()) {
|
46 |
+
$str .= $this->read(16384);
|
47 |
+
}
|
48 |
+
|
49 |
+
$this->seek($pos);
|
50 |
+
|
51 |
+
return $str;
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* {@inheritdoc}
|
56 |
+
*/
|
57 |
+
public function getSize()
|
58 |
+
{
|
59 |
+
return max($this->body->getSize(), $this->remoteStream->getSize());
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* {@inheritdoc}
|
64 |
+
* @throws RuntimeException When seeking with SEEK_END or when seeking past the total size of the buffer stream
|
65 |
+
*/
|
66 |
+
public function seek($offset, $whence = SEEK_SET)
|
67 |
+
{
|
68 |
+
if ($whence == SEEK_SET) {
|
69 |
+
$byte = $offset;
|
70 |
+
} elseif ($whence == SEEK_CUR) {
|
71 |
+
$byte = $offset + $this->ftell();
|
72 |
+
} else {
|
73 |
+
throw new RuntimeException(__CLASS__ . ' supports only SEEK_SET and SEEK_CUR seek operations');
|
74 |
+
}
|
75 |
+
|
76 |
+
// You cannot skip ahead past where you've read from the remote stream
|
77 |
+
if ($byte > $this->body->getSize()) {
|
78 |
+
throw new RuntimeException(
|
79 |
+
"Cannot seek to byte {$byte} when the buffered stream only contains {$this->body->getSize()} bytes"
|
80 |
+
);
|
81 |
+
}
|
82 |
+
|
83 |
+
return $this->body->seek($byte);
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* {@inheritdoc}
|
88 |
+
*/
|
89 |
+
public function rewind()
|
90 |
+
{
|
91 |
+
return $this->seek(0);
|
92 |
+
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Does not support custom rewind functions
|
96 |
+
*
|
97 |
+
* @throws RuntimeException
|
98 |
+
*/
|
99 |
+
public function setRewindFunction($callable)
|
100 |
+
{
|
101 |
+
throw new RuntimeException(__CLASS__ . ' does not support custom stream rewind functions');
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* {@inheritdoc}
|
106 |
+
*/
|
107 |
+
public function read($length)
|
108 |
+
{
|
109 |
+
// Perform a regular read on any previously read data from the buffer
|
110 |
+
$data = $this->body->read($length);
|
111 |
+
$remaining = $length - strlen($data);
|
112 |
+
|
113 |
+
// More data was requested so read from the remote stream
|
114 |
+
if ($remaining) {
|
115 |
+
// If data was written to the buffer in a position that would have been filled from the remote stream,
|
116 |
+
// then we must skip bytes on the remote stream to emulate overwriting bytes from that position. This
|
117 |
+
// mimics the behavior of other PHP stream wrappers.
|
118 |
+
$remoteData = $this->remoteStream->read($remaining + $this->skipReadBytes);
|
119 |
+
|
120 |
+
if ($this->skipReadBytes) {
|
121 |
+
$len = strlen($remoteData);
|
122 |
+
$remoteData = substr($remoteData, $this->skipReadBytes);
|
123 |
+
$this->skipReadBytes = max(0, $this->skipReadBytes - $len);
|
124 |
+
}
|
125 |
+
|
126 |
+
$data .= $remoteData;
|
127 |
+
$this->body->write($remoteData);
|
128 |
+
}
|
129 |
+
|
130 |
+
return $data;
|
131 |
+
}
|
132 |
+
|
133 |
+
/**
|
134 |
+
* {@inheritdoc}
|
135 |
+
*/
|
136 |
+
public function write($string)
|
137 |
+
{
|
138 |
+
// When appending to the end of the currently read stream, you'll want to skip bytes from being read from
|
139 |
+
// the remote stream to emulate other stream wrappers. Basically replacing bytes of data of a fixed length.
|
140 |
+
$overflow = (strlen($string) + $this->ftell()) - $this->remoteStream->ftell();
|
141 |
+
if ($overflow > 0) {
|
142 |
+
$this->skipReadBytes += $overflow;
|
143 |
+
}
|
144 |
+
|
145 |
+
return $this->body->write($string);
|
146 |
+
}
|
147 |
+
|
148 |
+
/**
|
149 |
+
* {@inheritdoc}
|
150 |
+
* @link http://php.net/manual/en/function.fgets.php
|
151 |
+
*/
|
152 |
+
public function readLine($maxLength = null)
|
153 |
+
{
|
154 |
+
$buffer = '';
|
155 |
+
$size = 0;
|
156 |
+
while (!$this->isConsumed()) {
|
157 |
+
$byte = $this->read(1);
|
158 |
+
$buffer .= $byte;
|
159 |
+
// Break when a new line is found or the max length - 1 is reached
|
160 |
+
if ($byte == PHP_EOL || ++$size == $maxLength - 1) {
|
161 |
+
break;
|
162 |
+
}
|
163 |
+
}
|
164 |
+
|
165 |
+
return $buffer;
|
166 |
+
}
|
167 |
+
|
168 |
+
/**
|
169 |
+
* {@inheritdoc}
|
170 |
+
*/
|
171 |
+
public function isConsumed()
|
172 |
+
{
|
173 |
+
return $this->body->isConsumed() && $this->remoteStream->isConsumed();
|
174 |
+
}
|
175 |
+
|
176 |
+
/**
|
177 |
+
* Close both the remote stream and buffer stream
|
178 |
+
*/
|
179 |
+
public function close()
|
180 |
+
{
|
181 |
+
return $this->remoteStream->close() && $this->body->close();
|
182 |
+
}
|
183 |
+
|
184 |
+
/**
|
185 |
+
* {@inheritdoc}
|
186 |
+
*/
|
187 |
+
public function setStream($stream, $size = 0)
|
188 |
+
{
|
189 |
+
$this->remoteStream->setStream($stream, $size);
|
190 |
+
}
|
191 |
+
|
192 |
+
/**
|
193 |
+
* {@inheritdoc}
|
194 |
+
*/
|
195 |
+
public function getContentType()
|
196 |
+
{
|
197 |
+
return $this->remoteStream->getContentType();
|
198 |
+
}
|
199 |
+
|
200 |
+
/**
|
201 |
+
* {@inheritdoc}
|
202 |
+
*/
|
203 |
+
public function getContentEncoding()
|
204 |
+
{
|
205 |
+
return $this->remoteStream->getContentEncoding();
|
206 |
+
}
|
207 |
+
|
208 |
+
/**
|
209 |
+
* {@inheritdoc}
|
210 |
+
*/
|
211 |
+
public function getMetaData($key = null)
|
212 |
+
{
|
213 |
+
return $this->remoteStream->getMetaData($key);
|
214 |
+
}
|
215 |
+
|
216 |
+
/**
|
217 |
+
* {@inheritdoc}
|
218 |
+
*/
|
219 |
+
public function getStream()
|
220 |
+
{
|
221 |
+
return $this->remoteStream->getStream();
|
222 |
+
}
|
223 |
+
|
224 |
+
/**
|
225 |
+
* {@inheritdoc}
|
226 |
+
*/
|
227 |
+
public function getWrapper()
|
228 |
+
{
|
229 |
+
return $this->remoteStream->getWrapper();
|
230 |
+
}
|
231 |
+
|
232 |
+
/**
|
233 |
+
* {@inheritdoc}
|
234 |
+
*/
|
235 |
+
public function getWrapperData()
|
236 |
+
{
|
237 |
+
return $this->remoteStream->getWrapperData();
|
238 |
+
}
|
239 |
+
|
240 |
+
/**
|
241 |
+
* {@inheritdoc}
|
242 |
+
*/
|
243 |
+
public function getStreamType()
|
244 |
+
{
|
245 |
+
return $this->remoteStream->getStreamType();
|
246 |
+
}
|
247 |
+
|
248 |
+
/**
|
249 |
+
* {@inheritdoc}
|
250 |
+
*/
|
251 |
+
public function getUri()
|
252 |
+
{
|
253 |
+
return $this->remoteStream->getUri();
|
254 |
+
}
|
255 |
+
|
256 |
+
/**
|
257 |
+
* Always retrieve custom data from the remote stream
|
258 |
+
*
|
259 |
+
* {@inheritdoc}
|
260 |
+
*/
|
261 |
+
public function getCustomData($key)
|
262 |
+
{
|
263 |
+
return $this->remoteStream->getCustomData($key);
|
264 |
+
}
|
265 |
+
|
266 |
+
/**
|
267 |
+
* Always set custom data on the remote stream
|
268 |
+
*
|
269 |
+
* {@inheritdoc}
|
270 |
+
*/
|
271 |
+
public function setCustomData($key, $value)
|
272 |
+
{
|
273 |
+
$this->remoteStream->setCustomData($key, $value);
|
274 |
+
|
275 |
+
return $this;
|
276 |
+
}
|
277 |
+
}
|
sdk/Aws/Guzzle/Http/Client.php
CHANGED
@@ -6,14 +6,17 @@ use Guzzle\Common\Collection;
|
|
6 |
use Guzzle\Common\AbstractHasDispatcher;
|
7 |
use Guzzle\Common\Exception\ExceptionCollection;
|
8 |
use Guzzle\Common\Exception\InvalidArgumentException;
|
|
|
|
|
9 |
use Guzzle\Parser\ParserRegistry;
|
10 |
use Guzzle\Parser\UriTemplate\UriTemplateInterface;
|
11 |
use Guzzle\Http\Message\RequestInterface;
|
12 |
use Guzzle\Http\Message\RequestFactory;
|
13 |
use Guzzle\Http\Message\RequestFactoryInterface;
|
14 |
use Guzzle\Http\Curl\CurlMultiInterface;
|
15 |
-
use Guzzle\Http\Curl\
|
16 |
use Guzzle\Http\Curl\CurlHandle;
|
|
|
17 |
|
18 |
/**
|
19 |
* HTTP client
|
@@ -77,23 +80,32 @@ class Client extends AbstractHasDispatcher implements ClientInterface
|
|
77 |
public function __construct($baseUrl = '', $config = null)
|
78 |
{
|
79 |
$this->setConfig($config ?: new Collection());
|
|
|
80 |
// Allow ssl.certificate_authority config setting to control the certificate authority used by curl
|
81 |
$authority = $this->config->get(self::SSL_CERT_AUTHORITY);
|
82 |
-
|
83 |
-
|
84 |
-
$authority = 'system';
|
85 |
-
}
|
86 |
-
// Set the config setting to system to use the certificate authority bundle on your system
|
87 |
if ($authority !== 'system') {
|
88 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
}
|
|
|
90 |
$this->setBaseUrl($baseUrl);
|
91 |
$this->defaultHeaders = new Collection();
|
92 |
$this->setRequestFactory(RequestFactory::getInstance());
|
|
|
93 |
// Redirect by default, but allow for redirects to be globally disabled on a client
|
94 |
if (!$this->config->get(self::DISABLE_REDIRECTS)) {
|
95 |
$this->addSubscriber(new RedirectPlugin());
|
96 |
}
|
|
|
|
|
|
|
97 |
}
|
98 |
|
99 |
/**
|
@@ -152,6 +164,10 @@ class Client extends AbstractHasDispatcher implements ClientInterface
|
|
152 |
} elseif (is_dir($certificateAuthority)) {
|
153 |
unset($opts[CURLOPT_CAINFO]);
|
154 |
$opts[CURLOPT_CAPATH] = $certificateAuthority;
|
|
|
|
|
|
|
|
|
155 |
}
|
156 |
}
|
157 |
|
@@ -245,17 +261,13 @@ class Client extends AbstractHasDispatcher implements ClientInterface
|
|
245 |
$url = Url::factory($this->getBaseUrl())->combine($this->expandTemplate($uri, $templateVars));
|
246 |
}
|
247 |
|
248 |
-
if ($this->userAgent) {
|
249 |
-
$this->defaultHeaders->set('User-Agent', $this->userAgent);
|
250 |
-
}
|
251 |
-
|
252 |
// If default headers are provided, then merge them into existing headers
|
253 |
// If a collision occurs, the header is completely replaced
|
254 |
if (count($this->defaultHeaders)) {
|
255 |
-
if ($headers
|
|
|
|
|
256 |
$headers = array_merge($this->defaultHeaders->getAll(), $headers->getAll());
|
257 |
-
} elseif (is_array($headers)) {
|
258 |
-
$headers = array_merge($this->defaultHeaders->getAll(), $headers);
|
259 |
} else {
|
260 |
$headers = $this->defaultHeaders;
|
261 |
}
|
@@ -290,13 +302,25 @@ class Client extends AbstractHasDispatcher implements ClientInterface
|
|
290 |
public function setUserAgent($userAgent, $includeDefault = false)
|
291 |
{
|
292 |
if ($includeDefault) {
|
293 |
-
$userAgent .= ' ' .
|
294 |
}
|
295 |
$this->userAgent = $userAgent;
|
296 |
|
297 |
return $this;
|
298 |
}
|
299 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
300 |
/**
|
301 |
* {@inheritdoc}
|
302 |
*/
|
@@ -397,7 +421,7 @@ class Client extends AbstractHasDispatcher implements ClientInterface
|
|
397 |
public function getCurlMulti()
|
398 |
{
|
399 |
if (!$this->curlMulti) {
|
400 |
-
$this->curlMulti = new
|
401 |
}
|
402 |
|
403 |
return $this->curlMulti;
|
@@ -437,6 +461,11 @@ class Client extends AbstractHasDispatcher implements ClientInterface
|
|
437 |
// Attach client observers to the request
|
438 |
$request->setEventDispatcher(clone $this->getEventDispatcher());
|
439 |
|
|
|
|
|
|
|
|
|
|
|
440 |
$this->dispatch(
|
441 |
'client.create_request',
|
442 |
array(
|
@@ -447,4 +476,27 @@ class Client extends AbstractHasDispatcher implements ClientInterface
|
|
447 |
|
448 |
return $request;
|
449 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
450 |
}
|
6 |
use Guzzle\Common\AbstractHasDispatcher;
|
7 |
use Guzzle\Common\Exception\ExceptionCollection;
|
8 |
use Guzzle\Common\Exception\InvalidArgumentException;
|
9 |
+
use Guzzle\Common\Exception\RuntimeException;
|
10 |
+
use Guzzle\Common\Version;
|
11 |
use Guzzle\Parser\ParserRegistry;
|
12 |
use Guzzle\Parser\UriTemplate\UriTemplateInterface;
|
13 |
use Guzzle\Http\Message\RequestInterface;
|
14 |
use Guzzle\Http\Message\RequestFactory;
|
15 |
use Guzzle\Http\Message\RequestFactoryInterface;
|
16 |
use Guzzle\Http\Curl\CurlMultiInterface;
|
17 |
+
use Guzzle\Http\Curl\CurlMultiProxy;
|
18 |
use Guzzle\Http\Curl\CurlHandle;
|
19 |
+
use Guzzle\Http\Curl\CurlVersion;
|
20 |
|
21 |
/**
|
22 |
* HTTP client
|
80 |
public function __construct($baseUrl = '', $config = null)
|
81 |
{
|
82 |
$this->setConfig($config ?: new Collection());
|
83 |
+
|
84 |
// Allow ssl.certificate_authority config setting to control the certificate authority used by curl
|
85 |
$authority = $this->config->get(self::SSL_CERT_AUTHORITY);
|
86 |
+
|
87 |
+
// Set the SSL certificate
|
|
|
|
|
|
|
88 |
if ($authority !== 'system') {
|
89 |
+
if ($authority === null) {
|
90 |
+
$authority = true;
|
91 |
+
}
|
92 |
+
if ($authority === true && substr(__FILE__, 0, 7) == 'phar://') {
|
93 |
+
$authority = $this->preparePharCacert();
|
94 |
+
}
|
95 |
+
$this->setSslVerification($authority);
|
96 |
}
|
97 |
+
|
98 |
$this->setBaseUrl($baseUrl);
|
99 |
$this->defaultHeaders = new Collection();
|
100 |
$this->setRequestFactory(RequestFactory::getInstance());
|
101 |
+
|
102 |
// Redirect by default, but allow for redirects to be globally disabled on a client
|
103 |
if (!$this->config->get(self::DISABLE_REDIRECTS)) {
|
104 |
$this->addSubscriber(new RedirectPlugin());
|
105 |
}
|
106 |
+
|
107 |
+
// Set the default User-Agent on the client
|
108 |
+
$this->userAgent = $this->getDefaultUserAgent();
|
109 |
}
|
110 |
|
111 |
/**
|
164 |
} elseif (is_dir($certificateAuthority)) {
|
165 |
unset($opts[CURLOPT_CAINFO]);
|
166 |
$opts[CURLOPT_CAPATH] = $certificateAuthority;
|
167 |
+
} else {
|
168 |
+
throw new RuntimeException(
|
169 |
+
'Invalid option passed to ' . self::SSL_CERT_AUTHORITY . ': ' . $certificateAuthority
|
170 |
+
);
|
171 |
}
|
172 |
}
|
173 |
|
261 |
$url = Url::factory($this->getBaseUrl())->combine($this->expandTemplate($uri, $templateVars));
|
262 |
}
|
263 |
|
|
|
|
|
|
|
|
|
264 |
// If default headers are provided, then merge them into existing headers
|
265 |
// If a collision occurs, the header is completely replaced
|
266 |
if (count($this->defaultHeaders)) {
|
267 |
+
if (is_array($headers)) {
|
268 |
+
$headers = array_merge($this->defaultHeaders->getAll(), $headers);
|
269 |
+
} elseif ($headers instanceof Collection) {
|
270 |
$headers = array_merge($this->defaultHeaders->getAll(), $headers->getAll());
|
|
|
|
|
271 |
} else {
|
272 |
$headers = $this->defaultHeaders;
|
273 |
}
|
302 |
public function setUserAgent($userAgent, $includeDefault = false)
|
303 |
{
|
304 |
if ($includeDefault) {
|
305 |
+
$userAgent .= ' ' . $this->getDefaultUserAgent();
|
306 |
}
|
307 |
$this->userAgent = $userAgent;
|
308 |
|
309 |
return $this;
|
310 |
}
|
311 |
|
312 |
+
/**
|
313 |
+
* Get the default User-Agent string to use with Guzzle
|
314 |
+
*
|
315 |
+
* @return string
|
316 |
+
*/
|
317 |
+
public function getDefaultUserAgent()
|
318 |
+
{
|
319 |
+
return 'Guzzle/' . Version::VERSION
|
320 |
+
. ' curl/' . CurlVersion::getInstance()->get('version')
|
321 |
+
. ' PHP/' . PHP_VERSION;
|
322 |
+
}
|
323 |
+
|
324 |
/**
|
325 |
* {@inheritdoc}
|
326 |
*/
|
421 |
public function getCurlMulti()
|
422 |
{
|
423 |
if (!$this->curlMulti) {
|
424 |
+
$this->curlMulti = new CurlMultiProxy();
|
425 |
}
|
426 |
|
427 |
return $this->curlMulti;
|
461 |
// Attach client observers to the request
|
462 |
$request->setEventDispatcher(clone $this->getEventDispatcher());
|
463 |
|
464 |
+
// Set the User-Agent if one is specified on the client but not explicitly on the request
|
465 |
+
if ($this->userAgent && !$request->hasHeader('User-Agent')) {
|
466 |
+
$request->setHeader('User-Agent', $this->userAgent);
|
467 |
+
}
|
468 |
+
|
469 |
$this->dispatch(
|
470 |
'client.create_request',
|
471 |
array(
|
476 |
|
477 |
return $request;
|
478 |
}
|
479 |
+
|
480 |
+
/**
|
481 |
+
* Copy the cecert.pem file from the phar if it is not in the temp folder and validate the MD5 checksum
|
482 |
+
*
|
483 |
+
* @return string
|
484 |
+
* @throws RuntimeException if the file cannot be copied or there is a MD5 mismatch
|
485 |
+
*/
|
486 |
+
protected function preparePharCacert()
|
487 |
+
{
|
488 |
+
$from = __DIR__ . '/Resources/cacert.pem';
|
489 |
+
$certFile = sys_get_temp_dir() . '/guzzle-cacert.pem';
|
490 |
+
if (file_exists($certFile)) {
|
491 |
+
$actualMd5 = md5_file($certFile);
|
492 |
+
$expectedMd5 = trim(file_get_contents("{$from}.md5"));
|
493 |
+
if ($actualMd5 != $expectedMd5) {
|
494 |
+
throw new RuntimeException("{$certFile} MD5 mismatch: expected {$expectedMd5} but got {$actualMd5}");
|
495 |
+
}
|
496 |
+
} elseif (!copy($from, $certFile)) {
|
497 |
+
throw new RuntimeException("Could not copy {$from} to {$certFile}: " . var_export(error_get_last(), true));
|
498 |
+
}
|
499 |
+
|
500 |
+
return $certFile;
|
501 |
+
}
|
502 |
}
|
sdk/Aws/Guzzle/Http/ClientInterface.php
CHANGED
@@ -18,6 +18,11 @@ interface ClientInterface extends HasDispatcherInterface
|
|
18 |
{
|
19 |
const CREATE_REQUEST = 'client.create_request';
|
20 |
|
|
|
|
|
|
|
|
|
|
|
21 |
/**
|
22 |
* Set the configuration object to use with the client
|
23 |
*
|
@@ -139,13 +144,12 @@ interface ClientInterface extends HasDispatcherInterface
|
|
139 |
public function setBaseUrl($url);
|
140 |
|
141 |
/**
|
142 |
-
* Set the
|
143 |
-
* appended to the User-Agent header of all requests.
|
144 |
*
|
145 |
* @param string $userAgent User agent string
|
146 |
-
* @param bool $includeDefault Set to
|
147 |
*
|
148 |
-
* @return
|
149 |
*/
|
150 |
public function setUserAgent($userAgent, $includeDefault = false);
|
151 |
|
18 |
{
|
19 |
const CREATE_REQUEST = 'client.create_request';
|
20 |
|
21 |
+
/**
|
22 |
+
* @var string RFC 1123 HTTP-Date
|
23 |
+
*/
|
24 |
+
const HTTP_DATE = 'D, d M Y H:i:s \G\M\T';
|
25 |
+
|
26 |
/**
|
27 |
* Set the configuration object to use with the client
|
28 |
*
|
144 |
public function setBaseUrl($url);
|
145 |
|
146 |
/**
|
147 |
+
* Set the User-Agent header to be used on all requests from the client
|
|
|
148 |
*
|
149 |
* @param string $userAgent User agent string
|
150 |
+
* @param bool $includeDefault Set to true to prepend the value to Guzzle's default user agent string
|
151 |
*
|
152 |
+
* @return self
|
153 |
*/
|
154 |
public function setUserAgent($userAgent, $includeDefault = false);
|
155 |
|
sdk/Aws/Guzzle/Http/Curl/CurlHandle.php
CHANGED
@@ -5,9 +5,9 @@ namespace Guzzle\Http\Curl;
|
|
5 |
use Guzzle\Common\Exception\InvalidArgumentException;
|
6 |
use Guzzle\Common\Exception\RuntimeException;
|
7 |
use Guzzle\Common\Collection;
|
|
|
8 |
use Guzzle\Http\Message\RequestInterface;
|
9 |
use Guzzle\Parser\ParserRegistry;
|
10 |
-
use Guzzle\Http\Message\EntityEnclosingRequestInterface;
|
11 |
use Guzzle\Http\Url;
|
12 |
|
13 |
/**
|
@@ -48,8 +48,8 @@ class CurlHandle
|
|
48 |
*/
|
49 |
public static function factory(RequestInterface $request)
|
50 |
{
|
51 |
-
$mediator = new RequestMediator($request);
|
52 |
$requestCurlOptions = $request->getCurlOptions();
|
|
|
53 |
$tempContentLength = null;
|
54 |
$method = $request->getMethod();
|
55 |
$bodyAsString = $requestCurlOptions->get(self::BODY_AS_STRING);
|
@@ -57,12 +57,12 @@ class CurlHandle
|
|
57 |
// Array of default cURL options.
|
58 |
$curlOptions = array(
|
59 |
CURLOPT_URL => $request->getUrl(),
|
60 |
-
CURLOPT_CONNECTTIMEOUT =>
|
61 |
CURLOPT_RETURNTRANSFER => false,
|
62 |
CURLOPT_HEADER => false,
|
63 |
-
CURLOPT_USERAGENT => (string) $request->getHeader('User-Agent'),
|
64 |
CURLOPT_PORT => $request->getPort(),
|
65 |
CURLOPT_HTTPHEADER => array(),
|
|
|
66 |
CURLOPT_HEADERFUNCTION => array($mediator, 'receiveResponseHeader'),
|
67 |
CURLOPT_HTTP_VERSION => $request->getProtocolVersion() === '1.0'
|
68 |
? CURL_HTTP_VERSION_1_0 : CURL_HTTP_VERSION_1_1,
|
@@ -72,7 +72,7 @@ class CurlHandle
|
|
72 |
CURLOPT_SSL_VERIFYHOST => 2
|
73 |
);
|
74 |
|
75 |
-
if (
|
76 |
// Allow only HTTP and HTTPS protocols
|
77 |
$curlOptions[CURLOPT_PROTOCOLS] = CURLPROTO_HTTP | CURLPROTO_HTTPS;
|
78 |
}
|
@@ -101,49 +101,29 @@ class CurlHandle
|
|
101 |
$curlOptions[CURLOPT_VERBOSE] = true;
|
102 |
}
|
103 |
|
104 |
-
// HEAD requests need no response body, everything else might
|
105 |
-
if ($method != 'HEAD') {
|
106 |
-
$curlOptions[CURLOPT_WRITEFUNCTION] = array($mediator, 'writeResponseBody');
|
107 |
-
}
|
108 |
-
|
109 |
// Specify settings according to the HTTP method
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
// Allow multiple files in the same key
|
126 |
-
$fieldKey = $prefixKeys ? "{$key}[{$index}]" : $key;
|
127 |
-
$fields[$fieldKey] = $file->getCurlString();
|
128 |
-
}
|
129 |
-
}
|
130 |
-
$curlOptions[CURLOPT_POSTFIELDS] = $fields;
|
131 |
-
$request->removeHeader('Content-Length');
|
132 |
-
} elseif (count($request->getPostFields())) {
|
133 |
-
$curlOptions[CURLOPT_POSTFIELDS] = (string) $request->getPostFields()->useUrlEncoding(true);
|
134 |
-
$request->removeHeader('Content-Length');
|
135 |
-
} elseif (!$request->getBody()) {
|
136 |
-
// Need to remove CURLOPT_POST to prevent chunked encoding for an empty POST
|
137 |
-
unset($curlOptions[CURLOPT_POST]);
|
138 |
-
$curlOptions[CURLOPT_CUSTOMREQUEST] = 'POST';
|
139 |
-
}
|
140 |
-
break;
|
141 |
-
case 'PUT':
|
142 |
-
case 'PATCH':
|
143 |
-
case 'DELETE':
|
144 |
-
default:
|
145 |
-
$curlOptions[CURLOPT_CUSTOMREQUEST] = $method;
|
146 |
if ($bodyAsString) {
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
// Remove the curl generated Content-Type header if none was set manually
|
148 |
if (!$request->hasHeader('Content-Type')) {
|
149 |
$curlOptions[CURLOPT_HTTPHEADER][] = 'Content-Type:';
|
@@ -155,26 +135,40 @@ class CurlHandle
|
|
155 |
$tempContentLength = (int) (string) $tempContentLength;
|
156 |
$curlOptions[CURLOPT_INFILESIZE] = $tempContentLength;
|
157 |
}
|
158 |
-
}
|
159 |
-
}
|
160 |
-
|
161 |
-
// Special handling for requests sending raw data
|
162 |
-
if ($request instanceof EntityEnclosingRequestInterface) {
|
163 |
-
if ($request->getBody()) {
|
164 |
-
if ($bodyAsString) {
|
165 |
-
$curlOptions[CURLOPT_POSTFIELDS] = (string) $request->getBody();
|
166 |
-
// Allow curl to add the Content-Length for us to account for the times when
|
167 |
-
// POST redirects are followed by GET requests
|
168 |
-
if ($tempContentLength = $request->getHeader('Content-Length')) {
|
169 |
-
$tempContentLength = (int) (string) $tempContentLength;
|
170 |
-
}
|
171 |
-
} else {
|
172 |
// Add a callback for curl to read data to send with the request only if a body was specified
|
173 |
$curlOptions[CURLOPT_READFUNCTION] = array($mediator, 'readRequestBody');
|
174 |
// Attempt to seek to the start of the stream
|
175 |
$request->getBody()->seek(0);
|
176 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
177 |
}
|
|
|
178 |
// If the Expect header is not present, prevent curl from adding it
|
179 |
if (!$request->hasHeader('Expect')) {
|
180 |
$curlOptions[CURLOPT_HTTPHEADER][] = 'Expect:';
|
@@ -187,7 +181,7 @@ class CurlHandle
|
|
187 |
}
|
188 |
|
189 |
// Set custom cURL options
|
190 |
-
foreach ($requestCurlOptions as $key => $value) {
|
191 |
if (is_numeric($key)) {
|
192 |
$curlOptions[$key] = $value;
|
193 |
}
|
@@ -461,7 +455,10 @@ class CurlHandle
|
|
461 |
// Convert constants represented as string to constant int values
|
462 |
$key = constant($key);
|
463 |
}
|
464 |
-
|
|
|
|
|
|
|
465 |
}
|
466 |
|
467 |
return $curlOptions;
|
5 |
use Guzzle\Common\Exception\InvalidArgumentException;
|
6 |
use Guzzle\Common\Exception\RuntimeException;
|
7 |
use Guzzle\Common\Collection;
|
8 |
+
use Guzzle\Http\Message\EntityEnclosingRequest;
|
9 |
use Guzzle\Http\Message\RequestInterface;
|
10 |
use Guzzle\Parser\ParserRegistry;
|
|
|
11 |
use Guzzle\Http\Url;
|
12 |
|
13 |
/**
|
48 |
*/
|
49 |
public static function factory(RequestInterface $request)
|
50 |
{
|
|
|
51 |
$requestCurlOptions = $request->getCurlOptions();
|
52 |
+
$mediator = new RequestMediator($request, $requestCurlOptions->get('emit_io'));
|
53 |
$tempContentLength = null;
|
54 |
$method = $request->getMethod();
|
55 |
$bodyAsString = $requestCurlOptions->get(self::BODY_AS_STRING);
|
57 |
// Array of default cURL options.
|
58 |
$curlOptions = array(
|
59 |
CURLOPT_URL => $request->getUrl(),
|
60 |
+
CURLOPT_CONNECTTIMEOUT => 150,
|
61 |
CURLOPT_RETURNTRANSFER => false,
|
62 |
CURLOPT_HEADER => false,
|
|
|
63 |
CURLOPT_PORT => $request->getPort(),
|
64 |
CURLOPT_HTTPHEADER => array(),
|
65 |
+
CURLOPT_WRITEFUNCTION => array($mediator, 'writeResponseBody'),
|
66 |
CURLOPT_HEADERFUNCTION => array($mediator, 'receiveResponseHeader'),
|
67 |
CURLOPT_HTTP_VERSION => $request->getProtocolVersion() === '1.0'
|
68 |
? CURL_HTTP_VERSION_1_0 : CURL_HTTP_VERSION_1_1,
|
72 |
CURLOPT_SSL_VERIFYHOST => 2
|
73 |
);
|
74 |
|
75 |
+
if (defined('CURLOPT_PROTOCOLS')) {
|
76 |
// Allow only HTTP and HTTPS protocols
|
77 |
$curlOptions[CURLOPT_PROTOCOLS] = CURLPROTO_HTTP | CURLPROTO_HTTPS;
|
78 |
}
|
101 |
$curlOptions[CURLOPT_VERBOSE] = true;
|
102 |
}
|
103 |
|
|
|
|
|
|
|
|
|
|
|
104 |
// Specify settings according to the HTTP method
|
105 |
+
if ($method == 'GET') {
|
106 |
+
$curlOptions[CURLOPT_HTTPGET] = true;
|
107 |
+
} elseif ($method == 'HEAD') {
|
108 |
+
$curlOptions[CURLOPT_NOBODY] = true;
|
109 |
+
// HEAD requests do not use a write function
|
110 |
+
unset($curlOptions[CURLOPT_WRITEFUNCTION]);
|
111 |
+
} elseif (!($request instanceof EntityEnclosingRequest)) {
|
112 |
+
$curlOptions[CURLOPT_CUSTOMREQUEST] = $method;
|
113 |
+
} else {
|
114 |
+
|
115 |
+
$curlOptions[CURLOPT_CUSTOMREQUEST] = $method;
|
116 |
+
|
117 |
+
// Handle sending raw bodies in a request
|
118 |
+
if ($request->getBody()) {
|
119 |
+
// You can send the body as a string using curl's CURLOPT_POSTFIELDS
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
if ($bodyAsString) {
|
121 |
+
$curlOptions[CURLOPT_POSTFIELDS] = (string) $request->getBody();
|
122 |
+
// Allow curl to add the Content-Length for us to account for the times when
|
123 |
+
// POST redirects are followed by GET requests
|
124 |
+
if ($tempContentLength = $request->getHeader('Content-Length')) {
|
125 |
+
$tempContentLength = (int) (string) $tempContentLength;
|
126 |
+
}
|
127 |
// Remove the curl generated Content-Type header if none was set manually
|
128 |
if (!$request->hasHeader('Content-Type')) {
|
129 |
$curlOptions[CURLOPT_HTTPHEADER][] = 'Content-Type:';
|
135 |
$tempContentLength = (int) (string) $tempContentLength;
|
136 |
$curlOptions[CURLOPT_INFILESIZE] = $tempContentLength;
|
137 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
// Add a callback for curl to read data to send with the request only if a body was specified
|
139 |
$curlOptions[CURLOPT_READFUNCTION] = array($mediator, 'readRequestBody');
|
140 |
// Attempt to seek to the start of the stream
|
141 |
$request->getBody()->seek(0);
|
142 |
}
|
143 |
+
|
144 |
+
} else {
|
145 |
+
|
146 |
+
// Special handling for POST specific fields and files
|
147 |
+
$postFields = false;
|
148 |
+
if (count($request->getPostFiles())) {
|
149 |
+
$postFields = $request->getPostFields()->useUrlEncoding(false)->urlEncode();
|
150 |
+
foreach ($request->getPostFiles() as $key => $data) {
|
151 |
+
$prefixKeys = count($data) > 1;
|
152 |
+
foreach ($data as $index => $file) {
|
153 |
+
// Allow multiple files in the same key
|
154 |
+
$fieldKey = $prefixKeys ? "{$key}[{$index}]" : $key;
|
155 |
+
$postFields[$fieldKey] = $file->getCurlValue();
|
156 |
+
}
|
157 |
+
}
|
158 |
+
} elseif (count($request->getPostFields())) {
|
159 |
+
$postFields = (string) $request->getPostFields()->useUrlEncoding(true);
|
160 |
+
}
|
161 |
+
|
162 |
+
if ($postFields !== false) {
|
163 |
+
if ($method == 'POST') {
|
164 |
+
unset($curlOptions[CURLOPT_CUSTOMREQUEST]);
|
165 |
+
$curlOptions[CURLOPT_POST] = true;
|
166 |
+
}
|
167 |
+
$curlOptions[CURLOPT_POSTFIELDS] = $postFields;
|
168 |
+
$request->removeHeader('Content-Length');
|
169 |
+
}
|
170 |
}
|
171 |
+
|
172 |
// If the Expect header is not present, prevent curl from adding it
|
173 |
if (!$request->hasHeader('Expect')) {
|
174 |
$curlOptions[CURLOPT_HTTPHEADER][] = 'Expect:';
|
181 |
}
|
182 |
|
183 |
// Set custom cURL options
|
184 |
+
foreach ($requestCurlOptions->getAll() as $key => $value) {
|
185 |
if (is_numeric($key)) {
|
186 |
$curlOptions[$key] = $value;
|
187 |
}
|
455 |
// Convert constants represented as string to constant int values
|
456 |
$key = constant($key);
|
457 |
}
|
458 |
+
if (is_string($value) && defined($value)) {
|
459 |
+
$value = constant($value);
|
460 |
+
}
|
461 |
+
$curlOptions[$key] = $value;
|
462 |
}
|
463 |
|
464 |
return $curlOptions;
|
sdk/Aws/Guzzle/Http/Curl/CurlMulti.php
CHANGED
@@ -9,12 +9,6 @@ use Guzzle\Http\Message\RequestInterface;
|
|
9 |
|
10 |
/**
|
11 |
* Send {@see RequestInterface} objects in parallel using curl_multi
|
12 |
-
*
|
13 |
-
* This implementation allows callers to send blocking requests that return back to the caller when their requests
|
14 |
-
* complete, regardless of whether or not previously sending requests in the curl_multi object have completed. The
|
15 |
-
* implementation relies on managing the recursion scope in which a caller adds a request to the CurlMulti object, and
|
16 |
-
* tracking the requests in the current scope until they complete. Although the CurlMulti object only tracks whether
|
17 |
-
* or not requests in the current scope have completed, it still sends all requests added to the object in parallel.
|
18 |
*/
|
19 |
class CurlMulti extends AbstractHasDispatcher implements CurlMultiInterface
|
20 |
{
|
@@ -23,23 +17,13 @@ class CurlMulti extends AbstractHasDispatcher implements CurlMultiInterface
|
|
23 |
*/
|
24 |
protected $multiHandle;
|
25 |
|
26 |
-
/**
|
27 |
-
* @var string The current state of the pool
|
28 |
-
*/
|
29 |
-
protected $state = self::STATE_IDLE;
|
30 |
-
|
31 |
/**
|
32 |
* @var array Attached {@see RequestInterface} objects.
|
33 |
*/
|
34 |
protected $requests;
|
35 |
|
36 |
/**
|
37 |
-
* @var
|
38 |
-
*/
|
39 |
-
protected $requestCache;
|
40 |
-
|
41 |
-
/**
|
42 |
-
* @var \SplObjectStorage {@see RequestInterface} to {@see CurlHandle} storage
|
43 |
*/
|
44 |
protected $handles;
|
45 |
|
@@ -54,9 +38,9 @@ class CurlMulti extends AbstractHasDispatcher implements CurlMultiInterface
|
|
54 |
protected $exceptions = array();
|
55 |
|
56 |
/**
|
57 |
-
* @var array
|
58 |
*/
|
59 |
-
protected $
|
60 |
|
61 |
/**
|
62 |
* @var array cURL multi error values and codes
|
@@ -68,49 +52,18 @@ class CurlMulti extends AbstractHasDispatcher implements CurlMultiInterface
|
|
68 |
CURLM_INTERNAL_ERROR => array('CURLM_INTERNAL_ERROR', 'This can only be returned if libcurl bugs. Please report it to us!')
|
69 |
);
|
70 |
|
71 |
-
/**
|
72 |
-
* @var CurlMulti
|
73 |
-
*/
|
74 |
-
private static $instance;
|
75 |
-
|
76 |
-
/**
|
77 |
-
* @var int
|
78 |
-
*/
|
79 |
-
private $scope = -1;
|
80 |
-
|
81 |
-
/**
|
82 |
-
* {@inheritdoc}
|
83 |
-
*/
|
84 |
-
public static function getAllEvents()
|
85 |
-
{
|
86 |
-
return array(
|
87 |
-
// A request was added
|
88 |
-
self::ADD_REQUEST,
|
89 |
-
// A request was removed
|
90 |
-
self::REMOVE_REQUEST,
|
91 |
-
// Requests are about to be sent
|
92 |
-
self::BEFORE_SEND,
|
93 |
-
// The pool finished sending the requests
|
94 |
-
self::COMPLETE,
|
95 |
-
// A request is still polling (sent to request's event dispatchers)
|
96 |
-
self::POLLING_REQUEST,
|
97 |
-
// A request exception occurred
|
98 |
-
self::MULTI_EXCEPTION
|
99 |
-
);
|
100 |
-
}
|
101 |
-
|
102 |
/**
|
103 |
* {@inheritdoc}
|
104 |
*/
|
105 |
public function __construct()
|
106 |
{
|
107 |
-
|
108 |
-
//
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
$this->
|
114 |
}
|
115 |
|
116 |
/**
|
@@ -125,40 +78,14 @@ class CurlMulti extends AbstractHasDispatcher implements CurlMultiInterface
|
|
125 |
|
126 |
/**
|
127 |
* {@inheritdoc}
|
128 |
-
*
|
129 |
-
* Adds a request to a batch of requests to be sent in parallel.
|
130 |
-
*
|
131 |
-
* Async requests adds a request to the current scope to be executed in parallel with any currently executing cURL
|
132 |
-
* handles. You may only add an async request while other requests are transferring. Attempting to add an async
|
133 |
-
* request while no requests are transferring will add the request normally in the next available scope (e.g. 0).
|
134 |
-
*
|
135 |
-
* @param RequestInterface $request Request to add
|
136 |
-
* @param bool $async Set to TRUE to add to the current scope
|
137 |
-
*
|
138 |
-
* @return self
|
139 |
*/
|
140 |
-
public function add(RequestInterface $request
|
141 |
{
|
142 |
-
|
143 |
-
$async = false;
|
144 |
-
}
|
145 |
-
|
146 |
-
$this->requestCache = null;
|
147 |
-
$scope = $async ? $this->scope : $this->scope + 1;
|
148 |
-
|
149 |
-
if (!isset($this->requests[$scope])) {
|
150 |
-
$this->requests[$scope] = array($request);
|
151 |
-
} else {
|
152 |
-
$this->requests[$scope][] = $request;
|
153 |
-
}
|
154 |
-
|
155 |
-
$this->dispatch(self::ADD_REQUEST, array('request' => $request));
|
156 |
-
|
157 |
// If requests are currently transferring and this is async, then the
|
158 |
// request must be prepared now as the send() method is not called.
|
159 |
-
|
160 |
-
|
161 |
-
}
|
162 |
|
163 |
return $this;
|
164 |
}
|
@@ -168,19 +95,7 @@ class CurlMulti extends AbstractHasDispatcher implements CurlMultiInterface
|
|
168 |
*/
|
169 |
public function all()
|
170 |
{
|
171 |
-
|
172 |
-
$this->requestCache = empty($this->requests) ? array() : call_user_func_array('array_merge', $this->requests);
|
173 |
-
}
|
174 |
-
|
175 |
-
return $this->requestCache;
|
176 |
-
}
|
177 |
-
|
178 |
-
/**
|
179 |
-
* {@inheritdoc}
|
180 |
-
*/
|
181 |
-
public function getState()
|
182 |
-
{
|
183 |
-
return $this->state;
|
184 |
}
|
185 |
|
186 |
/**
|
@@ -189,19 +104,16 @@ class CurlMulti extends AbstractHasDispatcher implements CurlMultiInterface
|
|
189 |
public function remove(RequestInterface $request)
|
190 |
{
|
191 |
$this->removeHandle($request);
|
192 |
-
$this->
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
break;
|
199 |
}
|
200 |
}
|
201 |
|
202 |
-
|
203 |
-
|
204 |
-
return $this;
|
205 |
}
|
206 |
|
207 |
/**
|
@@ -210,28 +122,14 @@ class CurlMulti extends AbstractHasDispatcher implements CurlMultiInterface
|
|
210 |
public function reset($hard = false)
|
211 |
{
|
212 |
// Remove each request
|
213 |
-
|
214 |
-
$this->
|
215 |
-
|
216 |
-
|
217 |
-
$this->requests = array();
|
218 |
-
$this->exceptions = array();
|
219 |
-
$this->state = self::STATE_IDLE;
|
220 |
-
$this->scope = -1;
|
221 |
-
$this->requestCache = null;
|
222 |
-
|
223 |
-
// Remove any curl handles that were queued for removal
|
224 |
-
if ($this->scope == -1 || $hard) {
|
225 |
-
foreach ($this->removeHandles as $handle) {
|
226 |
-
curl_multi_remove_handle($this->multiHandle, $handle->getHandle());
|
227 |
-
$handle->close();
|
228 |
}
|
229 |
-
$this->removeHandles = array();
|
230 |
}
|
231 |
|
232 |
-
|
233 |
-
|
234 |
-
}
|
235 |
}
|
236 |
|
237 |
/**
|
@@ -239,47 +137,13 @@ class CurlMulti extends AbstractHasDispatcher implements CurlMultiInterface
|
|
239 |
*/
|
240 |
public function send()
|
241 |
{
|
242 |
-
$this->
|
243 |
-
$
|
244 |
-
$
|
245 |
-
|
246 |
-
// Only prepare and send requests that are in the current recursion scope
|
247 |
-
// Only enter the main perform() loop if there are requests in scope
|
248 |
-
if ($requestsInScope) {
|
249 |
-
|
250 |
-
// Any exceptions thrown from this event should break the entire flow of sending requests
|
251 |
-
$this->dispatch(self::BEFORE_SEND, array(
|
252 |
-
'requests' => $this->requests[$this->scope]
|
253 |
-
));
|
254 |
|
255 |
-
|
256 |
-
|
257 |
-
$this->beforeSend($request);
|
258 |
-
}
|
259 |
-
}
|
260 |
-
|
261 |
-
try {
|
262 |
-
$this->perform();
|
263 |
-
} catch (\Exception $e) {
|
264 |
-
$this->exceptions[] = array('request' => null, 'exception' => $e);
|
265 |
-
}
|
266 |
-
}
|
267 |
-
|
268 |
-
$this->scope--;
|
269 |
-
|
270 |
-
// Aggregate exceptions into a MultiTransferException if needed
|
271 |
-
$multiException = $this->buildMultiTransferException($requestsInScope);
|
272 |
-
|
273 |
-
// Complete the transfer if this is not a nested scope
|
274 |
-
if ($this->scope == -1) {
|
275 |
-
$this->state = self::STATE_COMPLETE;
|
276 |
-
$this->dispatch(self::COMPLETE);
|
277 |
-
$this->reset();
|
278 |
-
}
|
279 |
-
|
280 |
-
// Throw any exceptions that were encountered
|
281 |
-
if ($multiException) {
|
282 |
-
throw $multiException;
|
283 |
}
|
284 |
}
|
285 |
|
@@ -288,70 +152,62 @@ class CurlMulti extends AbstractHasDispatcher implements CurlMultiInterface
|
|
288 |
*/
|
289 |
public function count()
|
290 |
{
|
291 |
-
return count($this->
|
292 |
}
|
293 |
|
294 |
/**
|
295 |
-
* Build a MultiTransferException
|
296 |
*
|
297 |
-
* @param array $
|
298 |
-
*
|
299 |
-
* @
|
300 |
*/
|
301 |
-
protected function
|
302 |
{
|
303 |
-
if (empty($this->exceptions)) {
|
304 |
-
return null;
|
305 |
-
}
|
306 |
-
|
307 |
-
// Keep a list of all requests, and remove errored requests from the list
|
308 |
-
$store = new \SplObjectStorage();
|
309 |
-
foreach ($requestsInScope as $request) {
|
310 |
-
$store->attach($request);
|
311 |
-
}
|
312 |
-
|
313 |
$multiException = new MultiTransferException('Errors during multi transfer');
|
314 |
-
|
|
|
315 |
$multiException->add($e['exception']);
|
316 |
-
|
317 |
-
$multiException->addFailedRequest($e['request']);
|
318 |
-
// Remove from the total list so that it becomes a list of successful requests
|
319 |
-
unset($store[$e['request']]);
|
320 |
-
}
|
321 |
}
|
322 |
|
323 |
// Add successful requests
|
324 |
-
foreach ($
|
325 |
-
|
|
|
|
|
326 |
}
|
327 |
|
328 |
-
|
329 |
}
|
330 |
|
331 |
/**
|
332 |
* Prepare for sending
|
333 |
*
|
334 |
* @param RequestInterface $request Request to prepare
|
|
|
335 |
*/
|
336 |
protected function beforeSend(RequestInterface $request)
|
337 |
{
|
338 |
try {
|
|
|
|
|
|
|
|
|
339 |
$request->setState(RequestInterface::STATE_TRANSFER);
|
340 |
-
$request->dispatch('request.before_send', array(
|
341 |
-
'request' => $request
|
342 |
-
));
|
343 |
if ($request->getState() != RequestInterface::STATE_TRANSFER) {
|
344 |
// Requests might decide they don't need to be sent just before transfer (e.g. CachePlugin)
|
345 |
$this->remove($request);
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
$request->setState(RequestInterface::STATE_COMPLETE);
|
350 |
} else {
|
351 |
-
// Add the request
|
352 |
$this->checkCurlResult(curl_multi_add_handle($this->multiHandle, $this->createCurlHandle($request)->getHandle()));
|
353 |
}
|
354 |
} catch (\Exception $e) {
|
|
|
355 |
$this->removeErroredRequest($request, $e);
|
356 |
}
|
357 |
}
|
@@ -366,7 +222,7 @@ class CurlMulti extends AbstractHasDispatcher implements CurlMultiInterface
|
|
366 |
protected function createCurlHandle(RequestInterface $request)
|
367 |
{
|
368 |
$wrapper = CurlHandle::factory($request);
|
369 |
-
$this->handles
|
370 |
$this->resourceHash[(int) $wrapper->getHandle()] = $request;
|
371 |
|
372 |
return $wrapper;
|
@@ -377,38 +233,27 @@ class CurlMulti extends AbstractHasDispatcher implements CurlMultiInterface
|
|
377 |
*/
|
378 |
protected function perform()
|
379 |
{
|
380 |
-
|
381 |
-
// Weird things can happen when making HTTP requests in __destruct methods
|
382 |
-
if (!$this->multiHandle) {
|
383 |
-
return;
|
384 |
-
}
|
385 |
-
// @codeCoverageIgnoreEnd
|
386 |
-
|
387 |
-
// If there are no requests to send, then exit from the function
|
388 |
-
if ($this->scope <= 0) {
|
389 |
-
if ($this->count() == 0) {
|
390 |
-
return;
|
391 |
-
}
|
392 |
-
} elseif (empty($this->requests[$this->scope])) {
|
393 |
return;
|
394 |
}
|
395 |
|
396 |
-
//
|
|
|
|
|
397 |
$event = array('curl_multi' => $this);
|
398 |
-
$active = $this->executeHandles();
|
399 |
|
400 |
while (1) {
|
401 |
|
402 |
$this->processMessages();
|
403 |
|
404 |
// Exit the function if there are no more requests to send
|
405 |
-
if (
|
406 |
break;
|
407 |
}
|
408 |
|
409 |
// Notify each request as polling
|
410 |
$blocking = $total = 0;
|
411 |
-
foreach ($
|
412 |
$event['request'] = $request;
|
413 |
$request->dispatch(self::POLLING_REQUEST, $event);
|
414 |
++$total;
|
@@ -422,9 +267,9 @@ class CurlMulti extends AbstractHasDispatcher implements CurlMultiInterface
|
|
422 |
// Sleep to prevent eating CPU because no requests are actually pending a select call
|
423 |
usleep(500);
|
424 |
} else {
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
}
|
429 |
}
|
430 |
}
|
@@ -438,8 +283,11 @@ class CurlMulti extends AbstractHasDispatcher implements CurlMultiInterface
|
|
438 |
while ($done = curl_multi_info_read($this->multiHandle)) {
|
439 |
try {
|
440 |
$request = $this->resourceHash[(int) $done['handle']];
|
441 |
-
$
|
442 |
-
$this->
|
|
|
|
|
|
|
443 |
} catch (\Exception $e) {
|
444 |
$this->removeErroredRequest($request, $e);
|
445 |
}
|
@@ -449,31 +297,26 @@ class CurlMulti extends AbstractHasDispatcher implements CurlMultiInterface
|
|
449 |
/**
|
450 |
* Execute and select curl handles until there is activity
|
451 |
*
|
452 |
-
* @param
|
453 |
-
* @param int
|
454 |
-
* @param int
|
455 |
-
*
|
456 |
-
* @return int Returns the number of active handles
|
457 |
*/
|
458 |
-
private function executeHandles(
|
459 |
{
|
460 |
do {
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
//
|
474 |
-
} while ($select && $active);
|
475 |
-
|
476 |
-
return $active;
|
477 |
}
|
478 |
|
479 |
/**
|
@@ -481,16 +324,17 @@ class CurlMulti extends AbstractHasDispatcher implements CurlMultiInterface
|
|
481 |
*
|
482 |
* @param RequestInterface $request Request to remove
|
483 |
* @param \Exception $e Exception encountered
|
|
|
484 |
*/
|
485 |
-
protected function removeErroredRequest(RequestInterface $request, \Exception $e)
|
486 |
{
|
487 |
-
|
|
|
|
|
|
|
488 |
$this->remove($request);
|
489 |
$request->setState(RequestInterface::STATE_ERROR);
|
490 |
-
$this->dispatch(self::MULTI_EXCEPTION, array(
|
491 |
-
'exception' => $e,
|
492 |
-
'all_exceptions' => $this->exceptions
|
493 |
-
));
|
494 |
}
|
495 |
|
496 |
/**
|
@@ -535,7 +379,7 @@ class CurlMulti extends AbstractHasDispatcher implements CurlMultiInterface
|
|
535 |
}
|
536 |
// The error was not handled, so fail
|
537 |
if ($state == RequestInterface::STATE_ERROR) {
|
538 |
-
/** @var $curlException
|
539 |
throw $curlException;
|
540 |
}
|
541 |
}
|
@@ -544,19 +388,16 @@ class CurlMulti extends AbstractHasDispatcher implements CurlMultiInterface
|
|
544 |
/**
|
545 |
* Remove a curl handle from the curl multi object
|
546 |
*
|
547 |
-
* Nasty things (bus errors, segmentation faults) can sometimes occur when removing curl handles when in a callback
|
548 |
-
* or a recursive scope. Here we are queueing all curl handles that need to be removed and closed so that this
|
549 |
-
* happens only in the outermost scope when everything has completed sending.
|
550 |
-
*
|
551 |
* @param RequestInterface $request Request that owns the handle
|
552 |
*/
|
553 |
protected function removeHandle(RequestInterface $request)
|
554 |
{
|
555 |
-
if ($this->handles
|
556 |
$handle = $this->handles[$request];
|
557 |
-
unset($this->resourceHash[(int) $handle->getHandle()]);
|
558 |
unset($this->handles[$request]);
|
559 |
-
$this->
|
|
|
|
|
560 |
}
|
561 |
}
|
562 |
|
@@ -567,7 +408,7 @@ class CurlMulti extends AbstractHasDispatcher implements CurlMultiInterface
|
|
567 |
* @param CurlHandle $handle Curl handle object
|
568 |
* @param array $curl Array returned from curl_multi_info_read
|
569 |
*
|
570 |
-
* @return
|
571 |
*/
|
572 |
private function isCurlException(RequestInterface $request, CurlHandle $handle, array $curl)
|
573 |
{
|
@@ -579,9 +420,9 @@ class CurlMulti extends AbstractHasDispatcher implements CurlMultiInterface
|
|
579 |
$e = new CurlException(sprintf('[curl] %s: %s [url] %s',
|
580 |
$handle->getErrorNo(), $handle->getError(), $handle->getUrl()));
|
581 |
$e->setCurlHandle($handle)
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
|
586 |
return $e;
|
587 |
}
|
@@ -590,7 +431,6 @@ class CurlMulti extends AbstractHasDispatcher implements CurlMultiInterface
|
|
590 |
* Throw an exception for a cURL multi response if needed
|
591 |
*
|
592 |
* @param int $code Curl response code
|
593 |
-
*
|
594 |
* @throws CurlException
|
595 |
*/
|
596 |
private function checkCurlResult($code)
|
@@ -602,26 +442,4 @@ class CurlMulti extends AbstractHasDispatcher implements CurlMultiInterface
|
|
602 |
);
|
603 |
}
|
604 |
}
|
605 |
-
|
606 |
-
/**
|
607 |
-
* Create the new cURL multi handle with error checking
|
608 |
-
*/
|
609 |
-
private function createMultiHandle()
|
610 |
-
{
|
611 |
-
if ($this->multiHandle && is_resource($this->multiHandle)) {
|
612 |
-
curl_multi_close($this->multiHandle);
|
613 |
-
}
|
614 |
-
|
615 |
-
$this->requests = array();
|
616 |
-
$this->multiHandle = curl_multi_init();
|
617 |
-
$this->handles = new \SplObjectStorage();
|
618 |
-
$this->resourceHash = array();
|
619 |
-
$this->removeHandles = array();
|
620 |
-
|
621 |
-
// @codeCoverageIgnoreStart
|
622 |
-
if ($this->multiHandle === false) {
|
623 |
-
throw new CurlException('Unable to create multi handle');
|
624 |
-
}
|
625 |
-
// @codeCoverageIgnoreEnd
|
626 |
-
}
|
627 |
}
|
9 |
|
10 |
/**
|
11 |
* Send {@see RequestInterface} objects in parallel using curl_multi
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
*/
|
13 |
class CurlMulti extends AbstractHasDispatcher implements CurlMultiInterface
|
14 |
{
|
17 |
*/
|
18 |
protected $multiHandle;
|
19 |
|
|
|
|
|
|
|
|
|
|
|
20 |
/**
|
21 |
* @var array Attached {@see RequestInterface} objects.
|
22 |
*/
|
23 |
protected $requests;
|
24 |
|
25 |
/**
|
26 |
+
* @var \SplObjectStorage RequestInterface to CurlHandle hash
|
|
|
|
|
|
|
|
|
|
|
27 |
*/
|
28 |
protected $handles;
|
29 |
|
38 |
protected $exceptions = array();
|
39 |
|
40 |
/**
|
41 |
+
* @var array Requests that succeeded
|
42 |
*/
|
43 |
+
protected $successful = array();
|
44 |
|
45 |
/**
|
46 |
* @var array cURL multi error values and codes
|
52 |
CURLM_INTERNAL_ERROR => array('CURLM_INTERNAL_ERROR', 'This can only be returned if libcurl bugs. Please report it to us!')
|
53 |
);
|
54 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
/**
|
56 |
* {@inheritdoc}
|
57 |
*/
|
58 |
public function __construct()
|
59 |
{
|
60 |
+
$this->multiHandle = curl_multi_init();
|
61 |
+
// @codeCoverageIgnoreStart
|
62 |
+
if ($this->multiHandle === false) {
|
63 |
+
throw new CurlException('Unable to create multi handle');
|
64 |
+
}
|
65 |
+
// @codeCoverageIgnoreEnd
|
66 |
+
$this->reset();
|
67 |
}
|
68 |
|
69 |
/**
|
78 |
|
79 |
/**
|
80 |
* {@inheritdoc}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
*/
|
82 |
+
public function add(RequestInterface $request)
|
83 |
{
|
84 |
+
$this->requests[] = $request;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
// If requests are currently transferring and this is async, then the
|
86 |
// request must be prepared now as the send() method is not called.
|
87 |
+
$this->beforeSend($request);
|
88 |
+
$this->dispatch(self::ADD_REQUEST, array('request' => $request));
|
|
|
89 |
|
90 |
return $this;
|
91 |
}
|
95 |
*/
|
96 |
public function all()
|
97 |
{
|
98 |
+
return $this->requests;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
}
|
100 |
|
101 |
/**
|
104 |
public function remove(RequestInterface $request)
|
105 |
{
|
106 |
$this->removeHandle($request);
|
107 |
+
foreach ($this->requests as $i => $r) {
|
108 |
+
if ($request === $r) {
|
109 |
+
unset($this->requests[$i]);
|
110 |
+
$this->requests = array_values($this->requests);
|
111 |
+
$this->dispatch(self::REMOVE_REQUEST, array('request' => $request));
|
112 |
+
return true;
|
|
|
113 |
}
|
114 |
}
|
115 |
|
116 |
+
return false;
|
|
|
|
|
117 |
}
|
118 |
|
119 |
/**
|
122 |
public function reset($hard = false)
|
123 |
{
|
124 |
// Remove each request
|
125 |
+
if ($this->requests) {
|
126 |
+
foreach ($this->requests as $request) {
|
127 |
+
$this->remove($request);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
}
|
|
|
129 |
}
|
130 |
|
131 |
+
$this->handles = new \SplObjectStorage();
|
132 |
+
$this->requests = $this->resourceHash = $this->exceptions = $this->successful = array();
|
|
|
133 |
}
|
134 |
|
135 |
/**
|
137 |
*/
|
138 |
public function send()
|
139 |
{
|
140 |
+
$this->perform();
|
141 |
+
$exceptions = $this->exceptions;
|
142 |
+
$successful = $this->successful;
|
143 |
+
$this->reset();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
|
145 |
+
if ($exceptions) {
|
146 |
+
$this->throwMultiException($exceptions, $successful);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
}
|
148 |
}
|
149 |
|
152 |
*/
|
153 |
public function count()
|
154 |
{
|
155 |
+
return count($this->requests);
|
156 |
}
|
157 |
|
158 |
/**
|
159 |
+
* Build and throw a MultiTransferException
|
160 |
*
|
161 |
+
* @param array $exceptions Exceptions encountered
|
162 |
+
* @param array $successful Successful requests
|
163 |
+
* @throws MultiTransferException
|
164 |
*/
|
165 |
+
protected function throwMultiException(array $exceptions, array $successful)
|
166 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
167 |
$multiException = new MultiTransferException('Errors during multi transfer');
|
168 |
+
|
169 |
+
while ($e = array_shift($exceptions)) {
|
170 |
$multiException->add($e['exception']);
|
171 |
+
$multiException->addFailedRequest($e['request']);
|
|
|
|
|
|
|
|
|
172 |
}
|
173 |
|
174 |
// Add successful requests
|
175 |
+
foreach ($successful as $request) {
|
176 |
+
if (!$multiException->containsRequest($request)) {
|
177 |
+
$multiException->addSuccessfulRequest($request);
|
178 |
+
}
|
179 |
}
|
180 |
|
181 |
+
throw $multiException;
|
182 |
}
|
183 |
|
184 |
/**
|
185 |
* Prepare for sending
|
186 |
*
|
187 |
* @param RequestInterface $request Request to prepare
|
188 |
+
* @throws \Exception on error preparing the request
|
189 |
*/
|
190 |
protected function beforeSend(RequestInterface $request)
|
191 |
{
|
192 |
try {
|
193 |
+
// Fix Content-Length and Transfer-Encoding collisions
|
194 |
+
if ($request->hasHeader('Transfer-Encoding') && $request->hasHeader('Content-Length')) {
|
195 |
+
$request->removeHeader('Transfer-Encoding');
|
196 |
+
}
|
197 |
$request->setState(RequestInterface::STATE_TRANSFER);
|
198 |
+
$request->dispatch('request.before_send', array('request' => $request));
|
|
|
|
|
199 |
if ($request->getState() != RequestInterface::STATE_TRANSFER) {
|
200 |
// Requests might decide they don't need to be sent just before transfer (e.g. CachePlugin)
|
201 |
$this->remove($request);
|
202 |
+
if ($request->getState() == RequestInterface::STATE_COMPLETE) {
|
203 |
+
$this->successful[] = $request;
|
204 |
+
}
|
|
|
205 |
} else {
|
206 |
+
// Add the request curl handle to the multi handle
|
207 |
$this->checkCurlResult(curl_multi_add_handle($this->multiHandle, $this->createCurlHandle($request)->getHandle()));
|
208 |
}
|
209 |
} catch (\Exception $e) {
|
210 |
+
// Queue the exception to be thrown when sent
|
211 |
$this->removeErroredRequest($request, $e);
|
212 |
}
|
213 |
}
|
222 |
protected function createCurlHandle(RequestInterface $request)
|
223 |
{
|
224 |
$wrapper = CurlHandle::factory($request);
|
225 |
+
$this->handles[$request] = $wrapper;
|
226 |
$this->resourceHash[(int) $wrapper->getHandle()] = $request;
|
227 |
|
228 |
return $wrapper;
|
233 |
*/
|
234 |
protected function perform()
|
235 |
{
|
236 |
+
if (!$this->requests) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
237 |
return;
|
238 |
}
|
239 |
|
240 |
+
// Initialize the handles with a very quick select timeout
|
241 |
+
$active = $mrc = null;
|
242 |
+
$this->executeHandles($active, $mrc, 0.001);
|
243 |
$event = array('curl_multi' => $this);
|
|
|
244 |
|
245 |
while (1) {
|
246 |
|
247 |
$this->processMessages();
|
248 |
|
249 |
// Exit the function if there are no more requests to send
|
250 |
+
if (!$this->requests) {
|
251 |
break;
|
252 |
}
|
253 |
|
254 |
// Notify each request as polling
|
255 |
$blocking = $total = 0;
|
256 |
+
foreach ($this->requests as $request) {
|
257 |
$event['request'] = $request;
|
258 |
$request->dispatch(self::POLLING_REQUEST, $event);
|
259 |
++$total;
|
267 |
// Sleep to prevent eating CPU because no requests are actually pending a select call
|
268 |
usleep(500);
|
269 |
} else {
|
270 |
+
do {
|
271 |
+
$this->executeHandles($active, $mrc, 1);
|
272 |
+
} while ($active);
|
273 |
}
|
274 |
}
|
275 |
}
|
283 |
while ($done = curl_multi_info_read($this->multiHandle)) {
|
284 |
try {
|
285 |
$request = $this->resourceHash[(int) $done['handle']];
|
286 |
+
$this->processResponse($request, $this->handles[$request], $done);
|
287 |
+
$this->successful[] = $request;
|
288 |
+
} catch (MultiTransferException $e) {
|
289 |
+
$this->removeErroredRequest($request, $e, false);
|
290 |
+
throw $e;
|
291 |
} catch (\Exception $e) {
|
292 |
$this->removeErroredRequest($request, $e);
|
293 |
}
|
297 |
/**
|
298 |
* Execute and select curl handles until there is activity
|
299 |
*
|
300 |
+
* @param int $active Active value to update
|
301 |
+
* @param int $mrc Multi result value to update
|
302 |
+
* @param int $timeout Select timeout in seconds
|
|
|
|
|
303 |
*/
|
304 |
+
private function executeHandles(&$active, &$mrc, $timeout = 1)
|
305 |
{
|
306 |
do {
|
307 |
+
$mrc = curl_multi_exec($this->multiHandle, $active);
|
308 |
+
} while ($mrc == CURLM_CALL_MULTI_PERFORM && $active);
|
309 |
+
$this->checkCurlResult($mrc);
|
310 |
+
|
311 |
+
// @codeCoverageIgnoreStart
|
312 |
+
// Select the curl handles until there is any activity on any of the open file descriptors
|
313 |
+
// See https://github.com/php/php-src/blob/master/ext/curl/multi.c#L170
|
314 |
+
if ($active && $mrc == CURLM_OK && curl_multi_select($this->multiHandle, $timeout) == -1) {
|
315 |
+
// Perform a usleep if a previously executed select returned -1
|
316 |
+
// @see https://bugs.php.net/bug.php?id=61141
|
317 |
+
usleep(100);
|
318 |
+
}
|
319 |
+
// @codeCoverageIgnoreEnd
|
|
|
|
|
|
|
320 |
}
|
321 |
|
322 |
/**
|
324 |
*
|
325 |
* @param RequestInterface $request Request to remove
|
326 |
* @param \Exception $e Exception encountered
|
327 |
+
* @param bool $buffer Set to false to not buffer the exception
|
328 |
*/
|
329 |
+
protected function removeErroredRequest(RequestInterface $request, \Exception $e = null, $buffer = true)
|
330 |
{
|
331 |
+
if ($buffer) {
|
332 |
+
$this->exceptions[] = array('request' => $request, 'exception' => $e);
|
333 |
+
}
|
334 |
+
|
335 |
$this->remove($request);
|
336 |
$request->setState(RequestInterface::STATE_ERROR);
|
337 |
+
$this->dispatch(self::MULTI_EXCEPTION, array('exception' => $e, 'all_exceptions' => $this->exceptions));
|
|
|
|
|
|
|
338 |
}
|
339 |
|
340 |
/**
|
379 |
}
|
380 |
// The error was not handled, so fail
|
381 |
if ($state == RequestInterface::STATE_ERROR) {
|
382 |
+
/** @var CurlException $curlException */
|
383 |
throw $curlException;
|
384 |
}
|
385 |
}
|
388 |
/**
|
389 |
* Remove a curl handle from the curl multi object
|
390 |
*
|
|
|
|
|
|
|
|
|
391 |
* @param RequestInterface $request Request that owns the handle
|
392 |
*/
|
393 |
protected function removeHandle(RequestInterface $request)
|
394 |
{
|
395 |
+
if (isset($this->handles[$request])) {
|
396 |
$handle = $this->handles[$request];
|
|
|
397 |
unset($this->handles[$request]);
|
398 |
+
unset($this->resourceHash[(int) $handle->getHandle()]);
|
399 |
+
curl_multi_remove_handle($this->multiHandle, $handle->getHandle());
|
400 |
+
$handle->close();
|
401 |
}
|
402 |
}
|
403 |
|
408 |
* @param CurlHandle $handle Curl handle object
|
409 |
* @param array $curl Array returned from curl_multi_info_read
|
410 |
*
|
411 |
+
* @return CurlException|bool
|
412 |
*/
|
413 |
private function isCurlException(RequestInterface $request, CurlHandle $handle, array $curl)
|
414 |
{
|
420 |
$e = new CurlException(sprintf('[curl] %s: %s [url] %s',
|
421 |
$handle->getErrorNo(), $handle->getError(), $handle->getUrl()));
|
422 |
$e->setCurlHandle($handle)
|
423 |
+
->setRequest($request)
|
424 |
+
->setCurlInfo($handle->getInfo())
|
425 |
+
->setError($handle->getError(), $handle->getErrorNo());
|
426 |
|
427 |
return $e;
|
428 |
}
|
431 |
* Throw an exception for a cURL multi response if needed
|
432 |
*
|
433 |
* @param int $code Curl response code
|
|
|
434 |
* @throws CurlException
|
435 |
*/
|
436 |
private function checkCurlResult($code)
|
442 |
);
|
443 |
}
|
444 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
445 |
}
|
sdk/Aws/Guzzle/Http/Curl/CurlMultiInterface.php
CHANGED
@@ -9,20 +9,14 @@ use Guzzle\Http\Message\RequestInterface;
|
|
9 |
/**
|
10 |
* Interface for sending a pool of {@see RequestInterface} objects in parallel
|
11 |
*/
|
12 |
-
interface CurlMultiInterface extends
|
13 |
{
|
14 |
-
const BEFORE_SEND = 'curl_multi.before_send';
|
15 |
const POLLING_REQUEST = 'curl_multi.polling_request';
|
16 |
-
const COMPLETE = 'curl_multi.complete';
|
17 |
const ADD_REQUEST = 'curl_multi.add_request';
|
18 |
const REMOVE_REQUEST = 'curl_multi.remove_request';
|
19 |
const MULTI_EXCEPTION = 'curl_multi.exception';
|
20 |
const BLOCKING = 'curl_multi.blocking';
|
21 |
|
22 |
-
const STATE_IDLE = 'idle';
|
23 |
-
const STATE_SENDING = 'sending';
|
24 |
-
const STATE_COMPLETE = 'complete';
|
25 |
-
|
26 |
/**
|
27 |
* Add a request to the pool.
|
28 |
*
|
@@ -39,19 +33,12 @@ interface CurlMultiInterface extends HasDispatcherInterface, \Countable
|
|
39 |
*/
|
40 |
public function all();
|
41 |
|
42 |
-
/**
|
43 |
-
* Get the current state of the Pool
|
44 |
-
*
|
45 |
-
* @return string
|
46 |
-
*/
|
47 |
-
public function getState();
|
48 |
-
|
49 |
/**
|
50 |
* Remove a request from the pool.
|
51 |
*
|
52 |
* @param RequestInterface $request Request to remove
|
53 |
*
|
54 |
-
* @return
|
55 |
*/
|
56 |
public function remove(RequestInterface $request);
|
57 |
|
9 |
/**
|
10 |
* Interface for sending a pool of {@see RequestInterface} objects in parallel
|
11 |
*/
|
12 |
+
interface CurlMultiInterface extends \Countable, HasDispatcherInterface
|
13 |
{
|
|
|
14 |
const POLLING_REQUEST = 'curl_multi.polling_request';
|
|
|
15 |
const ADD_REQUEST = 'curl_multi.add_request';
|
16 |
const REMOVE_REQUEST = 'curl_multi.remove_request';
|
17 |
const MULTI_EXCEPTION = 'curl_multi.exception';
|
18 |
const BLOCKING = 'curl_multi.blocking';
|
19 |
|
|
|
|
|
|
|
|
|
20 |
/**
|
21 |
* Add a request to the pool.
|
22 |
*
|
33 |
*/
|
34 |
public function all();
|
35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
/**
|
37 |
* Remove a request from the pool.
|
38 |
*
|
39 |
* @param RequestInterface $request Request to remove
|
40 |
*
|
41 |
+
* @return bool Returns true on success or false on failure
|
42 |
*/
|
43 |
public function remove(RequestInterface $request);
|
44 |
|
sdk/Aws/Guzzle/Http/Curl/CurlMultiProxy.php
ADDED
@@ -0,0 +1,156 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Guzzle\Http\Curl;
|
4 |
+
|
5 |
+
use Guzzle\Common\AbstractHasDispatcher;
|
6 |
+
use Guzzle\Http\Message\RequestInterface;
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Proxies requests and connections to a pool of internal curl_multi handles. Each recursive call will add requests
|
10 |
+
* to the next available CurlMulti handle.
|
11 |
+
*/
|
12 |
+
class CurlMultiProxy extends AbstractHasDispatcher implements CurlMultiInterface
|
13 |
+
{
|
14 |
+
protected $handles = array();
|
15 |
+
protected $groups = array();
|
16 |
+
protected $queued = array();
|
17 |
+
protected $maxHandles;
|
18 |
+
|
19 |
+
/**
|
20 |
+
* @param int $maxHandles The maximum number of idle CurlMulti handles to allow to remain open
|
21 |
+
*/
|
22 |
+
public function __construct($maxHandles = 3)
|
23 |
+
{
|
24 |
+
$this->maxHandles = $maxHandles;
|
25 |
+
// You can get some weird "Too many open files" errors when sending a large amount of requests in parallel.
|
26 |
+
// These two statements autoload classes before a system runs out of file descriptors so that you can get back
|
27 |
+
// valuable error messages if you run out.
|
28 |
+
class_exists('Guzzle\Http\Message\Response');
|
29 |
+
class_exists('Guzzle\Http\Exception\CurlException');
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* {@inheritdoc}
|
34 |
+
*/
|
35 |
+
public function add(RequestInterface $request)
|
36 |
+
{
|
37 |
+
$this->queued[] = $request;
|
38 |
+
|
39 |
+
return $this;
|
40 |
+
}
|
41 |
+
|
42 |
+
/**
|
43 |
+
* {@inheritdoc}
|
44 |
+
*/
|
45 |
+
public function all()
|
46 |
+
{
|
47 |
+
$requests = $this->queued;
|
48 |
+
foreach ($this->handles as $handle) {
|
49 |
+
$requests = array_merge($requests, $handle->all());
|
50 |
+
}
|
51 |
+
|
52 |
+
return $requests;
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* {@inheritdoc}
|
57 |
+
*/
|
58 |
+
public function remove(RequestInterface $request)
|
59 |
+
{
|
60 |
+
foreach ($this->queued as $i => $r) {
|
61 |
+
if ($request === $r) {
|
62 |
+
unset($this->queued[$i]);
|
63 |
+
return true;
|
64 |
+
}
|
65 |
+
}
|
66 |
+
|
67 |
+
foreach ($this->handles as $handle) {
|
68 |
+
if ($handle->remove($request)) {
|
69 |
+
return true;
|
70 |
+
}
|
71 |
+
}
|
72 |
+
|
73 |
+
return false;
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* {@inheritdoc}
|
78 |
+
*/
|
79 |
+
public function reset($hard = false)
|
80 |
+
{
|
81 |
+
$this->queued = array();
|
82 |
+
$this->groups = array();
|
83 |
+
foreach ($this->handles as $handle) {
|
84 |
+
$handle->reset();
|
85 |
+
}
|
86 |
+
if ($hard) {
|
87 |
+
$this->handles = array();
|
88 |
+
}
|
89 |
+
|
90 |
+
return $this;
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* {@inheritdoc}
|
95 |
+
*/
|
96 |
+
public function send()
|
97 |
+
{
|
98 |
+
if ($this->queued) {
|
99 |
+
$group = $this->getAvailableHandle();
|
100 |
+
// Add this handle to a list of handles than is claimed
|
101 |
+
$this->groups[] = $group;
|
102 |
+
while ($request = array_shift($this->queued)) {
|
103 |
+
$group->add($request);
|
104 |
+
}
|
105 |
+
$group->send();
|
106 |
+
array_pop($this->groups);
|
107 |
+
$this->cleanupHandles();
|
108 |
+
}
|
109 |
+
}
|
110 |
+
|
111 |
+
/**
|
112 |
+
* {@inheritdoc}
|
113 |
+
*/
|
114 |
+
public function count()
|
115 |
+
{
|
116 |
+
return count($this->all());
|
117 |
+
}
|
118 |
+
|
119 |
+
/**
|
120 |
+
* Get an existing available CurlMulti handle or create a new one
|
121 |
+
*
|
122 |
+
* @return CurlMulti
|
123 |
+
*/
|
124 |
+
protected function getAvailableHandle()
|
125 |
+
{
|
126 |
+
// Grab a handle that is not claimed
|
127 |
+
foreach ($this->handles as $h) {
|
128 |
+
if (!in_array($h, $this->groups, true)) {
|
129 |
+
return $h;
|
130 |
+
}
|
131 |
+
}
|
132 |
+
|
133 |
+
// All are claimed, so create one
|
134 |
+
$handle = new CurlMulti();
|
135 |
+
$handle->setEventDispatcher($this->getEventDispatcher());
|
136 |
+
$this->handles[] = $handle;
|
137 |
+
|
138 |
+
return $handle;
|
139 |
+
}
|
140 |
+
|
141 |
+
/**
|
142 |
+
* Trims down unused CurlMulti handles to limit the number of open connections
|
143 |
+
*/
|
144 |
+
protected function cleanupHandles()
|
145 |
+
{
|
146 |
+
if ($diff = max(0, count($this->handles) - $this->maxHandles)) {
|
147 |
+
for ($i = count($this->handles) - 1; $i > 0 && $diff > 0; $i--) {
|
148 |
+
if (!count($this->handles[$i])) {
|
149 |
+
unset($this->handles[$i]);
|
150 |
+
$diff--;
|
151 |
+
}
|
152 |
+
}
|
153 |
+
$this->handles = array_values($this->handles);
|
154 |
+
}
|
155 |
+
}
|
156 |
+
}
|
sdk/Aws/Guzzle/Http/Curl/RequestMediator.php
CHANGED
@@ -26,11 +26,12 @@ class RequestMediator
|
|
26 |
|
27 |
/**
|
28 |
* @param RequestInterface $request Request to mediate
|
|
|
29 |
*/
|
30 |
-
public function __construct(RequestInterface $request)
|
31 |
{
|
32 |
$this->request = $request;
|
33 |
-
$this->emitIo = $
|
34 |
}
|
35 |
|
36 |
/**
|
26 |
|
27 |
/**
|
28 |
* @param RequestInterface $request Request to mediate
|
29 |
+
* @param bool $emitIo Set to true to dispatch events on input and output
|
30 |
*/
|
31 |
+
public function __construct(RequestInterface $request, $emitIo = false)
|
32 |
{
|
33 |
$this->request = $request;
|
34 |
+
$this->emitIo = $emitIo;
|
35 |
}
|
36 |
|
37 |
/**
|
sdk/Aws/Guzzle/Http/EntityBody.php
CHANGED
@@ -85,8 +85,10 @@ class EntityBody extends Stream implements EntityBodyInterface
|
|
85 |
public static function fromString($string)
|
86 |
{
|
87 |
$stream = fopen('php://temp', 'r+');
|
88 |
-
|
89 |
-
|
|
|
|
|
90 |
|
91 |
return new static($stream);
|
92 |
}
|
@@ -140,11 +142,7 @@ class EntityBody extends Stream implements EntityBodyInterface
|
|
140 |
*/
|
141 |
public function getContentType()
|
142 |
{
|
143 |
-
|
144 |
-
return 'application/octet-stream';
|
145 |
-
}
|
146 |
-
|
147 |
-
return Mimetypes::getInstance()->fromFilename($this->getUri()) ?: 'application/octet-stream';
|
148 |
}
|
149 |
|
150 |
/**
|
85 |
public static function fromString($string)
|
86 |
{
|
87 |
$stream = fopen('php://temp', 'r+');
|
88 |
+
if ($string !== '') {
|
89 |
+
fwrite($stream, $string);
|
90 |
+
rewind($stream);
|
91 |
+
}
|
92 |
|
93 |
return new static($stream);
|
94 |
}
|
142 |
*/
|
143 |
public function getContentType()
|
144 |
{
|
145 |
+
return $this->getUri() ? Mimetypes::getInstance()->fromFilename($this->getUri()) : null;
|
|
|
|
|
|
|
|
|
146 |
}
|
147 |
|
148 |
/**
|
sdk/Aws/Guzzle/Http/EntityBodyInterface.php
CHANGED
@@ -47,9 +47,9 @@ interface EntityBodyInterface extends StreamInterface
|
|
47 |
public function getContentLength();
|
48 |
|
49 |
/**
|
50 |
-
* Guess the Content-Type
|
51 |
*
|
52 |
-
* @return string
|
53 |
* @see http://www.php.net/manual/en/function.finfo-open.php
|
54 |
*/
|
55 |
public function getContentType();
|
47 |
public function getContentLength();
|
48 |
|
49 |
/**
|
50 |
+
* Guess the Content-Type of a local stream
|
51 |
*
|
52 |
+
* @return string|null
|
53 |
* @see http://www.php.net/manual/en/function.finfo-open.php
|
54 |
*/
|
55 |
public function getContentType();
|
sdk/Aws/Guzzle/Http/Exception/MultiTransferException.php
CHANGED
@@ -98,4 +98,16 @@ class MultiTransferException extends ExceptionCollection
|
|
98 |
{
|
99 |
return $this->failedRequests;
|
100 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
}
|
98 |
{
|
99 |
return $this->failedRequests;
|
100 |
}
|
101 |
+
|
102 |
+
/**
|
103 |
+
* Check if the exception object contains a request
|
104 |
+
*
|
105 |
+
* @param RequestInterface $request Request to check
|
106 |
+
*
|
107 |
+
* @return bool
|
108 |
+
*/
|
109 |
+
public function containsRequest(RequestInterface $request)
|
110 |
+
{
|
111 |
+
return in_array($request, $this->failedRequests, true) || in_array($request, $this->successfulRequests, true);
|
112 |
+
}
|
113 |
}
|
sdk/Aws/Guzzle/Http/Message/EntityEnclosingRequest.php
CHANGED
@@ -7,6 +7,7 @@ use Guzzle\Http\EntityBodyInterface;
|
|
7 |
use Guzzle\Http\QueryString;
|
8 |
use Guzzle\Http\RedirectPlugin;
|
9 |
use Guzzle\Http\Exception\RequestException;
|
|
|
10 |
|
11 |
/**
|
12 |
* HTTP request that sends an entity-body in the request message (POST, PUT, PATCH, DELETE)
|
@@ -76,7 +77,11 @@ class EntityEnclosingRequest extends Request implements EntityEnclosingRequestIn
|
|
76 |
public function setBody($body, $contentType = null, $tryChunkedTransfer = false)
|
77 |
{
|
78 |
$this->body = EntityBody::factory($body);
|
79 |
-
|
|
|
|
|
|
|
|
|
80 |
|
81 |
if ($contentType) {
|
82 |
$this->setHeader('Content-Type', (string) $contentType);
|
@@ -88,9 +93,9 @@ class EntityEnclosingRequest extends Request implements EntityEnclosingRequestIn
|
|
88 |
}
|
89 |
|
90 |
if ($tryChunkedTransfer) {
|
|
|
91 |
$this->setHeader('Transfer-Encoding', 'chunked');
|
92 |
} else {
|
93 |
-
$this->removeHeader('Transfer-Encoding');
|
94 |
// Set the Content-Length header if it can be determined
|
95 |
$size = $this->body->getContentLength();
|
96 |
if ($size !== null && $size !== false) {
|
@@ -98,12 +103,14 @@ class EntityEnclosingRequest extends Request implements EntityEnclosingRequestIn
|
|
98 |
if ($size > $this->expectCutoff) {
|
99 |
$this->setHeader('Expect', '100-Continue');
|
100 |
}
|
101 |
-
} elseif ('
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
|
|
|
|
107 |
}
|
108 |
}
|
109 |
|
@@ -237,6 +244,12 @@ class EntityEnclosingRequest extends Request implements EntityEnclosingRequestIn
|
|
237 |
|
238 |
if ($field instanceof PostFileInterface) {
|
239 |
$data = $field;
|
|
|
|
|
|
|
|
|
|
|
|
|
240 |
} elseif (!is_string($filename)) {
|
241 |
throw new RequestException('The path to a file must be a string');
|
242 |
} elseif (!empty($filename)) {
|
7 |
use Guzzle\Http\QueryString;
|
8 |
use Guzzle\Http\RedirectPlugin;
|
9 |
use Guzzle\Http\Exception\RequestException;
|
10 |
+
use Guzzle\Http\Mimetypes;
|
11 |
|
12 |
/**
|
13 |
* HTTP request that sends an entity-body in the request message (POST, PUT, PATCH, DELETE)
|
77 |
public function setBody($body, $contentType = null, $tryChunkedTransfer = false)
|
78 |
{
|
79 |
$this->body = EntityBody::factory($body);
|
80 |
+
|
81 |
+
// Auto detect the Content-Type from the path of the request if possible
|
82 |
+
if ($contentType === null && !$this->hasHeader('Content-Type')) {
|
83 |
+
$contentType = $this->body->getContentType() ?: Mimetypes::getInstance()->fromFilename($this->getPath());
|
84 |
+
}
|
85 |
|
86 |
if ($contentType) {
|
87 |
$this->setHeader('Content-Type', (string) $contentType);
|
93 |
}
|
94 |
|
95 |
if ($tryChunkedTransfer) {
|
96 |
+
$this->removeHeader('Content-Length');
|
97 |
$this->setHeader('Transfer-Encoding', 'chunked');
|
98 |
} else {
|
|
|
99 |
// Set the Content-Length header if it can be determined
|
100 |
$size = $this->body->getContentLength();
|
101 |
if ($size !== null && $size !== false) {
|
103 |
if ($size > $this->expectCutoff) {
|
104 |
$this->setHeader('Expect', '100-Continue');
|
105 |
}
|
106 |
+
} elseif (!$this->hasHeader('Content-Length')) {
|
107 |
+
if ('1.1' == $this->protocolVersion) {
|
108 |
+
$this->setHeader('Transfer-Encoding', 'chunked');
|
109 |
+
} else {
|
110 |
+
throw new RequestException(
|
111 |
+
'Cannot determine Content-Length and cannot use chunked Transfer-Encoding when using HTTP/1.0'
|
112 |
+
);
|
113 |
+
}
|
114 |
}
|
115 |
}
|
116 |
|
244 |
|
245 |
if ($field instanceof PostFileInterface) {
|
246 |
$data = $field;
|
247 |
+
} elseif (is_array($filename)) {
|
248 |
+
// Allow multiple values to be set in a single key
|
249 |
+
foreach ($filename as $file) {
|
250 |
+
$this->addPostFile($field, $file, $contentType);
|
251 |
+
}
|
252 |
+
return $this;
|
253 |
} elseif (!is_string($filename)) {
|
254 |
throw new RequestException('The path to a file must be a string');
|
255 |
} elseif (!empty($filename)) {
|
sdk/Aws/Guzzle/Http/Message/EntityEnclosingRequestInterface.php
CHANGED
@@ -11,7 +11,7 @@ use Guzzle\Http\QueryString;
|
|
11 |
*/
|
12 |
interface EntityEnclosingRequestInterface extends RequestInterface
|
13 |
{
|
14 |
-
const URL_ENCODED = 'application/x-www-form-urlencoded';
|
15 |
const MULTIPART = 'multipart/form-data';
|
16 |
|
17 |
/**
|
@@ -23,7 +23,7 @@ interface EntityEnclosingRequestInterface extends RequestInterface
|
|
23 |
* @param bool $tryChunkedTransfer Try to use chunked Transfer-Encoding
|
24 |
*
|
25 |
* @return EntityEnclosingRequestInterface
|
26 |
-
* @throws RequestException if the protocol is < 1.1 and Content-Length
|
27 |
*/
|
28 |
public function setBody($body, $contentType = null, $tryChunkedTransfer = false);
|
29 |
|
11 |
*/
|
12 |
interface EntityEnclosingRequestInterface extends RequestInterface
|
13 |
{
|
14 |
+
const URL_ENCODED = 'application/x-www-form-urlencoded; charset=utf-8';
|
15 |
const MULTIPART = 'multipart/form-data';
|
16 |
|
17 |
/**
|
23 |
* @param bool $tryChunkedTransfer Try to use chunked Transfer-Encoding
|
24 |
*
|
25 |
* @return EntityEnclosingRequestInterface
|
26 |
+
* @throws RequestException if the protocol is < 1.1 and Content-Length can not be determined
|
27 |
*/
|
28 |
public function setBody($body, $contentType = null, $tryChunkedTransfer = false);
|
29 |
|
sdk/Aws/Guzzle/Http/Message/Header.php
CHANGED
@@ -71,14 +71,14 @@ class Header implements ToArrayInterface, \IteratorAggregate, \Countable
|
|
71 |
$header = $this->getName();
|
72 |
}
|
73 |
|
74 |
-
if (!
|
75 |
$this->values[$header] = array($value);
|
76 |
} else {
|
77 |
$this->values[$header][] = $value;
|
78 |
}
|
79 |
|
80 |
// Ensure that the array cache is cleared
|
81 |
-
$this->
|
82 |
|
83 |
return $this;
|
84 |
}
|
@@ -128,7 +128,7 @@ class Header implements ToArrayInterface, \IteratorAggregate, \Countable
|
|
128 |
public function normalize($explodeOnGlue = false)
|
129 |
{
|
130 |
$values = $this->toArray();
|
131 |
-
$this->
|
132 |
|
133 |
// Explode each value on glue if needed
|
134 |
if ($this->glue && $explodeOnGlue) {
|
@@ -160,7 +160,7 @@ class Header implements ToArrayInterface, \IteratorAggregate, \Countable
|
|
160 |
*/
|
161 |
public function hasExactHeader($header)
|
162 |
{
|
163 |
-
return
|
164 |
}
|
165 |
|
166 |
/**
|
@@ -197,7 +197,7 @@ class Header implements ToArrayInterface, \IteratorAggregate, \Countable
|
|
197 |
foreach ($values as $index => $value) {
|
198 |
if ($value == $searchValue) {
|
199 |
unset($this->values[$key][$index]);
|
200 |
-
$this->
|
201 |
break 2;
|
202 |
}
|
203 |
}
|
@@ -252,13 +252,4 @@ class Header implements ToArrayInterface, \IteratorAggregate, \Countable
|
|
252 |
{
|
253 |
return new \ArrayIterator($this->toArray());
|
254 |
}
|
255 |
-
|
256 |
-
/**
|
257 |
-
* Clear the internal header cache
|
258 |
-
*/
|
259 |
-
private function clearCache()
|
260 |
-
{
|
261 |
-
$this->arrayCache = null;
|
262 |
-
$this->stringCache = null;
|
263 |
-
}
|
264 |
}
|
71 |
$header = $this->getName();
|
72 |
}
|
73 |
|
74 |
+
if (!isset($this->values[$header])) {
|
75 |
$this->values[$header] = array($value);
|
76 |
} else {
|
77 |
$this->values[$header][] = $value;
|
78 |
}
|
79 |
|
80 |
// Ensure that the array cache is cleared
|
81 |
+
$this->arrayCache = $this->stringCache = null;
|
82 |
|
83 |
return $this;
|
84 |
}
|
128 |
public function normalize($explodeOnGlue = false)
|
129 |
{
|
130 |
$values = $this->toArray();
|
131 |
+
$this->arrayCache = $this->stringCache = null;
|
132 |
|
133 |
// Explode each value on glue if needed
|
134 |
if ($this->glue && $explodeOnGlue) {
|
160 |
*/
|
161 |
public function hasExactHeader($header)
|
162 |
{
|
163 |
+
return isset($this->values[$header]);
|
164 |
}
|
165 |
|
166 |
/**
|
197 |
foreach ($values as $index => $value) {
|
198 |
if ($value == $searchValue) {
|
199 |
unset($this->values[$key][$index]);
|
200 |
+
$this->arrayCache = $this->stringCache = null;
|
201 |
break 2;
|
202 |
}
|
203 |
}
|
252 |
{
|
253 |
return new \ArrayIterator($this->toArray());
|
254 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
255 |
}
|
sdk/Aws/Guzzle/Http/Message/PostFile.php
CHANGED
@@ -92,13 +92,29 @@ class PostFile implements PostFileInterface
|
|
92 |
/**
|
93 |
* {@inheritdoc}
|
94 |
*/
|
95 |
-
public function
|
96 |
{
|
97 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
|
99 |
-
|
100 |
-
|
101 |
-
|
|
|
|
|
|
|
102 |
}
|
103 |
|
104 |
/**
|
92 |
/**
|
93 |
* {@inheritdoc}
|
94 |
*/
|
95 |
+
public function getCurlValue()
|
96 |
{
|
97 |
+
// PHP 5.5 introduced a CurlFile object that deprecates the old @filename syntax
|
98 |
+
// See: https://wiki.php.net/rfc/curl-file-upload
|
99 |
+
if (function_exists('curl_file_create')) {
|
100 |
+
return curl_file_create($this->filename, $this->contentType, basename($this->filename));
|
101 |
+
}
|
102 |
+
|
103 |
+
// Use the old style if using an older version of PHP
|
104 |
+
$value = "@{$this->filename};filename=" . basename($this->filename);
|
105 |
+
if ($this->contentType) {
|
106 |
+
$value .= ';type=' . $this->contentType;
|
107 |
+
}
|
108 |
+
|
109 |
+
return $value;
|
110 |
+
}
|
111 |
|
112 |
+
/**
|
113 |
+
* @deprecated
|
114 |
+
*/
|
115 |
+
public function getCurlString()
|
116 |
+
{
|
117 |
+
return $this->getCurlValue();
|
118 |
}
|
119 |
|
120 |
/**
|
sdk/Aws/Guzzle/Http/Message/PostFileInterface.php
CHANGED
@@ -59,9 +59,9 @@ interface PostFileInterface
|
|
59 |
public function getContentType();
|
60 |
|
61 |
/**
|
62 |
-
* Get a cURL ready string for the upload
|
63 |
*
|
64 |
* @return string
|
65 |
*/
|
66 |
-
public function
|
67 |
}
|
59 |
public function getContentType();
|
60 |
|
61 |
/**
|
62 |
+
* Get a cURL ready string or CurlFile object for the upload
|
63 |
*
|
64 |
* @return string
|
65 |
*/
|
66 |
+
public function getCurlValue();
|
67 |
}
|
sdk/Aws/Guzzle/Http/Message/Request.php
CHANGED
@@ -6,7 +6,6 @@ use Guzzle\Common\Event;
|
|
6 |
use Guzzle\Common\Collection;
|
7 |
use Guzzle\Common\Exception\RuntimeException;
|
8 |
use Guzzle\Common\Exception\InvalidArgumentException;
|
9 |
-
use Guzzle\Http\Utils;
|
10 |
use Guzzle\Http\Exception\RequestException;
|
11 |
use Guzzle\Http\Exception\BadResponseException;
|
12 |
use Guzzle\Http\ClientInterface;
|
@@ -73,6 +72,11 @@ class Request extends AbstractMessage implements RequestInterface
|
|
73 |
*/
|
74 |
protected $curlOptions;
|
75 |
|
|
|
|
|
|
|
|
|
|
|
76 |
/**
|
77 |
* {@inheritdoc}
|
78 |
*/
|
@@ -136,10 +140,6 @@ class Request extends AbstractMessage implements RequestInterface
|
|
136 |
}
|
137 |
}
|
138 |
|
139 |
-
if (!$this->hasHeader('User-Agent', true)) {
|
140 |
-
$this->setHeader('User-Agent', Utils::getDefaultUserAgent());
|
141 |
-
}
|
142 |
-
|
143 |
$this->setState(self::STATE_NEW);
|
144 |
}
|
145 |
|
@@ -155,7 +155,7 @@ class Request extends AbstractMessage implements RequestInterface
|
|
155 |
$this->curlOptions = clone $this->curlOptions;
|
156 |
$this->params = clone $this->params;
|
157 |
// Remove state based parameters from the cloned request
|
158 |
-
$this->params->remove('curl_handle')->remove('
|
159 |
$this->url = clone $this->url;
|
160 |
$this->response = $this->responseBody = null;
|
161 |
|
@@ -410,7 +410,7 @@ class Request extends AbstractMessage implements RequestInterface
|
|
410 |
public function setAuth($user, $password = '', $scheme = CURLAUTH_BASIC)
|
411 |
{
|
412 |
// If we got false or null, disable authentication
|
413 |
-
if (!$user
|
414 |
$this->password = $this->username = null;
|
415 |
$this->removeHeader('Authorization');
|
416 |
$this->getCurlOptions()->remove(CURLOPT_HTTPAUTH);
|
@@ -422,8 +422,9 @@ class Request extends AbstractMessage implements RequestInterface
|
|
422 |
$this->getCurlOptions()->remove(CURLOPT_HTTPAUTH);
|
423 |
$this->setHeader('Authorization', 'Basic ' . base64_encode($this->username . ':' . $this->password));
|
424 |
} else {
|
425 |
-
$this->getCurlOptions()
|
426 |
-
|
|
|
427 |
}
|
428 |
}
|
429 |
|
@@ -532,16 +533,20 @@ class Request extends AbstractMessage implements RequestInterface
|
|
532 |
}
|
533 |
|
534 |
if ($queued) {
|
535 |
-
$this->
|
|
|
|
|
536 |
} else {
|
537 |
-
$this->getParams()->remove('queued_response');
|
538 |
$this->response = $response;
|
539 |
-
|
|
|
|
|
|
|
|
|
|
|
540 |
$this->processResponse();
|
541 |
}
|
542 |
|
543 |
-
$this->dispatch('request.set_response', $this->getEventArray());
|
544 |
-
|
545 |
return $this;
|
546 |
}
|
547 |
|
@@ -701,6 +706,24 @@ class Request extends AbstractMessage implements RequestInterface
|
|
701 |
return $this;
|
702 |
}
|
703 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
704 |
/**
|
705 |
* {@inheritdoc}
|
706 |
*/
|
@@ -731,17 +754,11 @@ class Request extends AbstractMessage implements RequestInterface
|
|
731 |
* Process a received response
|
732 |
*
|
733 |
* @param array $context Contextual information
|
734 |
-
*
|
735 |
-
* @throws BadResponseException on unsuccessful responses
|
736 |
*/
|
737 |
protected function processResponse(array $context = array())
|
738 |
{
|
739 |
-
|
740 |
-
if ($this->getParams()->get('queued_response')) {
|
741 |
-
$this->response = $this->getParams()->get('queued_response');
|
742 |
-
$this->responseBody = $this->response->getBody();
|
743 |
-
$this->getParams()->remove('queued_response');
|
744 |
-
} elseif (!$this->response) {
|
745 |
// If no response, then processResponse shouldn't have been called
|
746 |
$e = new RequestException('Error completing request');
|
747 |
$e->setRequest($this);
|
@@ -775,7 +792,5 @@ class Request extends AbstractMessage implements RequestInterface
|
|
775 |
$this->dispatch('request.success', $this->getEventArray());
|
776 |
}
|
777 |
}
|
778 |
-
|
779 |
-
return $this;
|
780 |
}
|
781 |
}
|
6 |
use Guzzle\Common\Collection;
|
7 |
use Guzzle\Common\Exception\RuntimeException;
|
8 |
use Guzzle\Common\Exception\InvalidArgumentException;
|
|
|
9 |
use Guzzle\Http\Exception\RequestException;
|
10 |
use Guzzle\Http\Exception\BadResponseException;
|
11 |
use Guzzle\Http\ClientInterface;
|
72 |
*/
|
73 |
protected $curlOptions;
|
74 |
|
75 |
+
/**
|
76 |
+
* @var bool
|
77 |
+
*/
|
78 |
+
protected $isRedirect = false;
|
79 |
+
|
80 |
/**
|
81 |
* {@inheritdoc}
|
82 |
*/
|
140 |
}
|
141 |
}
|
142 |
|
|
|
|
|
|
|
|
|
143 |
$this->setState(self::STATE_NEW);
|
144 |
}
|
145 |
|
155 |
$this->curlOptions = clone $this->curlOptions;
|
156 |
$this->params = clone $this->params;
|
157 |
// Remove state based parameters from the cloned request
|
158 |
+
$this->params->remove('curl_handle')->remove('curl_multi');
|
159 |
$this->url = clone $this->url;
|
160 |
$this->response = $this->responseBody = null;
|
161 |
|
410 |
public function setAuth($user, $password = '', $scheme = CURLAUTH_BASIC)
|
411 |
{
|
412 |
// If we got false or null, disable authentication
|
413 |
+
if (!$user) {
|
414 |
$this->password = $this->username = null;
|
415 |
$this->removeHeader('Authorization');
|
416 |
$this->getCurlOptions()->remove(CURLOPT_HTTPAUTH);
|
422 |
$this->getCurlOptions()->remove(CURLOPT_HTTPAUTH);
|
423 |
$this->setHeader('Authorization', 'Basic ' . base64_encode($this->username . ':' . $this->password));
|
424 |
} else {
|
425 |
+
$this->getCurlOptions()
|
426 |
+
->set(CURLOPT_HTTPAUTH, $scheme)
|
427 |
+
->set(CURLOPT_USERPWD, $this->username . ':' . $this->password);
|
428 |
}
|
429 |
}
|
430 |
|
533 |
}
|
534 |
|
535 |
if ($queued) {
|
536 |
+
$this->getEventDispatcher()->addListener('request.before_send', function ($e) use ($response) {
|
537 |
+
$e['request']->setResponse($response);
|
538 |
+
}, -9999);
|
539 |
} else {
|
|
|
540 |
$this->response = $response;
|
541 |
+
// If a specific response body is specified, then use it instead of the response's body
|
542 |
+
if ($this->responseBody) {
|
543 |
+
$this->getResponseBody()->write((string) $this->response->getBody());
|
544 |
+
} else {
|
545 |
+
$this->responseBody = $this->response->getBody();
|
546 |
+
}
|
547 |
$this->processResponse();
|
548 |
}
|
549 |
|
|
|
|
|
550 |
return $this;
|
551 |
}
|
552 |
|
706 |
return $this;
|
707 |
}
|
708 |
|
709 |
+
/**
|
710 |
+
* {@inheritdoc}
|
711 |
+
*/
|
712 |
+
public function setIsRedirect($isRedirect)
|
713 |
+
{
|
714 |
+
$this->isRedirect = $isRedirect;
|
715 |
+
|
716 |
+
return $this;
|
717 |
+
}
|
718 |
+
|
719 |
+
/**
|
720 |
+
* {@inheritdoc}
|
721 |
+
*/
|
722 |
+
public function isRedirect()
|
723 |
+
{
|
724 |
+
return $this->isRedirect;
|
725 |
+
}
|
726 |
+
|
727 |
/**
|
728 |
* {@inheritdoc}
|
729 |
*/
|
754 |
* Process a received response
|
755 |
*
|
756 |
* @param array $context Contextual information
|
757 |
+
* @throws RequestException|BadResponseException on unsuccessful responses
|
|
|
758 |
*/
|
759 |
protected function processResponse(array $context = array())
|
760 |
{
|
761 |
+
if (!$this->response) {
|
|
|
|
|
|
|
|
|
|
|
762 |
// If no response, then processResponse shouldn't have been called
|
763 |
$e = new RequestException('Error completing request');
|
764 |
$e->setRequest($this);
|
792 |
$this->dispatch('request.success', $this->getEventArray());
|
793 |
}
|
794 |
}
|
|
|
|
|
795 |
}
|
796 |
}
|
sdk/Aws/Guzzle/Http/Message/RequestFactory.php
CHANGED
@@ -91,53 +91,77 @@ class RequestFactory implements RequestFactoryInterface
|
|
91 |
$method = strtoupper($method);
|
92 |
|
93 |
if ($method == 'GET' || $method == 'HEAD' || $method == 'TRACE' || $method == 'OPTIONS') {
|
94 |
-
|
95 |
-
$request = new $
|
96 |
if ($body) {
|
97 |
// The body is where the response body will be stored
|
98 |
-
$
|
|
|
|
|
|
|
99 |
}
|
100 |
return $request;
|
101 |
}
|
102 |
|
103 |
-
|
104 |
-
$request = new $
|
105 |
|
106 |
if ($body) {
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
if ($method == 'POST' && (is_array($body) || $body instanceof Collection)) {
|
111 |
-
|
112 |
// Normalize PHP style cURL uploads with a leading '@' symbol
|
113 |
-
$files = array();
|
114 |
foreach ($body as $key => $value) {
|
115 |
-
if (is_string($value) &&
|
116 |
-
$
|
117 |
unset($body[$key]);
|
118 |
}
|
119 |
}
|
120 |
-
|
121 |
// Add the fields if they are still present and not all files
|
122 |
-
|
123 |
-
$request->addPostFields($body);
|
124 |
-
}
|
125 |
-
// Add any files that were prefixed with '@'
|
126 |
-
if (!empty($files)) {
|
127 |
-
$request->addPostFiles($files);
|
128 |
-
}
|
129 |
-
|
130 |
-
if ($isChunked) {
|
131 |
-
$request->setHeader('Transfer-Encoding', 'chunked');
|
132 |
-
}
|
133 |
-
|
134 |
-
} elseif (is_resource($body) || $body instanceof EntityBody) {
|
135 |
-
$request->setBody($body, (string) $request->getHeader('Content-Type'), $isChunked);
|
136 |
} else {
|
137 |
-
|
|
|
|
|
|
|
|
|
|
|
138 |
}
|
139 |
}
|
140 |
|
141 |
return $request;
|
142 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
}
|
91 |
$method = strtoupper($method);
|
92 |
|
93 |
if ($method == 'GET' || $method == 'HEAD' || $method == 'TRACE' || $method == 'OPTIONS') {
|
94 |
+
// Handle non-entity-enclosing request methods
|
95 |
+
$request = new $this->requestClass($method, $url, $headers);
|
96 |
if ($body) {
|
97 |
// The body is where the response body will be stored
|
98 |
+
$type = gettype($body);
|
99 |
+
if ($type == 'string' || $type == 'resource' || $type == 'object') {
|
100 |
+
$request->setResponseBody($body);
|
101 |
+
}
|
102 |
}
|
103 |
return $request;
|
104 |
}
|
105 |
|
106 |
+
// Create an entity enclosing request by default
|
107 |
+
$request = new $this->entityEnclosingRequestClass($method, $url, $headers);
|
108 |
|
109 |
if ($body) {
|
110 |
+
// Add POST fields and files to an entity enclosing request if an array is used
|
111 |
+
if (is_array($body) || $body instanceof Collection) {
|
|
|
|
|
|
|
112 |
// Normalize PHP style cURL uploads with a leading '@' symbol
|
|
|
113 |
foreach ($body as $key => $value) {
|
114 |
+
if (is_string($value) && substr($value, 0, 1) == '@') {
|
115 |
+
$request->addPostFile($key, $value);
|
116 |
unset($body[$key]);
|
117 |
}
|
118 |
}
|
|
|
119 |
// Add the fields if they are still present and not all files
|
120 |
+
$request->addPostFields($body);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
} else {
|
122 |
+
// Add a raw entity body body to the request
|
123 |
+
$request->setBody(
|
124 |
+
$body,
|
125 |
+
(string) $request->getHeader('Content-Type'),
|
126 |
+
(string) $request->getHeader('Transfer-Encoding') == 'chunked'
|
127 |
+
);
|
128 |
}
|
129 |
}
|
130 |
|
131 |
return $request;
|
132 |
}
|
133 |
+
|
134 |
+
/**
|
135 |
+
* Clone a request while changing the method. Emulates the behavior of
|
136 |
+
* {@see Guzzle\Http\Message\Request::clone}, but can change the HTTP method.
|
137 |
+
*
|
138 |
+
* @param RequestInterface $request Request to clone
|
139 |
+
* @param string $method Method to set
|
140 |
+
*
|
141 |
+
* @return RequestInterface
|
142 |
+
*/
|
143 |
+
public function cloneRequestWithMethod(RequestInterface $request, $method)
|
144 |
+
{
|
145 |
+
// Create the request with the same client if possible
|
146 |
+
if ($client = $request->getClient()) {
|
147 |
+
$cloned = $request->getClient()->createRequest($method, $request->getUrl(), $request->getHeaders());
|
148 |
+
} else {
|
149 |
+
$cloned = $this->create($method, $request->getUrl(), $request->getHeaders());
|
150 |
+
}
|
151 |
+
|
152 |
+
$cloned->getCurlOptions()->replace($request->getCurlOptions()->getAll());
|
153 |
+
$cloned->setEventDispatcher(clone $request->getEventDispatcher());
|
154 |
+
// Ensure that that the Content-Length header is not copied if changing to GET or HEAD
|
155 |
+
if (!($cloned instanceof EntityEnclosingRequestInterface)) {
|
156 |
+
$cloned->removeHeader('Content-Length');
|
157 |
+
} elseif ($request instanceof EntityEnclosingRequestInterface) {
|
158 |
+
$cloned->setBody($request->getBody());
|
159 |
+
}
|
160 |
+
$cloned->getParams()
|
161 |
+
->replace($request->getParams()->getAll())
|
162 |
+
->remove('curl_handle')
|
163 |
+
->remove('curl_multi');
|
164 |
+
|
165 |
+
return $cloned;
|
166 |
+
}
|
167 |
}
|
sdk/Aws/Guzzle/Http/Message/RequestInterface.php
CHANGED
@@ -189,11 +189,12 @@ interface RequestInterface extends MessageInterface, HasDispatcherInterface
|
|
189 |
*
|
190 |
* @param string|bool $user User name or false disable authentication
|
191 |
* @param string $password Password
|
192 |
-
* @param string $scheme Authentication scheme to use (
|
193 |
*
|
194 |
* @return Request
|
195 |
*
|
196 |
-
* @
|
|
|
197 |
* @throws RequestException
|
198 |
*/
|
199 |
public function setAuth($user, $password = '', $scheme = 'Basic');
|
@@ -339,4 +340,20 @@ interface RequestInterface extends MessageInterface, HasDispatcherInterface
|
|
339 |
* @return bool
|
340 |
*/
|
341 |
public function canCache();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
342 |
}
|
189 |
*
|
190 |
* @param string|bool $user User name or false disable authentication
|
191 |
* @param string $password Password
|
192 |
+
* @param string $scheme Authentication scheme to use (CURLAUTH_BASIC, CURLAUTH_DIGEST, etc)
|
193 |
*
|
194 |
* @return Request
|
195 |
*
|
196 |
+
* @link http://www.ietf.org/rfc/rfc2617.txt
|
197 |
+
* @link http://php.net/manual/en/function.curl-setopt.php See the available options for CURLOPT_HTTPAUTH
|
198 |
* @throws RequestException
|
199 |
*/
|
200 |
public function setAuth($user, $password = '', $scheme = 'Basic');
|
340 |
* @return bool
|
341 |
*/
|
342 |
public function canCache();
|
343 |
+
|
344 |
+
/**
|
345 |
+
* Set whether or not the request is a request that resulted from a redirect
|
346 |
+
*
|
347 |
+
* @param bool $isRedirect
|
348 |
+
*
|
349 |
+
* @return self
|
350 |
+
*/
|
351 |
+
public function setIsRedirect($isRedirect);
|
352 |
+
|
353 |
+
/**
|
354 |
+
* Check whether or not the request is a request that resulted from a redirect
|
355 |
+
*
|
356 |
+
* @return bool
|
357 |
+
*/
|
358 |
+
public function isRedirect();
|
359 |
}
|
sdk/Aws/Guzzle/Http/Message/Response.php
CHANGED
@@ -555,9 +555,7 @@ class Response extends AbstractMessage
|
|
555 |
*/
|
556 |
public function getEtag()
|
557 |
{
|
558 |
-
|
559 |
-
|
560 |
-
return $etag ? str_replace('"', '', $etag) : null;
|
561 |
}
|
562 |
|
563 |
/**
|
@@ -845,7 +843,8 @@ class Response extends AbstractMessage
|
|
845 |
/**
|
846 |
* Check if the response is considered fresh.
|
847 |
*
|
848 |
-
* A response is considered fresh when its age is less than the freshness lifetime (maximum age) of the
|
|
|
849 |
*
|
850 |
* @return bool|null
|
851 |
*/
|
@@ -853,7 +852,7 @@ class Response extends AbstractMessage
|
|
853 |
{
|
854 |
$fresh = $this->getFreshness();
|
855 |
|
856 |
-
return $fresh === null ? null : $
|
857 |
}
|
858 |
|
859 |
/**
|
@@ -911,7 +910,7 @@ class Response extends AbstractMessage
|
|
911 |
/**
|
912 |
* Parse the JSON response body and return an array
|
913 |
*
|
914 |
-
* @return array
|
915 |
* @throws RuntimeException if the response body is not in JSON format
|
916 |
*/
|
917 |
public function json()
|
@@ -921,7 +920,7 @@ class Response extends AbstractMessage
|
|
921 |
throw new RuntimeException('Unable to parse response body into JSON: ' . json_last_error());
|
922 |
}
|
923 |
|
924 |
-
return $data
|
925 |
}
|
926 |
|
927 |
/**
|
555 |
*/
|
556 |
public function getEtag()
|
557 |
{
|
558 |
+
return $this->getHeader('ETag', true);
|
|
|
|
|
559 |
}
|
560 |
|
561 |
/**
|
843 |
/**
|
844 |
* Check if the response is considered fresh.
|
845 |
*
|
846 |
+
* A response is considered fresh when its age is less than or equal to the freshness lifetime (maximum age) of the
|
847 |
+
* response.
|
848 |
*
|
849 |
* @return bool|null
|
850 |
*/
|
852 |
{
|
853 |
$fresh = $this->getFreshness();
|
854 |
|
855 |
+
return $fresh === null ? null : $fresh >= 0;
|
856 |
}
|
857 |
|
858 |
/**
|
910 |
/**
|
911 |
* Parse the JSON response body and return an array
|
912 |
*
|
913 |
+
* @return array|string|int|bool|float
|
914 |
* @throws RuntimeException if the response body is not in JSON format
|
915 |
*/
|
916 |
public function json()
|
920 |
throw new RuntimeException('Unable to parse response body into JSON: ' . json_last_error());
|
921 |
}
|
922 |
|
923 |
+
return $data === null ? array() : $data;
|
924 |
}
|
925 |
|
926 |
/**
|
sdk/Aws/Guzzle/Http/QueryString.php
CHANGED
@@ -70,12 +70,17 @@ class QueryString extends Collection
|
|
70 |
$parts = explode('=', $kvp, 2);
|
71 |
$key = rawurldecode($parts[0]);
|
72 |
|
73 |
-
|
|
|
74 |
$key = substr($key, 0, -2);
|
75 |
}
|
76 |
|
77 |
if (array_key_exists(1, $parts)) {
|
78 |
-
$
|
|
|
|
|
|
|
|
|
79 |
} else {
|
80 |
$q->add($key, '');
|
81 |
}
|
70 |
$parts = explode('=', $kvp, 2);
|
71 |
$key = rawurldecode($parts[0]);
|
72 |
|
73 |
+
$paramIsPhpStyleArray = substr($key, -2) == '[]';
|
74 |
+
if ($paramIsPhpStyleArray) {
|
75 |
$key = substr($key, 0, -2);
|
76 |
}
|
77 |
|
78 |
if (array_key_exists(1, $parts)) {
|
79 |
+
$value = rawurldecode(str_replace('+', '%20', $parts[1]));
|
80 |
+
if ($paramIsPhpStyleArray && !$q->hasKey($key)) {
|
81 |
+
$value = array($value);
|
82 |
+
}
|
83 |
+
$q->add($key, $value);
|
84 |
} else {
|
85 |
$q->add($key, '');
|
86 |
}
|
sdk/Aws/Guzzle/Http/ReadLimitEntityBody.php
CHANGED
@@ -35,7 +35,7 @@ class ReadLimitEntityBody extends AbstractEntityBodyDecorator
|
|
35 |
*/
|
36 |
public function __toString()
|
37 |
{
|
38 |
-
return substr((string) $this->body, $this->offset, $this->limit);
|
39 |
}
|
40 |
|
41 |
/**
|
35 |
*/
|
36 |
public function __toString()
|
37 |
{
|
38 |
+
return substr((string) $this->body, $this->offset, $this->limit) ?: '';
|
39 |
}
|
40 |
|
41 |
/**
|
sdk/Aws/Guzzle/Http/RedirectPlugin.php
CHANGED
@@ -3,9 +3,11 @@
|
|
3 |
namespace Guzzle\Http;
|
4 |
|
5 |
use Guzzle\Common\Event;
|
|
|
6 |
use Guzzle\Http\Url;
|
7 |
use Guzzle\Http\Message\Response;
|
8 |
use Guzzle\Http\Message\RequestInterface;
|
|
|
9 |
use Guzzle\Http\Message\EntityEnclosingRequestInterface;
|
10 |
use Guzzle\Http\Exception\TooManyRedirectsException;
|
11 |
use Guzzle\Http\Exception\CouldNotRewindStreamException;
|
@@ -76,8 +78,17 @@ class RedirectPlugin implements EventSubscriberInterface
|
|
76 |
$originalRequest
|
77 |
);
|
78 |
|
79 |
-
|
80 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
$request->setResponse($redirectResponse);
|
82 |
if (!$redirectResponse->getPreviousResponse()) {
|
83 |
$redirectResponse->setPreviousResponse($response);
|
@@ -114,6 +125,7 @@ class RedirectPlugin implements EventSubscriberInterface
|
|
114 |
$redirectRequest = clone $request;
|
115 |
}
|
116 |
|
|
|
117 |
// Always use the same response body when redirecting
|
118 |
$redirectRequest->setResponseBody($request->getResponseBody());
|
119 |
|
@@ -155,17 +167,7 @@ class RedirectPlugin implements EventSubscriberInterface
|
|
155 |
*/
|
156 |
protected function cloneRequestWithGetMethod(EntityEnclosingRequestInterface $request)
|
157 |
{
|
158 |
-
|
159 |
-
$redirectRequest = $request->getClient()->get($request->getUrl());
|
160 |
-
$redirectRequest->getCurlOptions()->replace($request->getCurlOptions()->getAll());
|
161 |
-
// Copy over the headers, while ensuring that the Content-Length is not copied
|
162 |
-
$redirectRequest->setHeaders($request->getHeaders()->getAll())->removeHeader('Content-Length');
|
163 |
-
$redirectRequest->setEventDispatcher(clone $request->getEventDispatcher());
|
164 |
-
$redirectRequest->getParams()
|
165 |
-
->replace($request->getParams()->getAll())
|
166 |
-
->remove('curl_handle')->remove('queued_response')->remove('curl_multi');
|
167 |
-
|
168 |
-
return $redirectRequest;
|
169 |
}
|
170 |
|
171 |
/**
|
@@ -214,17 +216,17 @@ class RedirectPlugin implements EventSubscriberInterface
|
|
214 |
*/
|
215 |
protected function throwTooManyRedirectsException(RequestInterface $request)
|
216 |
{
|
217 |
-
$
|
|
|
218 |
|
219 |
-
// Create a nice message to use when throwing the exception that shows each request/response transaction
|
220 |
do {
|
221 |
-
$
|
222 |
-
$
|
223 |
-
|
224 |
-
} while ($request);
|
225 |
-
|
226 |
-
$transaction = implode("* Sending redirect request\n", array_reverse($responses));
|
227 |
|
228 |
-
throw new TooManyRedirectsException(
|
|
|
|
|
|
|
229 |
}
|
230 |
}
|
3 |
namespace Guzzle\Http;
|
4 |
|
5 |
use Guzzle\Common\Event;
|
6 |
+
use Guzzle\Http\Exception\BadResponseException;
|
7 |
use Guzzle\Http\Url;
|
8 |
use Guzzle\Http\Message\Response;
|
9 |
use Guzzle\Http\Message\RequestInterface;
|
10 |
+
use Guzzle\Http\Message\RequestFactory;
|
11 |
use Guzzle\Http\Message\EntityEnclosingRequestInterface;
|
12 |
use Guzzle\Http\Exception\TooManyRedirectsException;
|
13 |
use Guzzle\Http\Exception\CouldNotRewindStreamException;
|
78 |
$originalRequest
|
79 |
);
|
80 |
|
81 |
+
try {
|
82 |
+
// Send the redirect request and hijack the response of the original request
|
83 |
+
$redirectResponse = $redirectRequest->send();
|
84 |
+
} catch (BadResponseException $e) {
|
85 |
+
// Still hijack if an exception occurs after redirecting
|
86 |
+
$redirectResponse = $e->getResponse();
|
87 |
+
if (!$e->getResponse()) {
|
88 |
+
throw $e;
|
89 |
+
}
|
90 |
+
}
|
91 |
+
|
92 |
$request->setResponse($redirectResponse);
|
93 |
if (!$redirectResponse->getPreviousResponse()) {
|
94 |
$redirectResponse->setPreviousResponse($response);
|
125 |
$redirectRequest = clone $request;
|
126 |
}
|
127 |
|
128 |
+
$redirectRequest->setIsRedirect(true);
|
129 |
// Always use the same response body when redirecting
|
130 |
$redirectRequest->setResponseBody($request->getResponseBody());
|
131 |
|
167 |
*/
|
168 |
protected function cloneRequestWithGetMethod(EntityEnclosingRequestInterface $request)
|
169 |
{
|
170 |
+
return RequestFactory::getInstance()->cloneRequestWithMethod($request, 'GET');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
171 |
}
|
172 |
|
173 |
/**
|
216 |
*/
|
217 |
protected function throwTooManyRedirectsException(RequestInterface $request)
|
218 |
{
|
219 |
+
$lines = array();
|
220 |
+
$response = $request->getResponse();
|
221 |
|
|
|
222 |
do {
|
223 |
+
$lines[] = '> ' . $response->getRequest()->getRawHeaders() . "\n\n< " . $response->getRawHeaders();
|
224 |
+
$response = $response->getPreviousResponse();
|
225 |
+
} while ($response);
|
|
|
|
|
|
|
226 |
|
227 |
+
throw new TooManyRedirectsException(
|
228 |
+
"Too many redirects were issued for this transaction:\n"
|
229 |
+
. implode("* Sending redirect request\n", array_reverse($lines))
|
230 |
+
);
|
231 |
}
|
232 |
}
|
sdk/Aws/Guzzle/Http/Resources/cacert.pem
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
##
|
2 |
## ca-bundle.crt -- Bundle of CA Root Certificates
|
3 |
##
|
4 |
-
## Certificate data from Mozilla as of:
|
5 |
##
|
6 |
## This is a bundle of X.509 certificates of public Certificate Authorities
|
7 |
## (CA). These were automatically extracted from Mozilla's root certificates
|
@@ -14,7 +14,7 @@
|
|
14 |
## Just configure this file as the SSLCACertificateFile.
|
15 |
##
|
16 |
|
17 |
-
# @(#) $RCSfile: certdata.txt,v $ $Revision: 1.
|
18 |
|
19 |
GTE CyberTrust Global Root
|
20 |
==========================
|
@@ -3847,3 +3847,49 @@ UZTLfhbrES+jkkXITHHZvMmZUldGL1DPvTVp9D0VzgalLA8+9oG6lLvDu79leNKGef9JOxqDDPDe
|
|
3847 |
eOzI8k1MGt6CKfjBWtrt7uYnXuhF0J0cUahoq0Tj0Itq4/g7u9xN12TyUb7mqqta6THuBrxzvxNi
|
3848 |
Cp/HuZc=
|
3849 |
-----END CERTIFICATE-----
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
##
|
2 |
## ca-bundle.crt -- Bundle of CA Root Certificates
|
3 |
##
|
4 |
+
## Certificate data from Mozilla as of: Sat Dec 29 20:03:40 2012
|
5 |
##
|
6 |
## This is a bundle of X.509 certificates of public Certificate Authorities
|
7 |
## (CA). These were automatically extracted from Mozilla's root certificates
|
14 |
## Just configure this file as the SSLCACertificateFile.
|
15 |
##
|
16 |
|
17 |
+
# @(#) $RCSfile: certdata.txt,v $ $Revision: 1.87 $ $Date: 2012/12/29 16:32:45 $
|
18 |
|
19 |
GTE CyberTrust Global Root
|
20 |
==========================
|
3847 |
eOzI8k1MGt6CKfjBWtrt7uYnXuhF0J0cUahoq0Tj0Itq4/g7u9xN12TyUb7mqqta6THuBrxzvxNi
|
3848 |
Cp/HuZc=
|
3849 |
-----END CERTIFICATE-----
|
3850 |
+
|
3851 |
+
T-TeleSec GlobalRoot Class 3
|
3852 |
+
============================
|
3853 |
+
-----BEGIN CERTIFICATE-----
|
3854 |
+
MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoM
|
3855 |
+
IlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBU
|
3856 |
+
cnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwHhcNMDgx
|
3857 |
+
MDAxMTAyOTU2WhcNMzMxMDAxMjM1OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lz
|
3858 |
+
dGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBD
|
3859 |
+
ZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwggEiMA0GCSqGSIb3
|
3860 |
+
DQEBAQUAA4IBDwAwggEKAoIBAQC9dZPwYiJvJK7genasfb3ZJNW4t/zN8ELg63iIVl6bmlQdTQyK
|
3861 |
+
9tPPcPRStdiTBONGhnFBSivwKixVA9ZIw+A5OO3yXDw/RLyTPWGrTs0NvvAgJ1gORH8EGoel15YU
|
3862 |
+
NpDQSXuhdfsaa3Ox+M6pCSzyU9XDFES4hqX2iys52qMzVNn6chr3IhUciJFrf2blw2qAsCTz34ZF
|
3863 |
+
iP0Zf3WHHx+xGwpzJFu5ZeAsVMhg02YXP+HMVDNzkQI6pn97djmiH5a2OK61yJN0HZ65tOVgnS9W
|
3864 |
+
0eDrXltMEnAMbEQgqxHY9Bn20pxSN+f6tsIxO0rUFJmtxxr1XV/6B7h8DR/Wgx6zAgMBAAGjQjBA
|
3865 |
+
MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS1A/d2O2GCahKqGFPr
|
3866 |
+
AyGUv/7OyjANBgkqhkiG9w0BAQsFAAOCAQEAVj3vlNW92nOyWL6ukK2YJ5f+AbGwUgC4TeQbIXQb
|
3867 |
+
fsDuXmkqJa9c1h3a0nnJ85cp4IaH3gRZD/FZ1GSFS5mvJQQeyUapl96Cshtwn5z2r3Ex3XsFpSzT
|
3868 |
+
ucpH9sry9uetuUg/vBa3wW306gmv7PO15wWeph6KU1HWk4HMdJP2udqmJQV0eVp+QD6CSyYRMG7h
|
3869 |
+
P0HHRwA11fXT91Q+gT3aSWqas+8QPebrb9HIIkfLzM8BMZLZGOMivgkeGj5asuRrDFR6fUNOuIml
|
3870 |
+
e9eiPZaGzPImNC1qkp2aGtAw4l1OBLBfiyB+d8E9lYLRRpo7PHi4b6HQDWSieB4pTpPDpFQUWw==
|
3871 |
+
-----END CERTIFICATE-----
|
3872 |
+
|
3873 |
+
EE Certification Centre Root CA
|
3874 |
+
===============================
|
3875 |
+
-----BEGIN CERTIFICATE-----
|
3876 |
+
MIIEAzCCAuugAwIBAgIQVID5oHPtPwBMyonY43HmSjANBgkqhkiG9w0BAQUFADB1MQswCQYDVQQG
|
3877 |
+
EwJFRTEiMCAGA1UECgwZQVMgU2VydGlmaXRzZWVyaW1pc2tlc2t1czEoMCYGA1UEAwwfRUUgQ2Vy
|
3878 |
+
dGlmaWNhdGlvbiBDZW50cmUgUm9vdCBDQTEYMBYGCSqGSIb3DQEJARYJcGtpQHNrLmVlMCIYDzIw
|
3879 |
+
MTAxMDMwMTAxMDMwWhgPMjAzMDEyMTcyMzU5NTlaMHUxCzAJBgNVBAYTAkVFMSIwIAYDVQQKDBlB
|
3880 |
+
UyBTZXJ0aWZpdHNlZXJpbWlza2Vza3VzMSgwJgYDVQQDDB9FRSBDZXJ0aWZpY2F0aW9uIENlbnRy
|
3881 |
+
ZSBSb290IENBMRgwFgYJKoZIhvcNAQkBFglwa2lAc2suZWUwggEiMA0GCSqGSIb3DQEBAQUAA4IB
|
3882 |
+
DwAwggEKAoIBAQDIIMDs4MVLqwd4lfNE7vsLDP90jmG7sWLqI9iroWUyeuuOF0+W2Ap7kaJjbMeM
|
3883 |
+
TC55v6kF/GlclY1i+blw7cNRfdCT5mzrMEvhvH2/UpvObntl8jixwKIy72KyaOBhU8E2lf/slLo2
|
3884 |
+
rpwcpzIP5Xy0xm90/XsY6KxX7QYgSzIwWFv9zajmofxwvI6Sc9uXp3whrj3B9UiHbCe9nyV0gVWw
|
3885 |
+
93X2PaRka9ZP585ArQ/dMtO8ihJTmMmJ+xAdTX7Nfh9WDSFwhfYggx/2uh8Ej+p3iDXE/+pOoYtN
|
3886 |
+
P2MbRMNE1CV2yreN1x5KZmTNXMWcg+HCCIia7E6j8T4cLNlsHaFLAgMBAAGjgYowgYcwDwYDVR0T
|
3887 |
+
AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFBLyWj7qVhy/zQas8fElyalL1BSZ
|
3888 |
+
MEUGA1UdJQQ+MDwGCCsGAQUFBwMCBggrBgEFBQcDAQYIKwYBBQUHAwMGCCsGAQUFBwMEBggrBgEF
|
3889 |
+
BQcDCAYIKwYBBQUHAwkwDQYJKoZIhvcNAQEFBQADggEBAHv25MANqhlHt01Xo/6tu7Fq1Q+e2+Rj
|
3890 |
+
xY6hUFaTlrg4wCQiZrxTFGGVv9DHKpY5P30osxBAIWrEr7BSdxjhlthWXePdNl4dp1BUoMUq5KqM
|
3891 |
+
lIpPnTX/dqQGE5Gion0ARD9V04I8GtVbvFZMIi5GQ4okQC3zErg7cBqklrkar4dBGmoYDQZPxz5u
|
3892 |
+
uSlNDUmJEYcyW+ZLBMjkXOZ0c5RdFpgTlf7727FE5TpwrDdr5rMzcijJs1eg9gIWiAYLtqZLICjU
|
3893 |
+
3j2LrTcFU3T+bsy8QxdxXvnFzBqpYe73dgzzcvRyrc9yAjYHR8/vGVCJYMzpJJUPwssd8m92kMfM
|
3894 |
+
dcGWxZ0=
|
3895 |
+
-----END CERTIFICATE-----
|
sdk/Aws/Guzzle/Http/Resources/cacert.pem.md5
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
47961e7ef15667c93cd99be01b51f00a
|
sdk/Aws/Guzzle/Http/Url.php
CHANGED
@@ -122,7 +122,11 @@ class Url
|
|
122 |
$this->username = $username;
|
123 |
$this->password = $password;
|
124 |
$this->fragment = $fragment;
|
125 |
-
|
|
|
|
|
|
|
|
|
126 |
$this->setPath($path);
|
127 |
}
|
128 |
|
@@ -274,14 +278,15 @@ class Url
|
|
274 |
*/
|
275 |
public function normalizePath()
|
276 |
{
|
277 |
-
if ($this->path == '*') {
|
278 |
return $this;
|
279 |
}
|
280 |
|
281 |
-
|
|
|
282 |
|
283 |
-
|
284 |
-
|
285 |
|
286 |
// Remove trailing relative paths if possible
|
287 |
$segments = $this->getPathSegments();
|
@@ -467,60 +472,66 @@ class Url
|
|
467 |
}
|
468 |
|
469 |
/**
|
470 |
-
* Combine the URL with another URL.
|
471 |
*
|
472 |
* @param string $url Relative URL to combine with
|
473 |
*
|
474 |
* @return Url
|
475 |
* @throws InvalidArgumentException
|
|
|
476 |
*/
|
477 |
public function combine($url)
|
478 |
{
|
479 |
-
$absolutePath = $url[0] == '/';
|
480 |
$url = self::factory($url);
|
481 |
|
|
|
|
|
|
|
|
|
|
|
|
|
482 |
if ($buffer = $url->getScheme()) {
|
483 |
$this->scheme = $buffer;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
484 |
}
|
485 |
|
|
|
486 |
if ($buffer = $url->getHost()) {
|
487 |
$this->host = $buffer;
|
|
|
|
|
|
|
|
|
|
|
|
|
488 |
}
|
489 |
|
490 |
-
|
491 |
-
|
492 |
-
}
|
493 |
-
|
494 |
-
if ($buffer = $url->getUsername()) {
|
495 |
-
$this->username = $buffer;
|
496 |
-
}
|
497 |
-
|
498 |
-
if ($buffer = $url->getPassword()) {
|
499 |
-
$this->password = $buffer;
|
500 |
-
}
|
501 |
-
|
502 |
-
if ($buffer = $url->getFragment()) {
|
503 |
-
$this->fragment = $buffer;
|
504 |
-
}
|
505 |
|
506 |
-
if (
|
507 |
-
|
508 |
-
|
509 |
-
$this->path = $buffer;
|
510 |
-
}
|
511 |
-
if (count($url->getQuery())) {
|
512 |
-
$this->query = clone $url->getQuery();
|
513 |
}
|
514 |
} else {
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
if ($buffer = $url->getQuery()) {
|
520 |
-
$this->query->merge($buffer);
|
521 |
}
|
|
|
|
|
522 |
}
|
523 |
|
|
|
|
|
524 |
return $this;
|
525 |
}
|
526 |
}
|
122 |
$this->username = $username;
|
123 |
$this->password = $password;
|
124 |
$this->fragment = $fragment;
|
125 |
+
if (!$query) {
|
126 |
+
$this->query = new QueryString();
|
127 |
+
} else {
|
128 |
+
$this->setQuery($query);
|
129 |
+
}
|
130 |
$this->setPath($path);
|
131 |
}
|
132 |
|
278 |
*/
|
279 |
public function normalizePath()
|
280 |
{
|
281 |
+
if (!$this->path || $this->path == '/' || $this->path == '*') {
|
282 |
return $this;
|
283 |
}
|
284 |
|
285 |
+
// Replace // and /./ with /
|
286 |
+
$this->path = str_replace(array('/./', '//'), '/', $this->path);
|
287 |
|
288 |
+
// Remove dot segments
|
289 |
+
if (strpos($this->path, '..') !== false) {
|
290 |
|
291 |
// Remove trailing relative paths if possible
|
292 |
$segments = $this->getPathSegments();
|
472 |
}
|
473 |
|
474 |
/**
|
475 |
+
* Combine the URL with another URL. Follows the rules specific in RFC 3986 section 5.4.
|
476 |
*
|
477 |
* @param string $url Relative URL to combine with
|
478 |
*
|
479 |
* @return Url
|
480 |
* @throws InvalidArgumentException
|
481 |
+
* @link http://tools.ietf.org/html/rfc3986#section-5.4
|
482 |
*/
|
483 |
public function combine($url)
|
484 |
{
|
|
|
485 |
$url = self::factory($url);
|
486 |
|
487 |
+
// Use the more absolute URL as the base URL
|
488 |
+
if (!$this->isAbsolute() && $url->isAbsolute()) {
|
489 |
+
$url = $url->combine($this);
|
490 |
+
}
|
491 |
+
|
492 |
+
// Passing a URL with a scheme overrides everything
|
493 |
if ($buffer = $url->getScheme()) {
|
494 |
$this->scheme = $buffer;
|
495 |
+
$this->host = $url->getHost();
|
496 |
+
$this->port = $url->getPort();
|
497 |
+
$this->username = $url->getUsername();
|
498 |
+
$this->password = $url->getPassword();
|
499 |
+
$this->path = $url->getPath();
|
500 |
+
$this->query = $url->getQuery();
|
501 |
+
$this->fragment = $url->getFragment();
|
502 |
+
return $this;
|
503 |
}
|
504 |
|
505 |
+
// Setting a host overrides the entire rest of the URL
|
506 |
if ($buffer = $url->getHost()) {
|
507 |
$this->host = $buffer;
|
508 |
+
$this->port = $url->getPort();
|
509 |
+
$this->username = $url->getUsername();
|
510 |
+
$this->password = $url->getPassword();
|
511 |
+
$this->path = $url->getPath();
|
512 |
+
$this->fragment = $url->getFragment();
|
513 |
+
return $this;
|
514 |
}
|
515 |
|
516 |
+
$path = $url->getPath();
|
517 |
+
$query = $url->getQuery();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
518 |
|
519 |
+
if (!$path) {
|
520 |
+
if (count($query)) {
|
521 |
+
$this->query = $query;
|
|
|
|
|
|
|
|
|
522 |
}
|
523 |
} else {
|
524 |
+
if ($path[0] == '/') {
|
525 |
+
$this->path = $path;
|
526 |
+
} else {
|
527 |
+
$this->path .= '/' . $path;
|
|
|
|
|
528 |
}
|
529 |
+
$this->normalizePath();
|
530 |
+
$this->query = $query;
|
531 |
}
|
532 |
|
533 |
+
$this->fragment = $url->getFragment();
|
534 |
+
|
535 |
return $this;
|
536 |
}
|
537 |
}
|
sdk/Aws/Guzzle/Http/Utils.php
DELETED
@@ -1,52 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace Guzzle\Http;
|
4 |
-
|
5 |
-
use Guzzle\Common\Version;
|
6 |
-
use Guzzle\Http\Curl\CurlVersion;
|
7 |
-
|
8 |
-
/**
|
9 |
-
* HTTP utility class
|
10 |
-
*/
|
11 |
-
class Utils
|
12 |
-
{
|
13 |
-
/**
|
14 |
-
* @var string
|
15 |
-
*/
|
16 |
-
protected static $userAgent;
|
17 |
-
|
18 |
-
/**
|
19 |
-
* Create an RFC 1123 HTTP-Date from various date values
|
20 |
-
*
|
21 |
-
* @param string|int $date Date to convert
|
22 |
-
*
|
23 |
-
* @return string
|
24 |
-
*/
|
25 |
-
public static function getHttpDate($date)
|
26 |
-
{
|
27 |
-
if (!is_numeric($date)) {
|
28 |
-
$date = strtotime($date);
|
29 |
-
}
|
30 |
-
|
31 |
-
return gmdate('D, d M Y H:i:s \G\M\T', $date);
|
32 |
-
}
|
33 |
-
|
34 |
-
/**
|
35 |
-
* Get the default User-Agent to add to requests sent through the library
|
36 |
-
*
|
37 |
-
* @return string
|
38 |
-
*/
|
39 |
-
public static function getDefaultUserAgent()
|
40 |
-
{
|
41 |
-
if (!self::$userAgent) {
|
42 |
-
self::$userAgent = sprintf(
|
43 |
-
'Guzzle/%s curl/%s PHP/%s',
|
44 |
-
Version::VERSION,
|
45 |
-
CurlVersion::getInstance()->get('version'),
|
46 |
-
PHP_VERSION
|
47 |
-
);
|
48 |
-
}
|
49 |
-
|
50 |
-
return self::$userAgent;
|
51 |
-
}
|
52 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sdk/Aws/Guzzle/Http/composer.json
CHANGED
@@ -26,7 +26,7 @@
|
|
26 |
"target-dir": "Guzzle/Http",
|
27 |
"extra": {
|
28 |
"branch-alias": {
|
29 |
-
"dev-master": "3.
|
30 |
}
|
31 |
}
|
32 |
}
|
26 |
"target-dir": "Guzzle/Http",
|
27 |
"extra": {
|
28 |
"branch-alias": {
|
29 |
+
"dev-master": "3.4-dev"
|
30 |
}
|
31 |
}
|
32 |
}
|
sdk/Aws/Guzzle/Inflection/composer.json
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
"target-dir": "Guzzle/Inflection",
|
21 |
"extra": {
|
22 |
"branch-alias": {
|
23 |
-
"dev-master": "3.
|
24 |
}
|
25 |
}
|
26 |
}
|
20 |
"target-dir": "Guzzle/Inflection",
|
21 |
"extra": {
|
22 |
"branch-alias": {
|
23 |
+
"dev-master": "3.4-dev"
|
24 |
}
|
25 |
}
|
26 |
}
|
sdk/Aws/Guzzle/Iterator/composer.json
CHANGED
@@ -21,7 +21,7 @@
|
|
21 |
"target-dir": "Guzzle/Log",
|
22 |
"extra": {
|
23 |
"branch-alias": {
|
24 |
-
"dev-master": "3.
|
25 |
}
|
26 |
}
|
27 |
}
|
21 |
"target-dir": "Guzzle/Log",
|
22 |
"extra": {
|
23 |
"branch-alias": {
|
24 |
+
"dev-master": "3.4-dev"
|
25 |
}
|
26 |
}
|
27 |
}
|
sdk/Aws/Guzzle/Log/PsrLogAdapter.php
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Guzzle\Log;
|
4 |
+
|
5 |
+
use Psr\Log\LogLevel;
|
6 |
+
use Psr\Log\LoggerInterface;
|
7 |
+
|
8 |
+
/**
|
9 |
+
* PSR-3 log adapter
|
10 |
+
*
|
11 |
+
* @link https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md
|
12 |
+
*/
|
13 |
+
class PsrLogAdapter extends AbstractLogAdapter
|
14 |
+
{
|
15 |
+
/**
|
16 |
+
* syslog to PSR-3 mappings
|
17 |
+
*/
|
18 |
+
private static $mapping = array(
|
19 |
+
LOG_DEBUG => LogLevel::DEBUG,
|
20 |
+
LOG_INFO => LogLevel::INFO,
|
21 |
+
LOG_WARNING => LogLevel::WARNING,
|
22 |
+
LOG_ERR => LogLevel::ERROR,
|
23 |
+
LOG_CRIT => LogLevel::CRITICAL,
|
24 |
+
LOG_ALERT => LogLevel::ALERT
|
25 |
+
);
|
26 |
+
|
27 |
+
/**
|
28 |
+
* {@inheritdoc}
|
29 |
+
*/
|
30 |
+
public function __construct(LoggerInterface $logObject)
|
31 |
+
{
|
32 |
+
$this->log = $logObject;
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* {@inheritdoc}
|
37 |
+
*/
|
38 |
+
public function log($message, $priority = LOG_INFO, $extras = null)
|
39 |
+
{
|
40 |
+
|
41 |
+
$this->log->log(self::$mapping[$priority], $message, $extras);
|
42 |
+
}
|
43 |
+
}
|
sdk/Aws/Guzzle/Log/composer.json
CHANGED
@@ -23,7 +23,7 @@
|
|
23 |
"target-dir": "Guzzle/Log",
|
24 |
"extra": {
|
25 |
"branch-alias": {
|
26 |
-
"dev-master": "3.
|
27 |
}
|
28 |
}
|
29 |
}
|
23 |
"target-dir": "Guzzle/Log",
|
24 |
"extra": {
|
25 |
"branch-alias": {
|
26 |
+
"dev-master": "3.4-dev"
|
27 |
}
|
28 |
}
|
29 |
}
|
sdk/Aws/Guzzle/Parser/composer.json
CHANGED
@@ -13,7 +13,7 @@
|
|
13 |
"target-dir": "Guzzle/Parser",
|
14 |
"extra": {
|
15 |
"branch-alias": {
|
16 |
-
"dev-master": "3.
|
17 |
}
|
18 |
}
|
19 |
}
|
13 |
"target-dir": "Guzzle/Parser",
|
14 |
"extra": {
|
15 |
"branch-alias": {
|
16 |
+
"dev-master": "3.4-dev"
|
17 |
}
|
18 |
}
|
19 |
}
|
sdk/Aws/Guzzle/Plugin/Async/AsyncPlugin.php
CHANGED
@@ -45,14 +45,9 @@ class AsyncPlugin implements EventSubscriberInterface
|
|
45 |
*/
|
46 |
public function onCurlProgress(Event $event)
|
47 |
{
|
48 |
-
if (
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
if ($event['downloaded'] || ($event['uploaded'] || $event['upload_size'] === $event['uploaded'])) {
|
53 |
-
$event['handle']->getOptions()
|
54 |
-
->set(CURLOPT_TIMEOUT_MS, 1)
|
55 |
-
->set(CURLOPT_NOBODY, true);
|
56 |
// Timeout after 1ms
|
57 |
curl_setopt($event['handle']->getHandle(), CURLOPT_TIMEOUT_MS, 1);
|
58 |
// Even if the response is quick, tell curl not to download the body
|
45 |
*/
|
46 |
public function onCurlProgress(Event $event)
|
47 |
{
|
48 |
+
if ($event['handle'] &&
|
49 |
+
($event['downloaded'] || ($event['uploaded'] && $event['upload_size'] === $event['uploaded']))
|
50 |
+
) {
|
|
|
|
|
|
|
|
|
|
|
51 |
// Timeout after 1ms
|
52 |
curl_setopt($event['handle']->getHandle(), CURLOPT_TIMEOUT_MS, 1);
|
53 |
// Even if the response is quick, tell curl not to download the body
|
sdk/Aws/Guzzle/Plugin/Async/composer.json
CHANGED
@@ -21,7 +21,7 @@
|
|
21 |
"target-dir": "Guzzle/Plugin/Async",
|
22 |
"extra": {
|
23 |
"branch-alias": {
|
24 |
-
"dev-master": "3.
|
25 |
}
|
26 |
}
|
27 |
}
|
21 |
"target-dir": "Guzzle/Plugin/Async",
|
22 |
"extra": {
|
23 |
"branch-alias": {
|
24 |
+
"dev-master": "3.4-dev"
|
25 |
}
|
26 |
}
|
27 |
}
|
sdk/Aws/Guzzle/Plugin/Backoff/BackoffPlugin.php
CHANGED
@@ -128,7 +128,7 @@ class BackoffPlugin extends AbstractHasDispatcher implements EventSubscriberInte
|
|
128 |
}
|
129 |
$multi = $event['curl_multi'];
|
130 |
$multi->remove($request);
|
131 |
-
$multi->add($request
|
132 |
}
|
133 |
}
|
134 |
}
|
128 |
}
|
129 |
$multi = $event['curl_multi'];
|
130 |
$multi->remove($request);
|
131 |
+
$multi->add($request);
|
132 |
}
|
133 |
}
|
134 |
}
|
sdk/Aws/Guzzle/Plugin/Backoff/composer.json
CHANGED
@@ -22,7 +22,7 @@
|
|
22 |
"target-dir": "Guzzle/Plugin/Backoff",
|
23 |
"extra": {
|
24 |
"branch-alias": {
|
25 |
-
"dev-master": "3.
|
26 |
}
|
27 |
}
|
28 |
}
|
22 |
"target-dir": "Guzzle/Plugin/Backoff",
|
23 |
"extra": {
|
24 |
"branch-alias": {
|
25 |
+
"dev-master": "3.4-dev"
|
26 |
}
|
27 |
}
|
28 |
}
|
sdk/Aws/Guzzle/Plugin/Cache/CachePlugin.php
CHANGED
@@ -5,9 +5,12 @@ namespace Guzzle\Plugin\Cache;
|
|
5 |
use Guzzle\Cache\CacheAdapterInterface;
|
6 |
use Guzzle\Common\Event;
|
7 |
use Guzzle\Common\Exception\InvalidArgumentException;
|
|
|
|
|
8 |
use Guzzle\Http\Message\RequestInterface;
|
9 |
use Guzzle\Http\Message\Response;
|
10 |
use Guzzle\Cache\DoctrineCacheAdapter;
|
|
|
11 |
use Doctrine\Common\Cache\ArrayCache;
|
12 |
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
13 |
|
@@ -17,14 +20,12 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
|
17 |
*
|
18 |
* This is a simple implementation of RFC 2616 and should be considered a private transparent proxy cache, meaning
|
19 |
* authorization and private data can be cached.
|
|
|
|
|
|
|
20 |
*/
|
21 |
class CachePlugin implements EventSubscriberInterface
|
22 |
{
|
23 |
-
/**
|
24 |
-
* @var array SplObjectStorage of request cache keys to hold until a response is returned
|
25 |
-
*/
|
26 |
-
private $cached;
|
27 |
-
|
28 |
/**
|
29 |
* @var CacheKeyProviderInterface Cache key provider
|
30 |
*/
|
@@ -45,6 +46,11 @@ class CachePlugin implements EventSubscriberInterface
|
|
45 |
*/
|
46 |
protected $storage;
|
47 |
|
|
|
|
|
|
|
|
|
|
|
48 |
/**
|
49 |
* Construct a new CachePlugin. Cache options include the following:
|
50 |
*
|
@@ -55,6 +61,7 @@ class CachePlugin implements EventSubscriberInterface
|
|
55 |
* - CanCacheInterface can_cache: (optional) Object used to determine if a request can be cached
|
56 |
* - int default_ttl: (optional) Default TTL to use when caching if no cache_storage was set
|
57 |
* must set to 0 or it will assume the default of 3600 secs.
|
|
|
58 |
*
|
59 |
* @param array|CacheAdapterInterface|CacheStorageInterface $options Array of options for the cache plugin,
|
60 |
* cache adapter, or cache storage object.
|
@@ -115,7 +122,11 @@ class CachePlugin implements EventSubscriberInterface
|
|
115 |
$this->revalidation = new DefaultRevalidation($this->keyProvider, $this->storage, $this);
|
116 |
}
|
117 |
|
118 |
-
|
|
|
|
|
|
|
|
|
119 |
}
|
120 |
|
121 |
/**
|
@@ -125,7 +136,9 @@ class CachePlugin implements EventSubscriberInterface
|
|
125 |
{
|
126 |
return array(
|
127 |
'request.before_send' => array('onRequestBeforeSend', -255),
|
128 |
-
'request.sent' => array('onRequestSent', 255)
|
|
|
|
|
129 |
);
|
130 |
}
|
131 |
|
@@ -137,25 +150,33 @@ class CachePlugin implements EventSubscriberInterface
|
|
137 |
public function onRequestBeforeSend(Event $event)
|
138 |
{
|
139 |
$request = $event['request'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
140 |
if (!$this->canCache->canCacheRequest($request)) {
|
141 |
return;
|
142 |
}
|
143 |
|
144 |
$hashKey = $this->keyProvider->getCacheKey($request);
|
145 |
-
$this->cached[$request] = $hashKey;
|
146 |
|
147 |
// If the cached data was found, then make the request into a
|
148 |
// manually set request
|
149 |
if ($cachedData = $this->storage->fetch($hashKey)) {
|
150 |
-
|
151 |
$response = new Response($cachedData[0], $cachedData[1], $cachedData[2]);
|
152 |
-
$response->setHeader(
|
153 |
-
|
154 |
-
$response->
|
155 |
-
|
156 |
-
|
157 |
// Validate that the response satisfies the request
|
158 |
if ($this->canResponseSatisfyRequest($request, $response)) {
|
|
|
159 |
$request->setResponse($response);
|
160 |
}
|
161 |
}
|
@@ -171,16 +192,79 @@ class CachePlugin implements EventSubscriberInterface
|
|
171 |
$request = $event['request'];
|
172 |
$response = $event['response'];
|
173 |
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
183 |
}
|
|
|
|
|
|
|
184 |
}
|
185 |
}
|
186 |
|
@@ -245,4 +329,94 @@ class CachePlugin implements EventSubscriberInterface
|
|
245 |
|
246 |
return true;
|
247 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
248 |
}
|
5 |
use Guzzle\Cache\CacheAdapterInterface;
|
6 |
use Guzzle\Common\Event;
|
7 |
use Guzzle\Common\Exception\InvalidArgumentException;
|
8 |
+
use Guzzle\Common\Version;
|
9 |
+
use Guzzle\Http\Message\RequestFactory;
|
10 |
use Guzzle\Http\Message\RequestInterface;
|
11 |
use Guzzle\Http\Message\Response;
|
12 |
use Guzzle\Cache\DoctrineCacheAdapter;
|
13 |
+
use Guzzle\Http\Exception\CurlException;
|
14 |
use Doctrine\Common\Cache\ArrayCache;
|
15 |
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
16 |
|
20 |
*
|
21 |
* This is a simple implementation of RFC 2616 and should be considered a private transparent proxy cache, meaning
|
22 |
* authorization and private data can be cached.
|
23 |
+
*
|
24 |
+
* It also implements RFC 5861's `stale-if-error` Cache-Control extension, allowing stale cache responses to be used
|
25 |
+
* when an error is encountered (such as a `500 Internal Server Error` or DNS failure).
|
26 |
*/
|
27 |
class CachePlugin implements EventSubscriberInterface
|
28 |
{
|
|
|
|
|
|
|
|
|
|
|
29 |
/**
|
30 |
* @var CacheKeyProviderInterface Cache key provider
|
31 |
*/
|
46 |
*/
|
47 |
protected $storage;
|
48 |
|
49 |
+
/**
|
50 |
+
* @var bool Whether to add debug headers to the response
|
51 |
+
*/
|
52 |
+
protected $debugHeaders;
|
53 |
+
|
54 |
/**
|
55 |
* Construct a new CachePlugin. Cache options include the following:
|
56 |
*
|
61 |
* - CanCacheInterface can_cache: (optional) Object used to determine if a request can be cached
|
62 |
* - int default_ttl: (optional) Default TTL to use when caching if no cache_storage was set
|
63 |
* must set to 0 or it will assume the default of 3600 secs.
|
64 |
+
* - bool debug_headers: (optional) Add debug headers to the response (default true)
|
65 |
*
|
66 |
* @param array|CacheAdapterInterface|CacheStorageInterface $options Array of options for the cache plugin,
|
67 |
* cache adapter, or cache storage object.
|
122 |
$this->revalidation = new DefaultRevalidation($this->keyProvider, $this->storage, $this);
|
123 |
}
|
124 |
|
125 |
+
if (!isset($options['debug_headers'])) {
|
126 |
+
$this->debugHeaders = true;
|
127 |
+
} else {
|
128 |
+
$this->debugHeaders = (bool) $options['debug_headers'];
|
129 |
+
}
|
130 |
}
|
131 |
|
132 |
/**
|
136 |
{
|
137 |
return array(
|
138 |
'request.before_send' => array('onRequestBeforeSend', -255),
|
139 |
+
'request.sent' => array('onRequestSent', 255),
|
140 |
+
'request.error' => array('onRequestError', 0),
|
141 |
+
'request.exception' => array('onRequestException', 0),
|
142 |
);
|
143 |
}
|
144 |
|
150 |
public function onRequestBeforeSend(Event $event)
|
151 |
{
|
152 |
$request = $event['request'];
|
153 |
+
$request->addHeader('Via', sprintf('%s GuzzleCache/%s', $request->getProtocolVersion(), Version::VERSION));
|
154 |
+
|
155 |
+
// Intercept PURGE requests
|
156 |
+
if ($request->getMethod() == 'PURGE') {
|
157 |
+
$this->purge($request);
|
158 |
+
$request->setResponse(new Response(200, array(), 'purged'));
|
159 |
+
return;
|
160 |
+
}
|
161 |
+
|
162 |
if (!$this->canCache->canCacheRequest($request)) {
|
163 |
return;
|
164 |
}
|
165 |
|
166 |
$hashKey = $this->keyProvider->getCacheKey($request);
|
|
|
167 |
|
168 |
// If the cached data was found, then make the request into a
|
169 |
// manually set request
|
170 |
if ($cachedData = $this->storage->fetch($hashKey)) {
|
171 |
+
$request->getParams()->set('cache.lookup', true);
|
172 |
$response = new Response($cachedData[0], $cachedData[1], $cachedData[2]);
|
173 |
+
$response->setHeader(
|
174 |
+
'Age',
|
175 |
+
time() - strtotime($response->getDate() ? : $response->getLastModified() ?: 'now')
|
176 |
+
);
|
|
|
177 |
// Validate that the response satisfies the request
|
178 |
if ($this->canResponseSatisfyRequest($request, $response)) {
|
179 |
+
$request->getParams()->set('cache.hit', true);
|
180 |
$request->setResponse($response);
|
181 |
}
|
182 |
}
|
192 |
$request = $event['request'];
|
193 |
$response = $event['response'];
|
194 |
|
195 |
+
$cacheKey = $this->keyProvider->getCacheKey($request);
|
196 |
+
|
197 |
+
if ($request->getParams()->get('cache.hit') === null &&
|
198 |
+
$this->canCache->canCacheRequest($request) &&
|
199 |
+
$this->canCache->canCacheResponse($response)
|
200 |
+
) {
|
201 |
+
$this->storage->cache($cacheKey, $response, $request->getParams()->get('cache.override_ttl'));
|
202 |
+
}
|
203 |
+
|
204 |
+
$this->addResponseHeaders($cacheKey, $request, $response);
|
205 |
+
}
|
206 |
+
|
207 |
+
/**
|
208 |
+
* If possible, return a cache response on an error
|
209 |
+
*
|
210 |
+
* @param Event $event
|
211 |
+
*/
|
212 |
+
public function onRequestError(Event $event)
|
213 |
+
{
|
214 |
+
$request = $event['request'];
|
215 |
+
|
216 |
+
if (!$this->canCache->canCacheRequest($request)) {
|
217 |
+
return;
|
218 |
+
}
|
219 |
+
|
220 |
+
$cacheKey = $this->keyProvider->getCacheKey($request);
|
221 |
+
|
222 |
+
if ($cachedData = $this->storage->fetch($cacheKey)) {
|
223 |
+
$response = new Response($cachedData[0], $cachedData[1], $cachedData[2]);
|
224 |
+
$response->setRequest($request);
|
225 |
+
$response->setHeader(
|
226 |
+
'Age',
|
227 |
+
time() - strtotime($response->getLastModified() ? : $response->getDate() ?: 'now')
|
228 |
+
);
|
229 |
+
|
230 |
+
if ($this->canResponseSatisfyFailedRequest($request, $response)) {
|
231 |
+
$request->getParams()->set('cache.hit', 'error');
|
232 |
+
$this->addResponseHeaders($cacheKey, $request, $response);
|
233 |
+
$event['response'] = $response;
|
234 |
+
$event->stopPropagation();
|
235 |
+
}
|
236 |
+
}
|
237 |
+
}
|
238 |
+
|
239 |
+
/**
|
240 |
+
* If possible, set a cache response on a cURL exception
|
241 |
+
*
|
242 |
+
* @param Event $event
|
243 |
+
*
|
244 |
+
* @return null
|
245 |
+
*/
|
246 |
+
public function onRequestException(Event $event)
|
247 |
+
{
|
248 |
+
if (!$event['exception'] instanceof CurlException) {
|
249 |
+
return;
|
250 |
+
}
|
251 |
+
|
252 |
+
$request = $event['request'];
|
253 |
+
if (!$this->canCache->canCacheRequest($request)) {
|
254 |
+
return;
|
255 |
+
}
|
256 |
+
|
257 |
+
$cacheKey = $this->keyProvider->getCacheKey($request);
|
258 |
+
|
259 |
+
if ($cachedData = $this->storage->fetch($cacheKey)) {
|
260 |
+
$response = new Response($cachedData[0], $cachedData[1], $cachedData[2]);
|
261 |
+
$response->setHeader('Age', time() - strtotime($response->getDate() ? : 'now'));
|
262 |
+
if (!$this->canResponseSatisfyFailedRequest($request, $response)) {
|
263 |
+
return;
|
264 |
}
|
265 |
+
$request->getParams()->set('cache.hit', 'error');
|
266 |
+
$request->setResponse($response);
|
267 |
+
$event->stopPropagation();
|
268 |
}
|
269 |
}
|
270 |
|
329 |
|
330 |
return true;
|
331 |
}
|
332 |
+
|
333 |
+
/**
|
334 |
+
* Check if a cache response satisfies a failed request's caching constraints
|
335 |
+
*
|
336 |
+
* @param RequestInterface $request Request to validate
|
337 |
+
* @param Response $response Response to validate
|
338 |
+
*
|
339 |
+
* @return bool
|
340 |
+
*/
|
341 |
+
public function canResponseSatisfyFailedRequest(RequestInterface $request, Response $response)
|
342 |
+
{
|
343 |
+
$requestStaleIfError = $request->getCacheControlDirective('stale-if-error');
|
344 |
+
$responseStaleIfError = $response->getCacheControlDirective('stale-if-error');
|
345 |
+
|
346 |
+
if (!$requestStaleIfError && !$responseStaleIfError) {
|
347 |
+
return false;
|
348 |
+
}
|
349 |
+
|
350 |
+
if (is_numeric($requestStaleIfError) &&
|
351 |
+
$response->getAge() - $response->getMaxAge() > $requestStaleIfError
|
352 |
+
) {
|
353 |
+
return false;
|
354 |
+
}
|
355 |
+
|
356 |
+
if (is_numeric($responseStaleIfError) &&
|
357 |
+
$response->getAge() - $response->getMaxAge() > $responseStaleIfError
|
358 |
+
) {
|
359 |
+
return false;
|
360 |
+
}
|
361 |
+
|
362 |
+
return true;
|
363 |
+
}
|
364 |
+
|
365 |
+
/**
|
366 |
+
* Purge a request from the cache storage
|
367 |
+
*
|
368 |
+
* @param RequestInterface $request Request to purge
|
369 |
+
*/
|
370 |
+
public function purge(RequestInterface $request)
|
371 |
+
{
|
372 |
+
// If the request has a cache.purge_methods param, then use that, otherwise use the default known methods
|
373 |
+
$methods = $request->getParams()->get('cache.purge_methods') ?: array('GET', 'HEAD', 'POST', 'PUT', 'DELETE');
|
374 |
+
foreach ($methods as $method) {
|
375 |
+
// Clone the request with each method and clear from the cache
|
376 |
+
$cloned = RequestFactory::getInstance()->cloneRequestWithMethod($request, $method);
|
377 |
+
$key = $this->keyProvider->getCacheKey($cloned);
|
378 |
+
$this->storage->delete($key);
|
379 |
+
}
|
380 |
+
}
|
381 |
+
|
382 |
+
/**
|
383 |
+
* Add the plugin's headers to a response
|
384 |
+
*
|
385 |
+
* @param string $cacheKey Cache key
|
386 |
+
* @param RequestInterface $request Request
|
387 |
+
* @param Response $response Response to add headers to
|
388 |
+
*/
|
389 |
+
protected function addResponseHeaders($cacheKey, RequestInterface $request, Response $response)
|
390 |
+
{
|
391 |
+
if (!$response->hasHeader('X-Guzzle-Cache')) {
|
392 |
+
$response->setHeader('X-Guzzle-Cache', "key={$cacheKey}");
|
393 |
+
}
|
394 |
+
|
395 |
+
$response->addHeader('Via', sprintf('%s GuzzleCache/%s', $request->getProtocolVersion(), Version::VERSION));
|
396 |
+
|
397 |
+
if ($this->debugHeaders) {
|
398 |
+
if ($request->getParams()->get('cache.lookup') === true) {
|
399 |
+
$response->addHeader('X-Cache-Lookup', 'HIT from GuzzleCache');
|
400 |
+
} else {
|
401 |
+
$response->addHeader('X-Cache-Lookup', 'MISS from GuzzleCache');
|
402 |
+
}
|
403 |
+
if ($request->getParams()->get('cache.hit') === true) {
|
404 |
+
$response->addHeader('X-Cache', 'HIT from GuzzleCache');
|
405 |
+
} elseif ($request->getParams()->get('cache.hit') === 'error') {
|
406 |
+
$response->addHeader('X-Cache', 'HIT_ERROR from GuzzleCache');
|
407 |
+
} else {
|
408 |
+
$response->addHeader('X-Cache', 'MISS from GuzzleCache');
|
409 |
+
}
|
410 |
+
}
|
411 |
+
|
412 |
+
if ($response->isFresh() === false) {
|
413 |
+
$response->addHeader('Warning', sprintf('110 GuzzleCache/%s "Response is stale"', Version::VERSION));
|
414 |
+
if ($request->getParams()->get('cache.hit') === 'error') {
|
415 |
+
$response->addHeader(
|
416 |
+
'Warning',
|
417 |
+
sprintf('111 GuzzleCache/%s "Revalidation failed"', Version::VERSION)
|
418 |
+
);
|
419 |
+
}
|
420 |
+
}
|
421 |
+
}
|
422 |
}
|
sdk/Aws/Guzzle/Plugin/Cache/DefaultCacheStorage.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
namespace Guzzle\Plugin\Cache;
|
4 |
|
5 |
use Guzzle\Cache\CacheAdapterInterface;
|
6 |
-
use Guzzle\Http\
|
7 |
use Guzzle\Http\Message\Response;
|
8 |
|
9 |
/**
|
@@ -48,6 +48,8 @@ class DefaultCacheStorage implements CacheStorageInterface
|
|
48 |
$ttl = $this->defaultTtl;
|
49 |
}
|
50 |
|
|
|
|
|
51 |
if ($ttl) {
|
52 |
$response->setHeader('X-Guzzle-Cache', "key={$key}; ttl={$ttl}");
|
53 |
// Remove excluded headers from the response (see RFC 2616:13.5.1)
|
@@ -56,7 +58,7 @@ class DefaultCacheStorage implements CacheStorageInterface
|
|
56 |
}
|
57 |
// Add a Date header to the response if none is set (for validation)
|
58 |
if (!$response->getDate()) {
|
59 |
-
$response->setHeader('Date',
|
60 |
}
|
61 |
$this->cache->save(
|
62 |
$key,
|
3 |
namespace Guzzle\Plugin\Cache;
|
4 |
|
5 |
use Guzzle\Cache\CacheAdapterInterface;
|
6 |
+
use Guzzle\Http\ClientInterface;
|
7 |
use Guzzle\Http\Message\Response;
|
8 |
|
9 |
/**
|
48 |
$ttl = $this->defaultTtl;
|
49 |
}
|
50 |
|
51 |
+
$ttl += $response->getMaxAge();
|
52 |
+
|
53 |
if ($ttl) {
|
54 |
$response->setHeader('X-Guzzle-Cache', "key={$key}; ttl={$ttl}");
|
55 |
// Remove excluded headers from the response (see RFC 2616:13.5.1)
|
58 |
}
|
59 |
// Add a Date header to the response if none is set (for validation)
|
60 |
if (!$response->getDate()) {
|
61 |
+
$response->setHeader('Date', gmdate(ClientInterface::HTTP_DATE));
|
62 |
}
|
63 |
$this->cache->save(
|
64 |
$key,
|
sdk/Aws/Guzzle/Plugin/Cache/DefaultRevalidation.php
CHANGED
@@ -2,6 +2,7 @@
|
|
2 |
|
3 |
namespace Guzzle\Plugin\Cache;
|
4 |
|
|
|
5 |
use Guzzle\Http\Message\RequestInterface;
|
6 |
use Guzzle\Http\Message\Response;
|
7 |
use Guzzle\Http\Exception\BadResponseException;
|
@@ -28,7 +29,7 @@ class DefaultRevalidation implements RevalidationInterface
|
|
28 |
|
29 |
/**
|
30 |
* @param CacheKeyProviderInterface $cacheKey Cache key strategy
|
31 |
-
* @param CacheStorageInterface $
|
32 |
* @param CachePlugin $plugin Cache plugin to remove from revalidation requests
|
33 |
*/
|
34 |
public function __construct(CacheKeyProviderInterface $cacheKey, CacheStorageInterface $cache, CachePlugin $plugin)
|
@@ -51,6 +52,8 @@ class DefaultRevalidation implements RevalidationInterface
|
|
51 |
} elseif ($validateResponse->getStatusCode() == 304) {
|
52 |
return $this->handle304Response($request, $validateResponse, $response);
|
53 |
}
|
|
|
|
|
54 |
} catch (BadResponseException $e) {
|
55 |
$this->handleBadResponse($e);
|
56 |
}
|
@@ -90,7 +93,7 @@ class DefaultRevalidation implements RevalidationInterface
|
|
90 |
$revalidate = clone $request;
|
91 |
$revalidate->removeHeader('Pragma')
|
92 |
->removeHeader('Cache-Control')
|
93 |
-
->setHeader('If-Modified-Since', $response->getDate());
|
94 |
|
95 |
if ($response->getEtag()) {
|
96 |
$revalidate->setHeader('If-None-Match', '"' . $response->getEtag() . '"');
|
@@ -116,7 +119,9 @@ class DefaultRevalidation implements RevalidationInterface
|
|
116 |
// Store this response in cache if possible
|
117 |
if ($validateResponse->canCache()) {
|
118 |
$this->storage->cache(
|
119 |
-
$this->cacheKey->getCacheKey($request),
|
|
|
|
|
120 |
);
|
121 |
}
|
122 |
|
@@ -151,7 +156,11 @@ class DefaultRevalidation implements RevalidationInterface
|
|
151 |
}
|
152 |
// Store the updated response in cache
|
153 |
if ($modified && $response->canCache()) {
|
154 |
-
$this->storage->cache(
|
|
|
|
|
|
|
|
|
155 |
}
|
156 |
|
157 |
return true;
|
2 |
|
3 |
namespace Guzzle\Plugin\Cache;
|
4 |
|
5 |
+
use Guzzle\Http\Exception\CurlException;
|
6 |
use Guzzle\Http\Message\RequestInterface;
|
7 |
use Guzzle\Http\Message\Response;
|
8 |
use Guzzle\Http\Exception\BadResponseException;
|
29 |
|
30 |
/**
|
31 |
* @param CacheKeyProviderInterface $cacheKey Cache key strategy
|
32 |
+
* @param CacheStorageInterface $cache Cache storage
|
33 |
* @param CachePlugin $plugin Cache plugin to remove from revalidation requests
|
34 |
*/
|
35 |
public function __construct(CacheKeyProviderInterface $cacheKey, CacheStorageInterface $cache, CachePlugin $plugin)
|
52 |
} elseif ($validateResponse->getStatusCode() == 304) {
|
53 |
return $this->handle304Response($request, $validateResponse, $response);
|
54 |
}
|
55 |
+
} catch (CurlException $e) {
|
56 |
+
return $this->plugin->canResponseSatisfyFailedRequest($request, $response);
|
57 |
} catch (BadResponseException $e) {
|
58 |
$this->handleBadResponse($e);
|
59 |
}
|
93 |
$revalidate = clone $request;
|
94 |
$revalidate->removeHeader('Pragma')
|
95 |
->removeHeader('Cache-Control')
|
96 |
+
->setHeader('If-Modified-Since', $response->getLastModified() ?: $response->getDate());
|
97 |
|
98 |
if ($response->getEtag()) {
|
99 |
$revalidate->setHeader('If-None-Match', '"' . $response->getEtag() . '"');
|
119 |
// Store this response in cache if possible
|
120 |
if ($validateResponse->canCache()) {
|
121 |
$this->storage->cache(
|
122 |
+
$this->cacheKey->getCacheKey($request),
|
123 |
+
$validateResponse,
|
124 |
+
$request->getParams()->get('cache.override_ttl')
|
125 |
);
|
126 |
}
|
127 |
|
156 |
}
|
157 |
// Store the updated response in cache
|
158 |
if ($modified && $response->canCache()) {
|
159 |
+
$this->storage->cache(
|
160 |
+
$this->cacheKey->getCacheKey($request),
|
161 |
+
$response,
|
162 |
+
$request->getParams()->get('cache.override_ttl')
|
163 |
+
);
|
164 |
}
|
165 |
|
166 |
return true;
|
sdk/Aws/Guzzle/Plugin/Cache/composer.json
CHANGED
@@ -22,7 +22,7 @@
|
|
22 |
"target-dir": "Guzzle/Plugin/Cache",
|
23 |
"extra": {
|
24 |
"branch-alias": {
|
25 |
-
"dev-master": "3.
|
26 |
}
|
27 |
}
|
28 |
}
|
22 |
"target-dir": "Guzzle/Plugin/Cache",
|
23 |
"extra": {
|
24 |
"branch-alias": {
|
25 |
+
"dev-master": "3.4-dev"
|
26 |
}
|
27 |
}
|
28 |
}
|
sdk/Aws/Guzzle/Plugin/Cookie/composer.json
CHANGED
@@ -21,7 +21,7 @@
|
|
21 |
"target-dir": "Guzzle/Plugin/Cookie",
|
22 |
"extra": {
|
23 |
"branch-alias": {
|
24 |
-
"dev-master": "3.
|
25 |
}
|
26 |
}
|
27 |
}
|
21 |
"target-dir": "Guzzle/Plugin/Cookie",
|
22 |
"extra": {
|
23 |
"branch-alias": {
|
24 |
+
"dev-master": "3.4-dev"
|
25 |
}
|
26 |
}
|
27 |
}
|
sdk/Aws/Guzzle/Plugin/CurlAuth/composer.json
CHANGED
@@ -21,7 +21,7 @@
|
|
21 |
"target-dir": "Guzzle/Plugin/CurlAuth",
|
22 |
"extra": {
|
23 |
"branch-alias": {
|
24 |
-
"dev-master": "3.
|
25 |
}
|
26 |
}
|
27 |
}
|
21 |
"target-dir": "Guzzle/Plugin/CurlAuth",
|
22 |
"extra": {
|
23 |
"branch-alias": {
|
24 |
+
"dev-master": "3.4-dev"
|
25 |
}
|
26 |
}
|
27 |
}
|
sdk/Aws/Guzzle/Plugin/ErrorResponse/ErrorResponseExceptionInterface.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Guzzle\Plugin\ErrorResponse;
|
4 |
+
|
5 |
+
use Guzzle\Service\Command\CommandInterface;
|
6 |
+
use Guzzle\Http\Message\Response;
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Interface used to create an exception from an error response
|
10 |
+
*/
|
11 |
+
interface ErrorResponseExceptionInterface
|
12 |
+
{
|
13 |
+
/**
|
14 |
+
* Create an exception for a command based on a command and an error response definition
|
15 |
+
*
|
16 |
+
* @param CommandInterface $command Command that was sent
|
17 |
+
* @param Response $response The error response
|
18 |
+
*
|
19 |
+
* @return self
|
20 |
+
*/
|
21 |
+
public static function fromCommand(CommandInterface $command, Response $response);
|
22 |
+
}
|
sdk/Aws/Guzzle/Plugin/ErrorResponse/ErrorResponsePlugin.php
ADDED
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Guzzle\Plugin\ErrorResponse;
|
4 |
+
|
5 |
+
use Guzzle\Common\Event;
|
6 |
+
use Guzzle\Http\Message\RequestInterface;
|
7 |
+
use Guzzle\Service\Command\CommandInterface;
|
8 |
+
use Guzzle\Service\Description\Operation;
|
9 |
+
use Guzzle\Plugin\ErrorResponse\Exception\ErrorResponseException;
|
10 |
+
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Converts generic Guzzle response exceptions into errorResponse exceptions
|
14 |
+
*/
|
15 |
+
class ErrorResponsePlugin implements EventSubscriberInterface
|
16 |
+
{
|
17 |
+
/**
|
18 |
+
* {@inheritdoc}
|
19 |
+
*/
|
20 |
+
public static function getSubscribedEvents()
|
21 |
+
{
|
22 |
+
return array('command.before_send' => array('onCommandBeforeSend', -1));
|
23 |
+
}
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Adds a listener to requests before they sent from a command
|
27 |
+
*
|
28 |
+
* @param Event $event Event emitted
|
29 |
+
*/
|
30 |
+
public function onCommandBeforeSend(Event $event)
|
31 |
+
{
|
32 |
+
$command = $event['command'];
|
33 |
+
if ($operation = $command->getOperation()) {
|
34 |
+
if ($operation->getErrorResponses()) {
|
35 |
+
$request = $command->getRequest();
|
36 |
+
$request->getEventDispatcher()
|
37 |
+
->addListener('request.complete', $this->getErrorClosure($request, $command, $operation));
|
38 |
+
}
|
39 |
+
}
|
40 |
+
}
|
41 |
+
|
42 |
+
/**
|
43 |
+
* @param RequestInterface $request Request that received an error
|
44 |
+
* @param CommandInterface $command Command that created the request
|
45 |
+
* @param Operation $operation Operation that defines the request and errors
|
46 |
+
*
|
47 |
+
* @return \Closure Returns a closure
|
48 |
+
*/
|
49 |
+
protected function getErrorClosure(RequestInterface $request, CommandInterface $command, Operation $operation)
|
50 |
+
{
|
51 |
+
return function (Event $event) use ($request, $command, $operation) {
|
52 |
+
$response = $event['response'];
|
53 |
+
foreach ($operation->getErrorResponses() as $error) {
|
54 |
+
if (!isset($error['class'])) {
|
55 |
+
continue;
|
56 |
+
}
|
57 |
+
if (isset($error['code']) && $response->getStatusCode() != $error['code']) {
|
58 |
+
continue;
|
59 |
+
}
|
60 |
+
if (isset($error['reason']) && $response->getReasonPhrase() != $error['reason']) {
|
61 |
+
continue;
|
62 |
+
}
|
63 |
+
$className = $error['class'];
|
64 |
+
$errorClassInterface = __NAMESPACE__ . '\\ErrorResponseExceptionInterface';
|
65 |
+
if (!class_exists($className)) {
|
66 |
+
throw new ErrorResponseException("{$className} does not exist");;
|
67 |
+
} elseif (!is_subclass_of($className, $errorClassInterface)) {
|
68 |
+
throw new ErrorResponseException("{$className} must implement {$errorClassInterface}");
|
69 |
+
}
|
70 |
+
throw $className::fromCommand($command, $response);
|
71 |
+
}
|
72 |
+
};
|
73 |
+
}
|
74 |
+
}
|
sdk/Aws/Guzzle/Plugin/ErrorResponse/Exception/ErrorResponseException.php
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Guzzle\Plugin\ErrorResponse\Exception;
|
4 |
+
|
5 |
+
use Guzzle\Common\Exception\RuntimeException;
|
6 |
+
|
7 |
+
class ErrorResponseException extends RuntimeException {}
|
sdk/Aws/Guzzle/Plugin/ErrorResponse/composer.json
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "guzzle/plugin-error-response",
|
3 |
+
"description": "Guzzle errorResponse plugin for creating error exceptions based on a service description",
|
4 |
+
"homepage": "http://guzzlephp.org/",
|
5 |
+
"keywords": ["plugin", "guzzle"],
|
6 |
+
"license": "MIT",
|
7 |
+
"authors": [
|
8 |
+
{
|
9 |
+
"name": "Michael Dowling",
|
10 |
+
"email": "mtdowling@gmail.com",
|
11 |
+
"homepage": "https://github.com/mtdowling"
|
12 |
+
}
|
13 |
+
],
|
14 |
+
"require": {
|
15 |
+
"php": ">=5.3.2",
|
16 |
+
"guzzle/service": "self.version"
|
17 |
+
},
|
18 |
+
"autoload": {
|
19 |
+
"psr-0": { "Guzzle\\Plugin\\ErrorResponse": "" }
|
20 |
+
},
|
21 |
+
"target-dir": "Guzzle/Plugin/ErrorResponse",
|
22 |
+
"extra": {
|
23 |
+
"branch-alias": {
|
24 |
+
"dev-master": "3.4-dev"
|
25 |
+
}
|
26 |
+
}
|
27 |
+
}
|
sdk/Aws/Guzzle/Plugin/History/composer.json
CHANGED
@@ -21,7 +21,7 @@
|
|
21 |
"target-dir": "Guzzle/Plugin/History",
|
22 |
"extra": {
|
23 |
"branch-alias": {
|
24 |
-
"dev-master": "3.
|
25 |
}
|
26 |
}
|
27 |
}
|
21 |
"target-dir": "Guzzle/Plugin/History",
|
22 |
"extra": {
|
23 |
"branch-alias": {
|
24 |
+
"dev-master": "3.4-dev"
|
25 |
}
|
26 |
}
|
27 |
}
|
sdk/Aws/Guzzle/Plugin/Log/LogPlugin.php
CHANGED
@@ -57,12 +57,20 @@ class LogPlugin implements EventSubscriberInterface
|
|
57 |
* Get a log plugin that outputs full request, response, and curl error information to stderr
|
58 |
*
|
59 |
* @param bool $wireBodies Set to false to disable request/response body output when they use are not repeatable
|
60 |
-
* @param resource $stream Stream to write to when logging
|
61 |
*
|
62 |
* @return self
|
63 |
*/
|
64 |
-
public static function getDebugPlugin($wireBodies = true, $stream =
|
65 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
return new self(new ClosureLogAdapter(function ($m) use ($stream) {
|
67 |
fwrite($stream, $m . PHP_EOL);
|
68 |
}), "# Request:\n{request}\n\n# Response:\n{response}\n\n# Errors: {curl_code} {curl_error}", $wireBodies);
|
@@ -117,7 +125,7 @@ class LogPlugin implements EventSubscriberInterface
|
|
117 |
if ($this->wireBodies) {
|
118 |
$request = $event['request'];
|
119 |
// Ensure that curl IO events are emitted
|
120 |
-
$request->
|
121 |
// We need to make special handling for content wiring and non-repeatable streams.
|
122 |
if ($request instanceof EntityEnclosingRequestInterface && $request->getBody()
|
123 |
&& (!$request->getBody()->isSeekable() || !$request->getBody()->isReadable())
|
57 |
* Get a log plugin that outputs full request, response, and curl error information to stderr
|
58 |
*
|
59 |
* @param bool $wireBodies Set to false to disable request/response body output when they use are not repeatable
|
60 |
+
* @param resource $stream Stream to write to when logging. Defaults to STDERR when it is available
|
61 |
*
|
62 |
* @return self
|
63 |
*/
|
64 |
+
public static function getDebugPlugin($wireBodies = true, $stream = null)
|
65 |
{
|
66 |
+
if ($stream === null) {
|
67 |
+
if (defined('STDERR')) {
|
68 |
+
$stream = STDERR;
|
69 |
+
} else {
|
70 |
+
$stream = fopen('php://output', 'w');
|
71 |
+
}
|
72 |
+
}
|
73 |
+
|
74 |
return new self(new ClosureLogAdapter(function ($m) use ($stream) {
|
75 |
fwrite($stream, $m . PHP_EOL);
|
76 |
}), "# Request:\n{request}\n\n# Response:\n{response}\n\n# Errors: {curl_code} {curl_error}", $wireBodies);
|
125 |
if ($this->wireBodies) {
|
126 |
$request = $event['request'];
|
127 |
// Ensure that curl IO events are emitted
|
128 |
+
$request->getCurlOptions()->set('emit_io', true);
|
129 |
// We need to make special handling for content wiring and non-repeatable streams.
|
130 |
if ($request instanceof EntityEnclosingRequestInterface && $request->getBody()
|
131 |
&& (!$request->getBody()->isSeekable() || !$request->getBody()->isReadable())
|
sdk/Aws/Guzzle/Plugin/Log/composer.json
CHANGED
@@ -22,7 +22,7 @@
|
|
22 |
"target-dir": "Guzzle/Plugin/Log",
|
23 |
"extra": {
|
24 |
"branch-alias": {
|
25 |
-
"dev-master": "3.
|
26 |
}
|
27 |
}
|
28 |
}
|
22 |
"target-dir": "Guzzle/Plugin/Log",
|
23 |
"extra": {
|
24 |
"branch-alias": {
|
25 |
+
"dev-master": "3.4-dev"
|
26 |
}
|
27 |
}
|
28 |
}
|
sdk/Aws/Guzzle/Plugin/Md5/composer.json
CHANGED
@@ -21,7 +21,7 @@
|
|
21 |
"target-dir": "Guzzle/Plugin/Md5",
|
22 |
"extra": {
|
23 |
"branch-alias": {
|
24 |
-
"dev-master": "3.
|
25 |
}
|
26 |
}
|
27 |
}
|
21 |
"target-dir": "Guzzle/Plugin/Md5",
|
22 |
"extra": {
|
23 |
"branch-alias": {
|
24 |
+
"dev-master": "3.4-dev"
|
25 |
}
|
26 |
}
|
27 |
}
|
sdk/Aws/Guzzle/Plugin/Mock/MockPlugin.php
CHANGED
@@ -5,18 +5,19 @@ namespace Guzzle\Plugin\Mock;
|
|
5 |
use Guzzle\Common\Event;
|
6 |
use Guzzle\Common\Exception\InvalidArgumentException;
|
7 |
use Guzzle\Common\AbstractHasDispatcher;
|
|
|
8 |
use Guzzle\Http\Message\RequestInterface;
|
9 |
use Guzzle\Http\Message\EntityEnclosingRequestInterface;
|
10 |
use Guzzle\Http\Message\Response;
|
11 |
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
12 |
|
13 |
/**
|
14 |
-
* Queues mock responses and delivers mock responses in a fifo order.
|
15 |
*/
|
16 |
class MockPlugin extends AbstractHasDispatcher implements EventSubscriberInterface, \Countable
|
17 |
{
|
18 |
/**
|
19 |
-
* @var array Array of mock responses
|
20 |
*/
|
21 |
protected $queue = array();
|
22 |
|
@@ -38,17 +39,21 @@ class MockPlugin extends AbstractHasDispatcher implements EventSubscriberInterfa
|
|
38 |
/**
|
39 |
* Constructor
|
40 |
*
|
41 |
-
* @param array $
|
42 |
* @param bool $temporary Set to TRUE to remove the plugin when the queue is empty
|
43 |
* @param bool $readBodies Set to TRUE to consume the entity body when a mock is served
|
44 |
*/
|
45 |
-
public function __construct(array $
|
46 |
{
|
47 |
$this->readBodies = $readBodies;
|
48 |
$this->temporary = $temporary;
|
49 |
-
if ($
|
50 |
-
foreach ($
|
51 |
-
|
|
|
|
|
|
|
|
|
52 |
}
|
53 |
}
|
54 |
}
|
@@ -72,7 +77,7 @@ class MockPlugin extends AbstractHasDispatcher implements EventSubscriberInterfa
|
|
72 |
/**
|
73 |
* Get a mock response from a file
|
74 |
*
|
75 |
-
* @param string $
|
76 |
*
|
77 |
* @return Response
|
78 |
* @throws InvalidArgumentException if the file is not found
|
@@ -90,7 +95,7 @@ class MockPlugin extends AbstractHasDispatcher implements EventSubscriberInterfa
|
|
90 |
* Set whether or not to consume the entity body of a request when a mock
|
91 |
* response is used
|
92 |
*
|
93 |
-
* @param bool $
|
94 |
*
|
95 |
* @return self
|
96 |
*/
|
@@ -133,6 +138,20 @@ class MockPlugin extends AbstractHasDispatcher implements EventSubscriberInterfa
|
|
133 |
return $this;
|
134 |
}
|
135 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
136 |
/**
|
137 |
* Clear the queue
|
138 |
*
|
@@ -170,7 +189,8 @@ class MockPlugin extends AbstractHasDispatcher implements EventSubscriberInterfa
|
|
170 |
*
|
171 |
* @param RequestInterface $request Request to mock
|
172 |
*
|
173 |
-
* @return
|
|
|
174 |
*/
|
175 |
public function dequeue(RequestInterface $request)
|
176 |
{
|
@@ -179,12 +199,30 @@ class MockPlugin extends AbstractHasDispatcher implements EventSubscriberInterfa
|
|
179 |
'request' => $request
|
180 |
));
|
181 |
|
182 |
-
$
|
183 |
-
|
184 |
-
|
185 |
-
$
|
186 |
-
|
187 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
188 |
}
|
189 |
|
190 |
return $this;
|
5 |
use Guzzle\Common\Event;
|
6 |
use Guzzle\Common\Exception\InvalidArgumentException;
|
7 |
use Guzzle\Common\AbstractHasDispatcher;
|
8 |
+
use Guzzle\Http\Exception\CurlException;
|
9 |
use Guzzle\Http\Message\RequestInterface;
|
10 |
use Guzzle\Http\Message\EntityEnclosingRequestInterface;
|
11 |
use Guzzle\Http\Message\Response;
|
12 |
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
13 |
|
14 |
/**
|
15 |
+
* Queues mock responses or exceptions and delivers mock responses or exceptions in a fifo order.
|
16 |
*/
|
17 |
class MockPlugin extends AbstractHasDispatcher implements EventSubscriberInterface, \Countable
|
18 |
{
|
19 |
/**
|
20 |
+
* @var array Array of mock responses / exceptions
|
21 |
*/
|
22 |
protected $queue = array();
|
23 |
|
39 |
/**
|
40 |
* Constructor
|
41 |
*
|
42 |
+
* @param array $items Array of responses or exceptions to queue
|
43 |
* @param bool $temporary Set to TRUE to remove the plugin when the queue is empty
|
44 |
* @param bool $readBodies Set to TRUE to consume the entity body when a mock is served
|
45 |
*/
|
46 |
+
public function __construct(array $items = null, $temporary = false, $readBodies = false)
|
47 |
{
|
48 |
$this->readBodies = $readBodies;
|
49 |
$this->temporary = $temporary;
|
50 |
+
if ($items) {
|
51 |
+
foreach ($items as $item) {
|
52 |
+
if ($item instanceof \Exception) {
|
53 |
+
$this->addException($item);
|
54 |
+
} else {
|
55 |
+
$this->addResponse($item);
|
56 |
+
}
|
57 |
}
|
58 |
}
|
59 |
}
|
77 |
/**
|
78 |
* Get a mock response from a file
|
79 |
*
|
80 |
+
* @param string $path File to retrieve a mock response from
|
81 |
*
|
82 |
* @return Response
|
83 |
* @throws InvalidArgumentException if the file is not found
|
95 |
* Set whether or not to consume the entity body of a request when a mock
|
96 |
* response is used
|
97 |
*
|
98 |
+
* @param bool $readBodies Set to true to read and consume entity bodies
|
99 |
*
|
100 |
* @return self
|
101 |
*/
|
138 |
return $this;
|
139 |
}
|
140 |
|
141 |
+
/**
|
142 |
+
* Add an exception to the end of the queue
|
143 |
+
*
|
144 |
+
* @param CurlException $e Exception to throw when the request is executed
|
145 |
+
*
|
146 |
+
* @return MockPlugin
|
147 |
+
*/
|
148 |
+
public function addException(CurlException $e)
|
149 |
+
{
|
150 |
+
$this->queue[] = $e;
|
151 |
+
|
152 |
+
return $this;
|
153 |
+
}
|
154 |
+
|
155 |
/**
|
156 |
* Clear the queue
|
157 |
*
|
189 |
*
|
190 |
* @param RequestInterface $request Request to mock
|
191 |
*
|
192 |
+
* @return self
|
193 |
+
* @throws CurlException When request.send is called and an exception is queued
|
194 |
*/
|
195 |
public function dequeue(RequestInterface $request)
|
196 |
{
|
199 |
'request' => $request
|
200 |
));
|
201 |
|
202 |
+
$item = array_shift($this->queue);
|
203 |
+
if ($item instanceof Response) {
|
204 |
+
$request->setResponse($item, true);
|
205 |
+
if ($this->readBodies && $request instanceof EntityEnclosingRequestInterface) {
|
206 |
+
$request->getEventDispatcher()->addListener('request.sent', function (Event $event) {
|
207 |
+
while ($data = $event['request']->getBody()->read(8096));
|
208 |
+
});
|
209 |
+
}
|
210 |
+
} elseif ($item instanceof CurlException) {
|
211 |
+
$request->getEventDispatcher()->addListener(
|
212 |
+
'request.before_send',
|
213 |
+
function (Event $event) use ($request, $item) {
|
214 |
+
// Emulates exceptions encountered while transferring requests
|
215 |
+
$item->setRequest($request);
|
216 |
+
$request->setState(RequestInterface::STATE_ERROR);
|
217 |
+
$request->dispatch('request.exception', array('request' => $request, 'exception' => $item));
|
218 |
+
// Only throw if the exception wasn't handled
|
219 |
+
if ($request->getState() == RequestInterface::STATE_ERROR) {
|
220 |
+
throw $item;
|
221 |
+
}
|
222 |
+
},
|
223 |
+
// Use a number lower than the CachePlugin
|
224 |
+
-999
|
225 |
+
);
|
226 |
}
|
227 |
|
228 |
return $this;
|
sdk/Aws/Guzzle/Plugin/Mock/composer.json
CHANGED
@@ -21,7 +21,7 @@
|
|
21 |
"target-dir": "Guzzle/Plugin/Mock",
|
22 |
"extra": {
|
23 |
"branch-alias": {
|
24 |
-
"dev-master": "3.
|
25 |
}
|
26 |
}
|
27 |
}
|
21 |
"target-dir": "Guzzle/Plugin/Mock",
|
22 |
"extra": {
|
23 |
"branch-alias": {
|
24 |
+
"dev-master": "3.4-dev"
|
25 |
}
|
26 |
}
|
27 |
}
|
sdk/Aws/Guzzle/Plugin/Oauth/OauthPlugin.php
CHANGED
@@ -6,6 +6,7 @@ use Guzzle\Common\Event;
|
|
6 |
use Guzzle\Common\Collection;
|
7 |
use Guzzle\Http\Message\RequestInterface;
|
8 |
use Guzzle\Http\Message\EntityEnclosingRequestInterface;
|
|
|
9 |
use Guzzle\Http\Url;
|
10 |
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
11 |
|
@@ -24,10 +25,12 @@ class OauthPlugin implements EventSubscriberInterface
|
|
24 |
* Create a new OAuth 1.0 plugin
|
25 |
*
|
26 |
* @param array $config Configuration array containing these parameters:
|
|
|
27 |
* - string 'consumer_key' Consumer key
|
28 |
* - string 'consumer_secret' Consumer secret
|
29 |
* - string 'token' Token
|
30 |
* - string 'token_secret' Token secret
|
|
|
31 |
* - string 'version' OAuth version. Defaults to 1.0
|
32 |
* - string 'signature_method' Custom signature method
|
33 |
* - bool 'disable_post_params' Set to true to prevent POST parameters from being signed
|
@@ -72,12 +75,14 @@ class OauthPlugin implements EventSubscriberInterface
|
|
72 |
$nonce = $this->generateNonce($request);
|
73 |
|
74 |
$authorizationParams = array(
|
|
|
75 |
'oauth_consumer_key' => $this->config['consumer_key'],
|
76 |
'oauth_nonce' => $nonce,
|
77 |
'oauth_signature' => $this->getSignature($request, $timestamp, $nonce),
|
78 |
'oauth_signature_method' => $this->config['signature_method'],
|
79 |
'oauth_timestamp' => $timestamp,
|
80 |
'oauth_token' => $this->config['token'],
|
|
|
81 |
'oauth_version' => $this->config['version'],
|
82 |
);
|
83 |
|
@@ -131,31 +136,24 @@ class OauthPlugin implements EventSubscriberInterface
|
|
131 |
* @param RequestInterface $request Request to generate a signature for
|
132 |
* @param int $timestamp Timestamp to use for nonce
|
133 |
* @param string $nonce
|
|
|
134 |
* @return string
|
135 |
*/
|
136 |
public function getStringToSign(RequestInterface $request, $timestamp, $nonce)
|
137 |
{
|
138 |
$params = $this->getParamsToSign($request, $timestamp, $nonce);
|
139 |
|
|
|
|
|
|
|
140 |
// Build signing string from combined params
|
141 |
-
$parameterString =
|
142 |
-
foreach ($params as $key => $values) {
|
143 |
-
$key = rawurlencode($key);
|
144 |
-
$values = (array) $values;
|
145 |
-
sort($values);
|
146 |
-
foreach ($values as $value) {
|
147 |
-
if (is_bool($value)) {
|
148 |
-
$value = $value ? 'true' : 'false';
|
149 |
-
}
|
150 |
-
$parameterString[] = $key . '=' . rawurlencode($value);
|
151 |
-
}
|
152 |
-
}
|
153 |
|
154 |
$url = Url::factory($request->getUrl())->setQuery('')->setFragment(null);
|
155 |
|
156 |
return strtoupper($request->getMethod()) . '&'
|
157 |
. rawurlencode($url) . '&'
|
158 |
-
. rawurlencode(
|
159 |
}
|
160 |
|
161 |
/**
|
@@ -170,26 +168,22 @@ class OauthPlugin implements EventSubscriberInterface
|
|
170 |
public function getParamsToSign(RequestInterface $request, $timestamp, $nonce)
|
171 |
{
|
172 |
$params = new Collection(array(
|
|
|
173 |
'oauth_consumer_key' => $this->config['consumer_key'],
|
174 |
'oauth_nonce' => $nonce,
|
175 |
'oauth_signature_method' => $this->config['signature_method'],
|
176 |
'oauth_timestamp' => $timestamp,
|
|
|
|
|
177 |
'oauth_version' => $this->config['version']
|
178 |
));
|
179 |
|
180 |
-
// Filter out oauth_token during temp token step, as in request_token.
|
181 |
-
if ($this->config['token'] !== false) {
|
182 |
-
$params->add('oauth_token', $this->config['token']);
|
183 |
-
}
|
184 |
-
|
185 |
// Add query string parameters
|
186 |
$params->merge($request->getQuery());
|
187 |
|
188 |
-
// Add POST fields to signing string
|
189 |
-
if (
|
190 |
-
|
191 |
-
(string) $request->getHeader('Content-Type') == 'application/x-www-form-urlencoded') {
|
192 |
-
|
193 |
$params->merge($request->getPostFields());
|
194 |
}
|
195 |
|
@@ -200,11 +194,32 @@ class OauthPlugin implements EventSubscriberInterface
|
|
200 |
return $params;
|
201 |
}
|
202 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
203 |
/**
|
204 |
* Returns a Nonce Based on the unique id and URL. This will allow for multiple requests in parallel with the same
|
205 |
* exact timestamp to use separate nonce's.
|
206 |
*
|
207 |
-
* @param RequestInterface $request
|
208 |
*
|
209 |
* @return string
|
210 |
*/
|
@@ -216,11 +231,39 @@ class OauthPlugin implements EventSubscriberInterface
|
|
216 |
/**
|
217 |
* Gets timestamp from event or create new timestamp
|
218 |
*
|
219 |
-
* @param Event $event
|
220 |
-
*
|
|
|
221 |
*/
|
222 |
public function getTimestamp(Event $event)
|
223 |
{
|
224 |
-
return $event['timestamp']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
225 |
}
|
226 |
}
|
6 |
use Guzzle\Common\Collection;
|
7 |
use Guzzle\Http\Message\RequestInterface;
|
8 |
use Guzzle\Http\Message\EntityEnclosingRequestInterface;
|
9 |
+
use Guzzle\Http\QueryString;
|
10 |
use Guzzle\Http\Url;
|
11 |
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
12 |
|
25 |
* Create a new OAuth 1.0 plugin
|
26 |
*
|
27 |
* @param array $config Configuration array containing these parameters:
|
28 |
+
* - string 'callback' OAuth callback
|
29 |
* - string 'consumer_key' Consumer key
|
30 |
* - string 'consumer_secret' Consumer secret
|
31 |
* - string 'token' Token
|
32 |
* - string 'token_secret' Token secret
|
33 |
+
* - string 'verifier' OAuth verifier.
|
34 |
* - string 'version' OAuth version. Defaults to 1.0
|
35 |
* - string 'signature_method' Custom signature method
|
36 |
* - bool 'disable_post_params' Set to true to prevent POST parameters from being signed
|
75 |
$nonce = $this->generateNonce($request);
|
76 |
|
77 |
$authorizationParams = array(
|
78 |
+
'oauth_callback' => $this->config['callback'],
|
79 |
'oauth_consumer_key' => $this->config['consumer_key'],
|
80 |
'oauth_nonce' => $nonce,
|
81 |
'oauth_signature' => $this->getSignature($request, $timestamp, $nonce),
|
82 |
'oauth_signature_method' => $this->config['signature_method'],
|
83 |
'oauth_timestamp' => $timestamp,
|
84 |
'oauth_token' => $this->config['token'],
|
85 |
+
'oauth_verifier' => $this->config['verifier'],
|
86 |
'oauth_version' => $this->config['version'],
|
87 |
);
|
88 |
|
136 |
* @param RequestInterface $request Request to generate a signature for
|
137 |
* @param int $timestamp Timestamp to use for nonce
|
138 |
* @param string $nonce
|
139 |
+
*
|
140 |
* @return string
|
141 |
*/
|
142 |
public function getStringToSign(RequestInterface $request, $timestamp, $nonce)
|
143 |
{
|
144 |
$params = $this->getParamsToSign($request, $timestamp, $nonce);
|
145 |
|
146 |
+
// Convert booleans to strings.
|
147 |
+
$params = $this->prepareParameters($params);
|
148 |
+
|
149 |
// Build signing string from combined params
|
150 |
+
$parameterString = new QueryString($params);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
|
152 |
$url = Url::factory($request->getUrl())->setQuery('')->setFragment(null);
|
153 |
|
154 |
return strtoupper($request->getMethod()) . '&'
|
155 |
. rawurlencode($url) . '&'
|
156 |
+
. rawurlencode((string) $parameterString);
|
157 |
}
|
158 |
|
159 |
/**
|
168 |
public function getParamsToSign(RequestInterface $request, $timestamp, $nonce)
|
169 |
{
|
170 |
$params = new Collection(array(
|
171 |
+
'oauth_callback' => $this->config['callback'],
|
172 |
'oauth_consumer_key' => $this->config['consumer_key'],
|
173 |
'oauth_nonce' => $nonce,
|
174 |
'oauth_signature_method' => $this->config['signature_method'],
|
175 |
'oauth_timestamp' => $timestamp,
|
176 |
+
'oauth_token' => $this->config['token'],
|
177 |
+
'oauth_verifier' => $this->config['verifier'],
|
178 |
'oauth_version' => $this->config['version']
|
179 |
));
|
180 |
|
|
|
|
|
|
|
|
|
|
|
181 |
// Add query string parameters
|
182 |
$params->merge($request->getQuery());
|
183 |
|
184 |
+
// Add POST fields to signing string if required
|
185 |
+
if ($this->shouldPostFieldsBeSigned($request))
|
186 |
+
{
|
|
|
|
|
187 |
$params->merge($request->getPostFields());
|
188 |
}
|
189 |
|
194 |
return $params;
|
195 |
}
|
196 |
|
197 |
+
/**
|
198 |
+
* Decide whether the post fields should be added to the base string that Oauth signs.
|
199 |
+
* This implementation is correct. Non-conformant APIs may require that this method be
|
200 |
+
* overwritten e.g. the Flickr API incorrectly adds the post fields when the Content-Type
|
201 |
+
* is 'application/x-www-form-urlencoded'
|
202 |
+
*
|
203 |
+
* @param $request
|
204 |
+
* @return bool Whether the post fields should be signed or not
|
205 |
+
*/
|
206 |
+
public function shouldPostFieldsBeSigned($request)
|
207 |
+
{
|
208 |
+
if (!$this->config->get('disable_post_params') &&
|
209 |
+
$request instanceof EntityEnclosingRequestInterface &&
|
210 |
+
false !== strpos($request->getHeader('Content-Type'), 'application/x-www-form-urlencoded'))
|
211 |
+
{
|
212 |
+
return true;
|
213 |
+
}
|
214 |
+
|
215 |
+
return false;
|
216 |
+
}
|
217 |
+
|
218 |
/**
|
219 |
* Returns a Nonce Based on the unique id and URL. This will allow for multiple requests in parallel with the same
|
220 |
* exact timestamp to use separate nonce's.
|
221 |
*
|
222 |
+
* @param RequestInterface $request Request to generate a nonce for
|
223 |
*
|
224 |
* @return string
|
225 |
*/
|
231 |
/**
|
232 |
* Gets timestamp from event or create new timestamp
|
233 |
*
|
234 |
+
* @param Event $event Event containing contextual information
|
235 |
+
*
|
236 |
+
* @return int
|
237 |
*/
|
238 |
public function getTimestamp(Event $event)
|
239 |
{
|
240 |
+
return $event['timestamp'] ?: time();
|
241 |
+
}
|
242 |
+
|
243 |
+
/**
|
244 |
+
* Convert booleans to strings, removed unset parameters, and sorts the array
|
245 |
+
*
|
246 |
+
* @param array $data Data array
|
247 |
+
*
|
248 |
+
* @return array
|
249 |
+
*/
|
250 |
+
protected function prepareParameters($data)
|
251 |
+
{
|
252 |
+
ksort($data);
|
253 |
+
foreach ($data as $key => &$value) {
|
254 |
+
switch (gettype($value)) {
|
255 |
+
case 'NULL':
|
256 |
+
unset($data[$key]);
|
257 |
+
break;
|
258 |
+
case 'array':
|
259 |
+
$data[$key] = self::prepareParameters($value);
|
260 |
+
break;
|
261 |
+
case 'boolean':
|
262 |
+
$data[$key] = $value ? 'true' : 'false';
|
263 |
+
break;
|
264 |
+
}
|
265 |
+
}
|
266 |
+
|
267 |
+
return $data;
|
268 |
}
|
269 |
}
|
sdk/Aws/Guzzle/Plugin/Oauth/composer.json
CHANGED
@@ -21,7 +21,7 @@
|
|
21 |
"target-dir": "Guzzle/Plugin/Oauth",
|
22 |
"extra": {
|
23 |
"branch-alias": {
|
24 |
-
"dev-master": "3.
|
25 |
}
|
26 |
}
|
27 |
}
|
21 |
"target-dir": "Guzzle/Plugin/Oauth",
|
22 |
"extra": {
|
23 |
"branch-alias": {
|
24 |
+
"dev-master": "3.4-dev"
|
25 |
}
|
26 |
}
|
27 |
}
|
sdk/Aws/Guzzle/Plugin/composer.json
CHANGED
@@ -29,6 +29,7 @@
|
|
29 |
"guzzle/plugin-cache": "self.version",
|
30 |
"guzzle/plugin-cookie": "self.version",
|
31 |
"guzzle/plugin-curlauth": "self.version",
|
|
|
32 |
"guzzle/plugin-history": "self.version",
|
33 |
"guzzle/plugin-log": "self.version",
|
34 |
"guzzle/plugin-md5": "self.version",
|
@@ -37,7 +38,7 @@
|
|
37 |
},
|
38 |
"extra": {
|
39 |
"branch-alias": {
|
40 |
-
"dev-master": "3.
|
41 |
}
|
42 |
}
|
43 |
}
|
29 |
"guzzle/plugin-cache": "self.version",
|
30 |
"guzzle/plugin-cookie": "self.version",
|
31 |
"guzzle/plugin-curlauth": "self.version",
|
32 |
+
"guzzle/plugin-error-response": "self.version",
|
33 |
"guzzle/plugin-history": "self.version",
|
34 |
"guzzle/plugin-log": "self.version",
|
35 |
"guzzle/plugin-md5": "self.version",
|
38 |
},
|
39 |
"extra": {
|
40 |
"branch-alias": {
|
41 |
+
"dev-master": "3.4-dev"
|
42 |
}
|
43 |
}
|
44 |
}
|
sdk/Aws/Guzzle/Service/AbstractConfigLoader.php
CHANGED
@@ -15,11 +15,19 @@ abstract class AbstractConfigLoader implements ConfigLoaderInterface
|
|
15 |
*/
|
16 |
protected $aliases = array();
|
17 |
|
|
|
|
|
|
|
|
|
|
|
18 |
/**
|
19 |
* {@inheritdoc}
|
20 |
*/
|
21 |
public function load($config, array $options = array())
|
22 |
{
|
|
|
|
|
|
|
23 |
if (is_string($config)) {
|
24 |
$config = $this->loadFile($config);
|
25 |
} elseif (!is_array($config)) {
|
@@ -77,6 +85,7 @@ abstract class AbstractConfigLoader implements ConfigLoaderInterface
|
|
77 |
*
|
78 |
* @return array
|
79 |
* @throws InvalidArgumentException
|
|
|
80 |
*/
|
81 |
protected function loadFile($filename)
|
82 |
{
|
@@ -84,26 +93,40 @@ abstract class AbstractConfigLoader implements ConfigLoaderInterface
|
|
84 |
$filename = $this->aliases[$filename];
|
85 |
}
|
86 |
|
87 |
-
|
88 |
-
|
89 |
-
|
|
|
|
|
|
|
90 |
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
}
|
106 |
|
|
|
|
|
|
|
107 |
// Merge include files into the configuration array
|
108 |
$this->mergeIncludes($config, dirname($filename));
|
109 |
|
@@ -126,7 +149,11 @@ abstract class AbstractConfigLoader implements ConfigLoaderInterface
|
|
126 |
if ($path[0] != DIRECTORY_SEPARATOR && !isset($this->aliases[$path]) && $basePath) {
|
127 |
$path = "{$basePath}/{$path}";
|
128 |
}
|
129 |
-
|
|
|
|
|
|
|
|
|
130 |
}
|
131 |
}
|
132 |
}
|
15 |
*/
|
16 |
protected $aliases = array();
|
17 |
|
18 |
+
/**
|
19 |
+
* @var array Hash of previously loaded filenames
|
20 |
+
*/
|
21 |
+
protected $loadedFiles = array();
|
22 |
+
|
23 |
/**
|
24 |
* {@inheritdoc}
|
25 |
*/
|
26 |
public function load($config, array $options = array())
|
27 |
{
|
28 |
+
// Reset the array of loaded files because this is a new config
|
29 |
+
$this->loadedFiles = array();
|
30 |
+
|
31 |
if (is_string($config)) {
|
32 |
$config = $this->loadFile($config);
|
33 |
} elseif (!is_array($config)) {
|
85 |
*
|
86 |
* @return array
|
87 |
* @throws InvalidArgumentException
|
88 |
+
* @throws RuntimeException when the JSON cannot be parsed
|
89 |
*/
|
90 |
protected function loadFile($filename)
|
91 |
{
|
93 |
$filename = $this->aliases[$filename];
|
94 |
}
|
95 |
|
96 |
+
switch (pathinfo($filename, PATHINFO_EXTENSION)) {
|
97 |
+
case 'js':
|
98 |
+
case 'json':
|
99 |
+
$level = error_reporting(0);
|
100 |
+
$json = file_get_contents($filename);
|
101 |
+
error_reporting($level);
|
102 |
|
103 |
+
if ($json === false) {
|
104 |
+
$err = error_get_last();
|
105 |
+
throw new InvalidArgumentException("Unable to open {$filename}: " . $err['message']);
|
106 |
+
}
|
107 |
+
|
108 |
+
$config = json_decode($json, true);
|
109 |
+
// Throw an exception if there was an error loading the file
|
110 |
+
if ($error = json_last_error()) {
|
111 |
+
throw new RuntimeException("Error loading JSON data from {$filename}: {$error}");
|
112 |
+
}
|
113 |
+
break;
|
114 |
+
case 'php':
|
115 |
+
if (!is_readable($filename)) {
|
116 |
+
throw new InvalidArgumentException("Unable to open {$filename} for reading");
|
117 |
+
}
|
118 |
+
$config = require $filename;
|
119 |
+
if (!is_array($config)) {
|
120 |
+
throw new InvalidArgumentException('PHP files must return an array of configuration data');
|
121 |
+
}
|
122 |
+
break;
|
123 |
+
default:
|
124 |
+
throw new InvalidArgumentException('Unknown file extension: ' . $filename);
|
125 |
}
|
126 |
|
127 |
+
// Keep track of this file being loaded to prevent infinite recursion
|
128 |
+
$this->loadedFiles[$filename] = true;
|
129 |
+
|
130 |
// Merge include files into the configuration array
|
131 |
$this->mergeIncludes($config, dirname($filename));
|
132 |
|
149 |
if ($path[0] != DIRECTORY_SEPARATOR && !isset($this->aliases[$path]) && $basePath) {
|
150 |
$path = "{$basePath}/{$path}";
|
151 |
}
|
152 |
+
// Don't load the same files more than once
|
153 |
+
if (!isset($this->loadedFiles[$path])) {
|
154 |
+
$this->loadedFiles[$path] = true;
|
155 |
+
$config = $this->mergeData($this->loadFile($path), $config);
|
156 |
+
}
|
157 |
}
|
158 |
}
|
159 |
}
|
sdk/Aws/Guzzle/Service/Builder/ServiceBuilder.php
CHANGED
@@ -143,13 +143,19 @@ class ServiceBuilder extends AbstractHasDispatcher implements ServiceBuilderInte
|
|
143 |
|
144 |
// Convert references to the actual client
|
145 |
foreach ($this->builderConfig[$name]['params'] as &$v) {
|
146 |
-
if (is_string($v) &&
|
147 |
-
$v = $this->get(trim(
|
148 |
}
|
149 |
}
|
150 |
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
$class = $this->builderConfig[$name]['class'];
|
152 |
-
$client = $class::factory($
|
153 |
|
154 |
if (!$throwAway) {
|
155 |
$this->clients[$name] = $client;
|
@@ -160,9 +166,7 @@ class ServiceBuilder extends AbstractHasDispatcher implements ServiceBuilderInte
|
|
160 |
}
|
161 |
|
162 |
// Dispatch an event letting listeners know a client was created
|
163 |
-
$this->dispatch('service_builder.create_client', array(
|
164 |
-
'client' => $client
|
165 |
-
));
|
166 |
|
167 |
return $client;
|
168 |
}
|
143 |
|
144 |
// Convert references to the actual client
|
145 |
foreach ($this->builderConfig[$name]['params'] as &$v) {
|
146 |
+
if (is_string($v) && substr($v, 0, 1) == '{' && substr($v, -1) == '}') {
|
147 |
+
$v = $this->get(trim(trim($v, '{}')));
|
148 |
}
|
149 |
}
|
150 |
|
151 |
+
// Get the configured parameters and merge in any parameters provided for throw-away clients
|
152 |
+
$config = $this->builderConfig[$name]['params'];
|
153 |
+
if (is_array($throwAway)) {
|
154 |
+
$config = $throwAway + $config;
|
155 |
+
}
|
156 |
+
|
157 |
$class = $this->builderConfig[$name]['class'];
|
158 |
+
$client = $class::factory($config);
|
159 |
|
160 |
if (!$throwAway) {
|
161 |
$this->clients[$name] = $client;
|
166 |
}
|
167 |
|
168 |
// Dispatch an event letting listeners know a client was created
|
169 |
+
$this->dispatch('service_builder.create_client', array('client' => $client));
|
|
|
|
|
170 |
|
171 |
return $client;
|
172 |
}
|
sdk/Aws/Guzzle/Service/Builder/ServiceBuilderInterface.php
CHANGED
@@ -13,8 +13,9 @@ interface ServiceBuilderInterface
|
|
13 |
/**
|
14 |
* Get a service using a registered builder
|
15 |
*
|
16 |
-
* @param string
|
17 |
-
* @param bool
|
|
|
18 |
*
|
19 |
* @return FromConfigInterface
|
20 |
* @throws ServiceNotFoundException when a client cannot be found by name
|
13 |
/**
|
14 |
* Get a service using a registered builder
|
15 |
*
|
16 |
+
* @param string $name Name of the registered client to retrieve
|
17 |
+
* @param bool|array $throwAway Set to TRUE to not store the client for later retrieval from the ServiceBuilder.
|
18 |
+
* If an array is specified, that data will overwrite the configured params
|
19 |
*
|
20 |
* @return FromConfigInterface
|
21 |
* @throws ServiceNotFoundException when a client cannot be found by name
|
sdk/Aws/Guzzle/Service/Client.php
CHANGED
@@ -13,9 +13,7 @@ use Guzzle\Service\Exception\CommandTransferException;
|
|
13 |
use Guzzle\Http\Message\RequestInterface;
|
14 |
use Guzzle\Service\Command\CommandInterface;
|
15 |
use Guzzle\Service\Command\Factory\CompositeFactory;
|
16 |
-
use Guzzle\Service\Command\Factory\ServiceDescriptionFactory;
|
17 |
use Guzzle\Service\Command\Factory\FactoryInterface as CommandFactoryInterface;
|
18 |
-
use Guzzle\Service\Resource\ResourceIteratorInterface;
|
19 |
use Guzzle\Service\Resource\ResourceIteratorClassFactory;
|
20 |
use Guzzle\Service\Resource\ResourceIteratorFactoryInterface;
|
21 |
use Guzzle\Service\Description\ServiceDescriptionInterface;
|
@@ -72,6 +70,7 @@ class Client extends HttpClient implements ClientInterface
|
|
72 |
return array_merge(HttpClient::getAllEvents(), array(
|
73 |
'client.command.create',
|
74 |
'command.before_prepare',
|
|
|
75 |
'command.before_send',
|
76 |
'command.after_send'
|
77 |
));
|
@@ -110,15 +109,7 @@ class Client extends HttpClient implements ClientInterface
|
|
110 |
}
|
111 |
|
112 |
/**
|
113 |
-
*
|
114 |
-
* defines a command by the supplied name. If no dynamic command is found, the client will look for a concrete
|
115 |
-
* command class exists matching the name supplied. If neither are found, an InvalidArgumentException is thrown.
|
116 |
-
*
|
117 |
-
* @param string $name Name of the command to retrieve
|
118 |
-
* @param array $args Arguments to pass to the command
|
119 |
-
*
|
120 |
-
* @return CommandInterface
|
121 |
-
* @throws InvalidArgumentException if no command can be found by name
|
122 |
*/
|
123 |
public function getCommand($name, array $args = array())
|
124 |
{
|
@@ -148,11 +139,7 @@ class Client extends HttpClient implements ClientInterface
|
|
148 |
}
|
149 |
|
150 |
/**
|
151 |
-
*
|
152 |
-
*
|
153 |
-
* @param CommandFactoryInterface $factory Command factory
|
154 |
-
*
|
155 |
-
* @return Client
|
156 |
*/
|
157 |
public function setCommandFactory(CommandFactoryInterface $factory)
|
158 |
{
|
@@ -162,11 +149,7 @@ class Client extends HttpClient implements ClientInterface
|
|
162 |
}
|
163 |
|
164 |
/**
|
165 |
-
*
|
166 |
-
*
|
167 |
-
* @param ResourceIteratorFactoryInterface $factory Resource iterator factory
|
168 |
-
*
|
169 |
-
* @return Client
|
170 |
*/
|
171 |
public function setResourceIteratorFactory(ResourceIteratorFactoryInterface $factory)
|
172 |
{
|
@@ -176,13 +159,7 @@ class Client extends HttpClient implements ClientInterface
|
|
176 |
}
|
177 |
|
178 |
/**
|
179 |
-
*
|
180 |
-
*
|
181 |
-
* @param string|CommandInterface $command Command class or command name.
|
182 |
-
* @param array $commandOptions Command options used when creating commands.
|
183 |
-
* @param array $iteratorOptions Iterator options passed to the iterator when it is instantiated.
|
184 |
-
*
|
185 |
-
* @return ResourceIteratorInterface
|
186 |
*/
|
187 |
public function getIterator($command, array $commandOptions = null, array $iteratorOptions = array())
|
188 |
{
|
@@ -194,13 +171,7 @@ class Client extends HttpClient implements ClientInterface
|
|
194 |
}
|
195 |
|
196 |
/**
|
197 |
-
*
|
198 |
-
*
|
199 |
-
* @param CommandInterface|array $command Command or array of commands to execute
|
200 |
-
*
|
201 |
-
* @return mixed Returns the result of the executed command or an array of commands if executing multiple commands
|
202 |
-
* @throws InvalidArgumentException if an invalid command is passed
|
203 |
-
* @throws CommandTransferException if an exception is encountered when transferring multiple commands
|
204 |
*/
|
205 |
public function execute($command)
|
206 |
{
|
@@ -215,85 +186,58 @@ class Client extends HttpClient implements ClientInterface
|
|
215 |
|
216 |
$failureException = null;
|
217 |
$requests = array();
|
218 |
-
$
|
219 |
|
220 |
foreach ($command as $c) {
|
221 |
$c->setClient($this);
|
222 |
// Set the state to new if the command was previously executed
|
223 |
$request = $c->prepare()->setState(RequestInterface::STATE_NEW);
|
224 |
-
$
|
225 |
$requests[] = $request;
|
226 |
$this->dispatch('command.before_send', array('command' => $c));
|
227 |
}
|
228 |
|
229 |
try {
|
230 |
$this->send($requests);
|
231 |
-
|
232 |
-
|
233 |
-
// Remove failed requests from the successful requests array and add to the failures array
|
234 |
-
foreach ($failureException->getFailedRequests() as $request) {
|
235 |
-
if (isset($successful[$request])) {
|
236 |
-
$failures[$request] = $successful[$request];
|
237 |
-
unset($successful[$request]);
|
238 |
-
}
|
239 |
}
|
240 |
-
|
|
|
241 |
|
242 |
-
|
243 |
-
|
244 |
-
|
|
|
245 |
|
246 |
-
// Return the response or throw an exception
|
247 |
-
if (!$failureException) {
|
248 |
-
return $singleCommand ? end($command)->getResult() : $command;
|
249 |
-
} elseif ($singleCommand) {
|
250 |
-
// If only sending a single request, then don't use a CommandTransferException
|
251 |
-
throw $failureException->getFirst();
|
252 |
-
} else {
|
253 |
// Throw a CommandTransferException using the successful and failed commands
|
254 |
$e = CommandTransferException::fromMultiTransferException($failureException);
|
255 |
-
|
256 |
-
|
|
|
|
|
|
|
|
|
|
|
257 |
}
|
258 |
-
|
259 |
-
|
|
|
|
|
|
|
260 |
}
|
|
|
261 |
throw $e;
|
262 |
}
|
263 |
}
|
264 |
|
265 |
/**
|
266 |
-
*
|
267 |
-
*
|
268 |
-
* @param ServiceDescriptionInterface $service Service description
|
269 |
-
* @param bool $updateFactory Set to false to not update the service description based
|
270 |
-
* command factory if it is not already on the client.
|
271 |
-
* @return Client
|
272 |
*/
|
273 |
-
public function setDescription(ServiceDescriptionInterface $service
|
274 |
{
|
275 |
$this->serviceDescription = $service;
|
276 |
|
277 |
-
// Add the service description factory to the factory chain if it is not set
|
278 |
-
if ($updateFactory) {
|
279 |
-
// Convert non chain factories to a chain factory
|
280 |
-
if (!($this->getCommandFactory() instanceof CompositeFactory)) {
|
281 |
-
$this->commandFactory = new CompositeFactory(array($this->commandFactory));
|
282 |
-
}
|
283 |
-
// Add a service description factory if one does not already exist
|
284 |
-
if (!$this->commandFactory->has('Guzzle\\Service\\Command\\Factory\\ServiceDescriptionFactory')) {
|
285 |
-
// Add the service description factory before the concrete factory
|
286 |
-
$this->commandFactory->add(
|
287 |
-
new ServiceDescriptionFactory($service),
|
288 |
-
'Guzzle\\Service\\Command\\Factory\\ConcreteClassFactory'
|
289 |
-
);
|
290 |
-
} else {
|
291 |
-
// Update an existing service description factory
|
292 |
-
$factory = $this->commandFactory->find('Guzzle\\Service\\Command\\Factory\\ServiceDescriptionFactory');
|
293 |
-
$factory->setServiceDescription($service);
|
294 |
-
}
|
295 |
-
}
|
296 |
-
|
297 |
// If a baseUrl was set on the description, then update the client
|
298 |
if ($baseUrl = $service->getBaseUrl()) {
|
299 |
$this->setBaseUrl($baseUrl);
|
@@ -303,9 +247,7 @@ class Client extends HttpClient implements ClientInterface
|
|
303 |
}
|
304 |
|
305 |
/**
|
306 |
-
*
|
307 |
-
*
|
308 |
-
* @return ServiceDescriptionInterface|null
|
309 |
*/
|
310 |
public function getDescription()
|
311 |
{
|
@@ -313,11 +255,7 @@ class Client extends HttpClient implements ClientInterface
|
|
313 |
}
|
314 |
|
315 |
/**
|
316 |
-
*
|
317 |
-
*
|
318 |
-
* @param InflectorInterface $inflector Inflection object
|
319 |
-
*
|
320 |
-
* @return Client
|
321 |
*/
|
322 |
public function setInflector(InflectorInterface $inflector)
|
323 |
{
|
@@ -327,9 +265,7 @@ class Client extends HttpClient implements ClientInterface
|
|
327 |
}
|
328 |
|
329 |
/**
|
330 |
-
*
|
331 |
-
*
|
332 |
-
* @return InflectorInterface
|
333 |
*/
|
334 |
public function getInflector()
|
335 |
{
|
@@ -341,9 +277,7 @@ class Client extends HttpClient implements ClientInterface
|
|
341 |
}
|
342 |
|
343 |
/**
|
344 |
-
*
|
345 |
-
*
|
346 |
-
* @return ResourceIteratorFactoryInterface
|
347 |
*/
|
348 |
protected function getResourceIteratorFactory()
|
349 |
{
|
13 |
use Guzzle\Http\Message\RequestInterface;
|
14 |
use Guzzle\Service\Command\CommandInterface;
|
15 |
use Guzzle\Service\Command\Factory\CompositeFactory;
|
|
|
16 |
use Guzzle\Service\Command\Factory\FactoryInterface as CommandFactoryInterface;
|
|
|
17 |
use Guzzle\Service\Resource\ResourceIteratorClassFactory;
|
18 |
use Guzzle\Service\Resource\ResourceIteratorFactoryInterface;
|
19 |
use Guzzle\Service\Description\ServiceDescriptionInterface;
|
70 |
return array_merge(HttpClient::getAllEvents(), array(
|
71 |
'client.command.create',
|
72 |
'command.before_prepare',
|
73 |
+
'command.after_prepare',
|
74 |
'command.before_send',
|
75 |
'command.after_send'
|
76 |
));
|
109 |
}
|
110 |
|
111 |
/**
|
112 |
+
* {@inheritdoc}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
*/
|
114 |
public function getCommand($name, array $args = array())
|
115 |
{
|
139 |
}
|
140 |
|
141 |
/**
|
142 |
+
* {@inheritdoc}
|
|
|
|
|
|
|
|
|
143 |
*/
|
144 |
public function setCommandFactory(CommandFactoryInterface $factory)
|
145 |
{
|
149 |
}
|
150 |
|
151 |
/**
|
152 |
+
* {@inheritdoc}
|
|
|
|
|
|
|
|
|
153 |
*/
|
154 |
public function setResourceIteratorFactory(ResourceIteratorFactoryInterface $factory)
|
155 |
{
|
159 |
}
|
160 |
|
161 |
/**
|
162 |
+
* {@inheritdoc}
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
*/
|
164 |
public function getIterator($command, array $commandOptions = null, array $iteratorOptions = array())
|
165 |
{
|
171 |
}
|
172 |
|
173 |
/**
|
174 |
+
* {@inheritdoc}
|
|
|
|
|
|
|
|
|
|
|
|
|
175 |
*/
|
176 |
public function execute($command)
|
177 |
{
|
186 |
|
187 |
$failureException = null;
|
188 |
$requests = array();
|
189 |
+
$commandRequests = new \SplObjectStorage();
|
190 |
|
191 |
foreach ($command as $c) {
|
192 |
$c->setClient($this);
|
193 |
// Set the state to new if the command was previously executed
|
194 |
$request = $c->prepare()->setState(RequestInterface::STATE_NEW);
|
195 |
+
$commandRequests[$request] = $c;
|
196 |
$requests[] = $request;
|
197 |
$this->dispatch('command.before_send', array('command' => $c));
|
198 |
}
|
199 |
|
200 |
try {
|
201 |
$this->send($requests);
|
202 |
+
foreach ($command as $c) {
|
203 |
+
$this->dispatch('command.after_send', array('command' => $c));
|
|
|
|
|
|
|
|
|
|
|
|
|
204 |
}
|
205 |
+
return $singleCommand ? end($command)->getResult() : $command;
|
206 |
+
} catch (MultiTransferException $failureException) {
|
207 |
|
208 |
+
if ($singleCommand) {
|
209 |
+
// If only sending a single request, then don't use a CommandTransferException
|
210 |
+
throw $failureException->getFirst();
|
211 |
+
}
|
212 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
213 |
// Throw a CommandTransferException using the successful and failed commands
|
214 |
$e = CommandTransferException::fromMultiTransferException($failureException);
|
215 |
+
|
216 |
+
// Remove failed requests from the successful requests array and add to the failures array
|
217 |
+
foreach ($failureException->getFailedRequests() as $request) {
|
218 |
+
if (isset($commandRequests[$request])) {
|
219 |
+
$e->addFailedCommand($commandRequests[$request]);
|
220 |
+
unset($commandRequests[$request]);
|
221 |
+
}
|
222 |
}
|
223 |
+
|
224 |
+
// Always emit the command after_send events for successful commands
|
225 |
+
foreach ($commandRequests as $success) {
|
226 |
+
$e->addSuccessfulCommand($commandRequests[$success]);
|
227 |
+
$this->dispatch('command.after_send', array('command' => $commandRequests[$success]));
|
228 |
}
|
229 |
+
|
230 |
throw $e;
|
231 |
}
|
232 |
}
|
233 |
|
234 |
/**
|
235 |
+
* {@inheritdoc}
|
|
|
|
|
|
|
|
|
|
|
236 |
*/
|
237 |
+
public function setDescription(ServiceDescriptionInterface $service)
|
238 |
{
|
239 |
$this->serviceDescription = $service;
|
240 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
241 |
// If a baseUrl was set on the description, then update the client
|
242 |
if ($baseUrl = $service->getBaseUrl()) {
|
243 |
$this->setBaseUrl($baseUrl);
|
247 |
}
|
248 |
|
249 |
/**
|
250 |
+
* {@inheritdoc}
|
|
|
|
|
251 |
*/
|
252 |
public function getDescription()
|
253 |
{
|
255 |
}
|
256 |
|
257 |
/**
|
258 |
+
* {@inheritdoc}
|
|
|
|
|
|
|
|
|
259 |
*/
|
260 |
public function setInflector(InflectorInterface $inflector)
|
261 |
{
|
265 |
}
|
266 |
|
267 |
/**
|
268 |
+
* {@inheritdoc}
|
|
|
|
|
269 |
*/
|
270 |
public function getInflector()
|
271 |
{
|
277 |
}
|
278 |
|
279 |
/**
|
280 |
+
* {@inheritdoc}
|
|
|
|
|
281 |
*/
|
282 |
protected function getResourceIteratorFactory()
|
283 |
{
|
sdk/Aws/Guzzle/Service/ClientInterface.php
CHANGED
@@ -6,6 +6,7 @@ use Guzzle\Common\FromConfigInterface;
|
|
6 |
use Guzzle\Common\Exception\InvalidArgumentException;
|
7 |
use Guzzle\Inflection\InflectorInterface;
|
8 |
use Guzzle\Http\ClientInterface as HttpClientInterface;
|
|
|
9 |
use Guzzle\Service\Command\CommandInterface;
|
10 |
use Guzzle\Service\Description\ServiceDescriptionInterface;
|
11 |
use Guzzle\Service\Command\Factory\FactoryInterface as CommandFactoryInterface;
|
@@ -18,8 +19,8 @@ use Guzzle\Service\Resource\ResourceIteratorFactoryInterface;
|
|
18 |
interface ClientInterface extends HttpClientInterface, FromConfigInterface
|
19 |
{
|
20 |
/**
|
21 |
-
* Get a command by name.
|
22 |
-
* defines a command by the supplied name.
|
23 |
* command class exists matching the name supplied. If neither are found, an InvalidArgumentException is thrown.
|
24 |
*
|
25 |
* @param string $name Name of the command to retrieve
|
@@ -37,18 +38,18 @@ interface ClientInterface extends HttpClientInterface, FromConfigInterface
|
|
37 |
*
|
38 |
* @return mixed Returns the result of the executed command or an array of commands if executing multiple commands
|
39 |
* @throws InvalidArgumentException if an invalid command is passed
|
|
|
40 |
*/
|
41 |
public function execute($command);
|
42 |
|
43 |
/**
|
44 |
* Set the service description of the client
|
45 |
*
|
46 |
-
* @param ServiceDescriptionInterface $service
|
47 |
-
*
|
48 |
-
* command factory if it is not already on the client.
|
49 |
* @return ClientInterface
|
50 |
*/
|
51 |
-
public function setDescription(ServiceDescriptionInterface $service
|
52 |
|
53 |
/**
|
54 |
* Get the service description of the client
|
6 |
use Guzzle\Common\Exception\InvalidArgumentException;
|
7 |
use Guzzle\Inflection\InflectorInterface;
|
8 |
use Guzzle\Http\ClientInterface as HttpClientInterface;
|
9 |
+
use Guzzle\Service\Exception\CommandTransferException;
|
10 |
use Guzzle\Service\Command\CommandInterface;
|
11 |
use Guzzle\Service\Description\ServiceDescriptionInterface;
|
12 |
use Guzzle\Service\Command\Factory\FactoryInterface as CommandFactoryInterface;
|
19 |
interface ClientInterface extends HttpClientInterface, FromConfigInterface
|
20 |
{
|
21 |
/**
|
22 |
+
* Get a command by name. First, the client will see if it has a service description and if the service description
|
23 |
+
* defines a command by the supplied name. If no dynamic command is found, the client will look for a concrete
|
24 |
* command class exists matching the name supplied. If neither are found, an InvalidArgumentException is thrown.
|
25 |
*
|
26 |
* @param string $name Name of the command to retrieve
|
38 |
*
|
39 |
* @return mixed Returns the result of the executed command or an array of commands if executing multiple commands
|
40 |
* @throws InvalidArgumentException if an invalid command is passed
|
41 |
+
* @throws CommandTransferException if an exception is encountered when transferring multiple commands
|
42 |
*/
|
43 |
public function execute($command);
|
44 |
|
45 |
/**
|
46 |
* Set the service description of the client
|
47 |
*
|
48 |
+
* @param ServiceDescriptionInterface $service Service description
|
49 |
+
*
|
|
|
50 |
* @return ClientInterface
|
51 |
*/
|
52 |
+
public function setDescription(ServiceDescriptionInterface $service);
|
53 |
|
54 |
/**
|
55 |
* Get the service description of the client
|
sdk/Aws/Guzzle/Service/Command/AbstractCommand.php
CHANGED
@@ -289,6 +289,8 @@ abstract class AbstractCommand extends Collection implements CommandInterface
|
|
289 |
if ($responseBody = $this->get(self::RESPONSE_BODY)) {
|
290 |
$this->request->setResponseBody($responseBody);
|
291 |
}
|
|
|
|
|
292 |
}
|
293 |
|
294 |
return $this->request;
|
@@ -372,6 +374,22 @@ abstract class AbstractCommand extends Collection implements CommandInterface
|
|
372 |
}
|
373 |
}
|
374 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
375 |
if (!empty($errors)) {
|
376 |
$e = new ValidationException('Validation errors: ' . implode("\n", $errors));
|
377 |
$e->setErrors($errors);
|
289 |
if ($responseBody = $this->get(self::RESPONSE_BODY)) {
|
290 |
$this->request->setResponseBody($responseBody);
|
291 |
}
|
292 |
+
|
293 |
+
$this->client->dispatch('command.after_prepare', array('command' => $this));
|
294 |
}
|
295 |
|
296 |
return $this->request;
|
374 |
}
|
375 |
}
|
376 |
|
377 |
+
// Validate additional parameters
|
378 |
+
if ($properties = $this->operation->getAdditionalParameters()) {
|
379 |
+
foreach ($this->getAll() as $name => $value) {
|
380 |
+
// It's only additional if it isn't defined in the schema
|
381 |
+
if (!$this->operation->hasParam($name)) {
|
382 |
+
// Always set the name so that error messages are useful
|
383 |
+
$properties->setName($name);
|
384 |
+
if (!$validator->validate($properties, $value)) {
|
385 |
+
$errors = array_merge($errors, $validator->getErrors());
|
386 |
+
} elseif ($value !== $this->get($name)) {
|
387 |
+
$this->data[$name] = $value;
|
388 |
+
}
|
389 |
+
}
|
390 |
+
}
|
391 |
+
}
|
392 |
+
|
393 |
if (!empty($errors)) {
|
394 |
$e = new ValidationException('Validation errors: ' . implode("\n", $errors));
|
395 |
$e->setErrors($errors);
|
sdk/Aws/Guzzle/Service/Command/DefaultRequestSerializer.php
CHANGED
@@ -7,6 +7,8 @@ use Guzzle\Http\Url;
|
|
7 |
use Guzzle\Parser\ParserRegistry;
|
8 |
use Guzzle\Service\Command\LocationVisitor\Request\RequestVisitorInterface;
|
9 |
use Guzzle\Service\Command\LocationVisitor\VisitorFlyweight;
|
|
|
|
|
10 |
|
11 |
/**
|
12 |
* Default request serializer that transforms command options and operation parameters into a request
|
@@ -69,15 +71,14 @@ class DefaultRequestSerializer implements RequestSerializerInterface
|
|
69 |
$request = $this->createRequest($command);
|
70 |
// Keep an array of visitors found in the operation
|
71 |
$foundVisitors = array();
|
|
|
72 |
|
73 |
// Add arguments to the request using the location attribute
|
74 |
-
foreach ($
|
75 |
/** @var $arg \Guzzle\Service\Description\Parameter */
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
continue;
|
80 |
-
}
|
81 |
// Instantiate visitors as they are detected in the properties
|
82 |
if (!isset($foundVisitors[$location])) {
|
83 |
$foundVisitors[$location] = $this->factory->getRequestVisitor($location);
|
@@ -91,6 +92,13 @@ class DefaultRequestSerializer implements RequestSerializerInterface
|
|
91 |
}
|
92 |
}
|
93 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
// Call the after method on each visitor found in the operation
|
95 |
foreach ($foundVisitors as $visitor) {
|
96 |
$visitor->after($command, $request);
|
@@ -99,6 +107,43 @@ class DefaultRequestSerializer implements RequestSerializerInterface
|
|
99 |
return $request;
|
100 |
}
|
101 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
/**
|
103 |
* Create a request for the command and operation
|
104 |
*
|
7 |
use Guzzle\Parser\ParserRegistry;
|
8 |
use Guzzle\Service\Command\LocationVisitor\Request\RequestVisitorInterface;
|
9 |
use Guzzle\Service\Command\LocationVisitor\VisitorFlyweight;
|
10 |
+
use Guzzle\Service\Description\OperationInterface;
|
11 |
+
use Guzzle\Service\Description\Parameter;
|
12 |
|
13 |
/**
|
14 |
* Default request serializer that transforms command options and operation parameters into a request
|
71 |
$request = $this->createRequest($command);
|
72 |
// Keep an array of visitors found in the operation
|
73 |
$foundVisitors = array();
|
74 |
+
$operation = $command->getOperation();
|
75 |
|
76 |
// Add arguments to the request using the location attribute
|
77 |
+
foreach ($operation->getParams() as $name => $arg) {
|
78 |
/** @var $arg \Guzzle\Service\Description\Parameter */
|
79 |
+
$location = $arg->getLocation();
|
80 |
+
// Skip 'uri' locations because they've already been processed
|
81 |
+
if ($location && $location != 'uri') {
|
|
|
|
|
82 |
// Instantiate visitors as they are detected in the properties
|
83 |
if (!isset($foundVisitors[$location])) {
|
84 |
$foundVisitors[$location] = $this->factory->getRequestVisitor($location);
|
92 |
}
|
93 |
}
|
94 |
|
95 |
+
// Serialize additional parameters
|
96 |
+
if ($additional = $operation->getAdditionalParameters()) {
|
97 |
+
if ($visitor = $this->prepareAdditionalParameters($operation, $command, $request, $additional)) {
|
98 |
+
$foundVisitors[$additional->getLocation()] = $visitor;
|
99 |
+
}
|
100 |
+
}
|
101 |
+
|
102 |
// Call the after method on each visitor found in the operation
|
103 |
foreach ($foundVisitors as $visitor) {
|
104 |
$visitor->after($command, $request);
|
107 |
return $request;
|
108 |
}
|
109 |
|
110 |
+
/**
|
111 |
+
* Serialize additional parameters
|
112 |
+
*
|
113 |
+
* @param OperationInterface $operation Operation that owns the command
|
114 |
+
* @param CommandInterface $command Command to prepare
|
115 |
+
* @param RequestInterface $request Request to serialize
|
116 |
+
* @param Parameter $additional Additional parameters
|
117 |
+
*
|
118 |
+
* @return null|RequestVisitorInterface
|
119 |
+
*/
|
120 |
+
protected function prepareAdditionalParameters(
|
121 |
+
OperationInterface $operation,
|
122 |
+
CommandInterface $command,
|
123 |
+
RequestInterface $request,
|
124 |
+
Parameter $additional
|
125 |
+
) {
|
126 |
+
if (!($location = $additional->getLocation())) {
|
127 |
+
return;
|
128 |
+
}
|
129 |
+
|
130 |
+
$visitor = $this->factory->getRequestVisitor($location);
|
131 |
+
|
132 |
+
foreach ($command->getAll() as $key => $value) {
|
133 |
+
// Ignore values that are null or built-in command options
|
134 |
+
if ($value !== null
|
135 |
+
&& $key != 'command.headers'
|
136 |
+
&& $key != 'command.response_processing'
|
137 |
+
&& !$operation->hasParam($key)
|
138 |
+
) {
|
139 |
+
$additional->setName($key);
|
140 |
+
$visitor->visit($command, $request, $additional, $value);
|
141 |
+
}
|
142 |
+
}
|
143 |
+
|
144 |
+
return $visitor;
|
145 |
+
}
|
146 |
+
|
147 |
/**
|
148 |
* Create a request for the command and operation
|
149 |
*
|
sdk/Aws/Guzzle/Service/Command/Factory/CompositeFactory.php
CHANGED
@@ -3,7 +3,6 @@
|
|
3 |
namespace Guzzle\Service\Command\Factory;
|
4 |
|
5 |
use Guzzle\Service\Command\CommandInterface;
|
6 |
-
use Guzzle\Service\Description\ServiceDescriptionInterface;
|
7 |
use Guzzle\Service\ClientInterface;
|
8 |
|
9 |
/**
|
@@ -25,16 +24,13 @@ class CompositeFactory implements \IteratorAggregate, \Countable, FactoryInterfa
|
|
25 |
*/
|
26 |
public static function getDefaultChain(ClientInterface $client)
|
27 |
{
|
28 |
-
$
|
29 |
-
|
30 |
-
|
31 |
-
if ($description instanceof ServiceDescriptionInterface) {
|
32 |
-
$chain->add(new ServiceDescriptionFactory($description));
|
33 |
}
|
|
|
34 |
|
35 |
-
|
36 |
-
|
37 |
-
return $chain;
|
38 |
}
|
39 |
|
40 |
/**
|
3 |
namespace Guzzle\Service\Command\Factory;
|
4 |
|
5 |
use Guzzle\Service\Command\CommandInterface;
|
|
|
6 |
use Guzzle\Service\ClientInterface;
|
7 |
|
8 |
/**
|
24 |
*/
|
25 |
public static function getDefaultChain(ClientInterface $client)
|
26 |
{
|
27 |
+
$factories = array();
|
28 |
+
if ($description = $client->getDescription()) {
|
29 |
+
$factories[] = new ServiceDescriptionFactory($description);
|
|
|
|
|
30 |
}
|
31 |
+
$factories[] = new ConcreteClassFactory($client);
|
32 |
|
33 |
+
return new self($factories);
|
|
|
|
|
34 |
}
|
35 |
|
36 |
/**
|
sdk/Aws/Guzzle/Service/Command/Factory/ServiceDescriptionFactory.php
CHANGED
@@ -61,9 +61,13 @@ class ServiceDescriptionFactory implements FactoryInterface
|
|
61 |
{
|
62 |
$command = $this->description->getOperation($name);
|
63 |
|
64 |
-
// If
|
65 |
-
if (!$command
|
66 |
-
$command = $this->description->getOperation(
|
|
|
|
|
|
|
|
|
67 |
}
|
68 |
|
69 |
if ($command) {
|
61 |
{
|
62 |
$command = $this->description->getOperation($name);
|
63 |
|
64 |
+
// If a command wasn't found, then try to uppercase the first letter and try again
|
65 |
+
if (!$command) {
|
66 |
+
$command = $this->description->getOperation(ucfirst($name));
|
67 |
+
// If an inflector was passed, then attempt to get the command using snake_case inflection
|
68 |
+
if (!$command && $this->inflector) {
|
69 |
+
$command = $this->description->getOperation($this->inflector->snake($name));
|
70 |
+
}
|
71 |
}
|
72 |
|
73 |
if ($command) {
|
sdk/Aws/Guzzle/Service/Command/LocationVisitor/Request/JsonVisitor.php
CHANGED
@@ -49,7 +49,11 @@ class JsonVisitor extends AbstractRequestVisitor
|
|
49 |
*/
|
50 |
public function visit(CommandInterface $command, RequestInterface $request, Parameter $param, $value)
|
51 |
{
|
52 |
-
|
|
|
|
|
|
|
|
|
53 |
$json[$param->getWireName()] = $this->prepareValue($value, $param);
|
54 |
$this->data[$command] = $json;
|
55 |
}
|
@@ -60,9 +64,8 @@ class JsonVisitor extends AbstractRequestVisitor
|
|
60 |
public function after(CommandInterface $command, RequestInterface $request)
|
61 |
{
|
62 |
if (isset($this->data[$command])) {
|
63 |
-
$
|
64 |
unset($this->data[$command]);
|
65 |
-
$request->setBody(json_encode($json));
|
66 |
// Don't overwrite the Content-Type if one is set
|
67 |
if ($this->jsonContentType && !$request->hasHeader('Content-Type')) {
|
68 |
$request->setHeader('Content-Type', $this->jsonContentType);
|
49 |
*/
|
50 |
public function visit(CommandInterface $command, RequestInterface $request, Parameter $param, $value)
|
51 |
{
|
52 |
+
if (isset($this->data[$command])) {
|
53 |
+
$json = $this->data[$command];
|
54 |
+
} else {
|
55 |
+
$json = array();
|
56 |
+
}
|
57 |
$json[$param->getWireName()] = $this->prepareValue($value, $param);
|
58 |
$this->data[$command] = $json;
|
59 |
}
|
64 |
public function after(CommandInterface $command, RequestInterface $request)
|
65 |
{
|
66 |
if (isset($this->data[$command])) {
|
67 |
+
$request->setBody(json_encode($this->data[$command]));
|
68 |
unset($this->data[$command]);
|
|
|
69 |
// Don't overwrite the Content-Type if one is set
|
70 |
if ($this->jsonContentType && !$request->hasHeader('Content-Type')) {
|
71 |
$request->setHeader('Content-Type', $this->jsonContentType);
|
sdk/Aws/Guzzle/Service/Command/LocationVisitor/Request/XmlVisitor.php
CHANGED
@@ -61,9 +61,22 @@ class XmlVisitor extends AbstractRequestVisitor
|
|
61 |
*/
|
62 |
public function after(CommandInterface $command, RequestInterface $request)
|
63 |
{
|
|
|
|
|
|
|
64 |
if (isset($this->data[$command])) {
|
65 |
-
$
|
66 |
unset($this->data[$command]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
// Don't overwrite the Content-Type if one is set
|
68 |
if ($this->contentType && !$request->hasHeader('Content-Type')) {
|
69 |
$request->setHeader('Content-Type', $this->contentType);
|
61 |
*/
|
62 |
public function after(CommandInterface $command, RequestInterface $request)
|
63 |
{
|
64 |
+
$xml = null;
|
65 |
+
|
66 |
+
// If data was found that needs to be serialized, then do so
|
67 |
if (isset($this->data[$command])) {
|
68 |
+
$xml = $this->data[$command]->asXML();
|
69 |
unset($this->data[$command]);
|
70 |
+
} else {
|
71 |
+
// Check if XML should always be sent for the command
|
72 |
+
$operation = $command->getOperation();
|
73 |
+
if ($operation->getData('xmlAllowEmpty')) {
|
74 |
+
$xml = $this->createRootElement($operation)->asXML();
|
75 |
+
}
|
76 |
+
}
|
77 |
+
|
78 |
+
if ($xml) {
|
79 |
+
$request->setBody($xml);
|
80 |
// Don't overwrite the Content-Type if one is set
|
81 |
if ($this->contentType && !$request->hasHeader('Content-Type')) {
|
82 |
$request->setHeader('Content-Type', $this->contentType);
|
sdk/Aws/Guzzle/Service/Command/LocationVisitor/Response/HeaderVisitor.php
CHANGED
@@ -19,7 +19,7 @@ class HeaderVisitor extends AbstractResponseVisitor
|
|
19 |
if ($param->getType() == 'object' && $param->getAdditionalProperties() instanceof Parameter) {
|
20 |
$this->processPrefixedHeaders($response, $param, $value);
|
21 |
} else {
|
22 |
-
$value[$param->getName()] = (string) $response->getHeader($param->getWireName());
|
23 |
}
|
24 |
}
|
25 |
|
19 |
if ($param->getType() == 'object' && $param->getAdditionalProperties() instanceof Parameter) {
|
20 |
$this->processPrefixedHeaders($response, $param, $value);
|
21 |
} else {
|
22 |
+
$value[$param->getName()] = $param->filter((string) $response->getHeader($param->getWireName()));
|
23 |
}
|
24 |
}
|
25 |
|
sdk/Aws/Guzzle/Service/Command/LocationVisitor/Response/JsonVisitor.php
CHANGED
@@ -64,8 +64,13 @@ class JsonVisitor extends AbstractResponseVisitor
|
|
64 |
if ($properties = $param->getProperties()) {
|
65 |
foreach ($properties as $property) {
|
66 |
$name = $property->getName();
|
67 |
-
|
68 |
-
|
|
|
|
|
|
|
|
|
|
|
69 |
}
|
70 |
}
|
71 |
}
|
64 |
if ($properties = $param->getProperties()) {
|
65 |
foreach ($properties as $property) {
|
66 |
$name = $property->getName();
|
67 |
+
$key = $property->getWireName();
|
68 |
+
if (isset($value[$key])) {
|
69 |
+
$this->recursiveProcess($property, $value[$key]);
|
70 |
+
}
|
71 |
+
if ($key != $name) {
|
72 |
+
$value[$name] = $value[$key];
|
73 |
+
unset($value[$key]);
|
74 |
}
|
75 |
}
|
76 |
}
|
sdk/Aws/Guzzle/Service/Command/LocationVisitor/Response/XmlVisitor.php
CHANGED
@@ -33,12 +33,6 @@ class XmlVisitor extends AbstractResponseVisitor
|
|
33 |
$value[$name] = $value[$sentAs];
|
34 |
unset($value[$sentAs]);
|
35 |
}
|
36 |
-
} elseif ($param->getType() == 'array') {
|
37 |
-
// Use a default array when the value is missing
|
38 |
-
$value[$name] = array();
|
39 |
-
} elseif ($param->getType() == 'boolean') {
|
40 |
-
// Use a default value of false when the value is missing
|
41 |
-
$value[$name] = false;
|
42 |
}
|
43 |
}
|
44 |
|
@@ -124,9 +118,6 @@ class XmlVisitor extends AbstractResponseVisitor
|
|
124 |
$value[$name] = $value[$sentAs];
|
125 |
unset($value[$sentAs]);
|
126 |
}
|
127 |
-
} elseif ($property->getType() == 'array') {
|
128 |
-
// Set a default empty array
|
129 |
-
$value[$name] = array();
|
130 |
}
|
131 |
}
|
132 |
}
|
33 |
$value[$name] = $value[$sentAs];
|
34 |
unset($value[$sentAs]);
|
35 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
}
|
37 |
}
|
38 |
|
118 |
$value[$name] = $value[$sentAs];
|
119 |
unset($value[$sentAs]);
|
120 |
}
|
|
|
|
|
|
|
121 |
}
|
122 |
}
|
123 |
}
|
sdk/Aws/Guzzle/Service/Command/OperationResponseParser.php
CHANGED
@@ -8,6 +8,7 @@ use Guzzle\Service\Command\LocationVisitor\Response\ResponseVisitorInterface;
|
|
8 |
use Guzzle\Service\Description\Parameter;
|
9 |
use Guzzle\Service\Description\OperationInterface;
|
10 |
use Guzzle\Service\Description\Operation;
|
|
|
11 |
use Guzzle\Service\Resource\Model;
|
12 |
|
13 |
/**
|
@@ -69,9 +70,21 @@ class OperationResponseParser extends DefaultResponseParser
|
|
69 |
protected function handleParsing(AbstractCommand $command, Response $response, $contentType)
|
70 |
{
|
71 |
$operation = $command->getOperation();
|
72 |
-
$
|
73 |
-
|
74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
|
76 |
if (!$model) {
|
77 |
// Return basic processing if the responseType is not model or the model cannot be found
|
@@ -98,24 +111,54 @@ class OperationResponseParser extends DefaultResponseParser
|
|
98 |
CommandInterface $command,
|
99 |
Response $response
|
100 |
) {
|
101 |
-
// Determine what visitors are associated with the model
|
102 |
$foundVisitors = $result = array();
|
|
|
103 |
|
104 |
-
foreach ($
|
105 |
if ($location = $schema->getLocation()) {
|
106 |
-
|
107 |
-
$foundVisitors[$location]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
}
|
109 |
}
|
110 |
|
111 |
-
|
112 |
-
|
113 |
if ($location = $schema->getLocation()) {
|
114 |
-
// Apply the parameter value with the location visitor
|
115 |
$foundVisitors[$location]->visit($command, $response, $schema, $result);
|
116 |
}
|
117 |
}
|
118 |
|
|
|
119 |
foreach ($foundVisitors as $visitor) {
|
120 |
$visitor->after($command);
|
121 |
}
|
8 |
use Guzzle\Service\Description\Parameter;
|
9 |
use Guzzle\Service\Description\OperationInterface;
|
10 |
use Guzzle\Service\Description\Operation;
|
11 |
+
use Guzzle\Service\Exception\ResponseClassException;
|
12 |
use Guzzle\Service\Resource\Model;
|
13 |
|
14 |
/**
|
70 |
protected function handleParsing(AbstractCommand $command, Response $response, $contentType)
|
71 |
{
|
72 |
$operation = $command->getOperation();
|
73 |
+
$type = $operation->getResponseType();
|
74 |
+
$model = null;
|
75 |
+
|
76 |
+
if ($type == OperationInterface::TYPE_MODEL) {
|
77 |
+
$model = $operation->getServiceDescription()->getModel($operation->getResponseClass());
|
78 |
+
} elseif ($type == OperationInterface::TYPE_CLASS) {
|
79 |
+
$responseClassInterface = __NAMESPACE__ . '\ResponseClassInterface';
|
80 |
+
$className = $operation->getResponseClass();
|
81 |
+
if (!class_exists($className)) {
|
82 |
+
throw new ResponseClassException("{$className} does not exist");
|
83 |
+
} elseif (!method_exists($className, 'fromCommand')) {
|
84 |
+
throw new ResponseClassException("{$className} must implement {$responseClassInterface}");
|
85 |
+
}
|
86 |
+
return $className::fromCommand($command);
|
87 |
+
}
|
88 |
|
89 |
if (!$model) {
|
90 |
// Return basic processing if the responseType is not model or the model cannot be found
|
111 |
CommandInterface $command,
|
112 |
Response $response
|
113 |
) {
|
|
|
114 |
$foundVisitors = $result = array();
|
115 |
+
$props = $model->getProperties();
|
116 |
|
117 |
+
foreach ($props as $schema) {
|
118 |
if ($location = $schema->getLocation()) {
|
119 |
+
// Trigger the before method on the first found visitor of this type
|
120 |
+
if (!isset($foundVisitors[$location])) {
|
121 |
+
$foundVisitors[$location] = $this->factory->getResponseVisitor($location);
|
122 |
+
$foundVisitors[$location]->before($command, $result);
|
123 |
+
}
|
124 |
+
}
|
125 |
+
}
|
126 |
+
|
127 |
+
// Visit additional properties when it is an actual schema
|
128 |
+
if ($additional = $model->getAdditionalProperties()) {
|
129 |
+
if ($additional instanceof Parameter) {
|
130 |
+
// Only visit when a location is specified
|
131 |
+
if ($location = $additional->getLocation()) {
|
132 |
+
if (!isset($foundVisitors[$location])) {
|
133 |
+
$foundVisitors[$location] = $this->factory->getResponseVisitor($location);
|
134 |
+
$foundVisitors[$location]->before($command, $result);
|
135 |
+
}
|
136 |
+
// Only traverse if an array was parsed from the before() visitors
|
137 |
+
if (is_array($result)) {
|
138 |
+
// Find each additional property
|
139 |
+
foreach (array_keys($result) as $key) {
|
140 |
+
// Check if the model actually knows this property. If so, then it is not additional
|
141 |
+
if (!$model->getProperty($key)) {
|
142 |
+
// Set the name to the key so that we can parse it with each visitor
|
143 |
+
$additional->setName($key);
|
144 |
+
$foundVisitors[$location]->visit($command, $response, $additional, $result);
|
145 |
+
}
|
146 |
+
}
|
147 |
+
// Reset the additionalProperties name to null
|
148 |
+
$additional->setName(null);
|
149 |
+
}
|
150 |
+
}
|
151 |
}
|
152 |
}
|
153 |
|
154 |
+
// Apply the parameter value with the location visitor
|
155 |
+
foreach ($props as $schema) {
|
156 |
if ($location = $schema->getLocation()) {
|
|
|
157 |
$foundVisitors[$location]->visit($command, $response, $schema, $result);
|
158 |
}
|
159 |
}
|
160 |
|
161 |
+
// Call the after() method of each found visitor
|
162 |
foreach ($foundVisitors as $visitor) {
|
163 |
$visitor->after($command);
|
164 |
}
|
sdk/Aws/Guzzle/Service/Command/ResponseClassInterface.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Guzzle\Service\Command;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Interface used to accept a completed OperationCommand and parse the result into a specific response type
|
7 |
+
*/
|
8 |
+
interface ResponseClassInterface
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* Create a response model object from a completed command
|
12 |
+
*
|
13 |
+
* @param OperationCommand $command That serialized the request
|
14 |
+
*
|
15 |
+
* @return self
|
16 |
+
*/
|
17 |
+
public static function fromCommand(OperationCommand $command);
|
18 |
+
}
|
sdk/Aws/Guzzle/Service/Description/Operation.php
CHANGED
@@ -20,7 +20,8 @@ class Operation implements OperationInterface
|
|
20 |
protected static $properties = array(
|
21 |
'name' => true, 'httpMethod' => true, 'uri' => true, 'class' => true, 'responseClass' => true,
|
22 |
'responseType' => true, 'responseNotes' => true, 'notes' => true, 'summary' => true, 'documentationUrl' => true,
|
23 |
-
'deprecated' => true, 'data' => true, 'parameters' => true, '
|
|
|
24 |
);
|
25 |
|
26 |
/**
|
@@ -28,6 +29,11 @@ class Operation implements OperationInterface
|
|
28 |
*/
|
29 |
protected $parameters = array();
|
30 |
|
|
|
|
|
|
|
|
|
|
|
31 |
/**
|
32 |
* @var string Name of the command
|
33 |
*/
|
@@ -120,6 +126,8 @@ class Operation implements OperationInterface
|
|
120 |
* error), and 'class' (a custom exception class that would be thrown if the error is
|
121 |
* encountered).
|
122 |
* - data: (array) Any extra data that might be used to help build or serialize the operation
|
|
|
|
|
123 |
*
|
124 |
* @param array $config Array of configuration data
|
125 |
* @param ServiceDescriptionInterface $description Service description used to resolve models if $ref tags are found
|
@@ -162,6 +170,14 @@ class Operation implements OperationInterface
|
|
162 |
}
|
163 |
}
|
164 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
165 |
}
|
166 |
|
167 |
/**
|
@@ -183,6 +199,10 @@ class Operation implements OperationInterface
|
|
183 |
foreach ($this->parameters as $key => $param) {
|
184 |
$result['parameters'][$key] = $param->toArray();
|
185 |
}
|
|
|
|
|
|
|
|
|
186 |
|
187 |
return $result;
|
188 |
}
|
@@ -582,6 +602,32 @@ class Operation implements OperationInterface
|
|
582 |
return $this;
|
583 |
}
|
584 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
585 |
/**
|
586 |
* Infer the response type from the responseClass value
|
587 |
*/
|
20 |
protected static $properties = array(
|
21 |
'name' => true, 'httpMethod' => true, 'uri' => true, 'class' => true, 'responseClass' => true,
|
22 |
'responseType' => true, 'responseNotes' => true, 'notes' => true, 'summary' => true, 'documentationUrl' => true,
|
23 |
+
'deprecated' => true, 'data' => true, 'parameters' => true, 'additionalParameters' => true,
|
24 |
+
'errorResponses' => true
|
25 |
);
|
26 |
|
27 |
/**
|
29 |
*/
|
30 |
protected $parameters = array();
|
31 |
|
32 |
+
/**
|
33 |
+
* @var Parameter Additional parameters schema
|
34 |
+
*/
|
35 |
+
protected $additionalParameters;
|
36 |
+
|
37 |
/**
|
38 |
* @var string Name of the command
|
39 |
*/
|
126 |
* error), and 'class' (a custom exception class that would be thrown if the error is
|
127 |
* encountered).
|
128 |
* - data: (array) Any extra data that might be used to help build or serialize the operation
|
129 |
+
* - additionalParameters: (null|array) Parameter schema to use when an option is passed to the operation that is
|
130 |
+
* not in the schema
|
131 |
*
|
132 |
* @param array $config Array of configuration data
|
133 |
* @param ServiceDescriptionInterface $description Service description used to resolve models if $ref tags are found
|
170 |
}
|
171 |
}
|
172 |
}
|
173 |
+
|
174 |
+
if (isset($config['additionalParameters'])) {
|
175 |
+
if ($config['additionalParameters'] instanceof Parameter) {
|
176 |
+
$this->setadditionalParameters($config['additionalParameters']);
|
177 |
+
} elseif (is_array($config['additionalParameters'])) {
|
178 |
+
$this->setadditionalParameters(new Parameter($config['additionalParameters'], $this->description));
|
179 |
+
}
|
180 |
+
}
|
181 |
}
|
182 |
|
183 |
/**
|
199 |
foreach ($this->parameters as $key => $param) {
|
200 |
$result['parameters'][$key] = $param->toArray();
|
201 |
}
|
202 |
+
// Additional parameters need to be cast to an array
|
203 |
+
if ($this->additionalParameters instanceof Parameter) {
|
204 |
+
$result['additionalParameters'] = $this->additionalParameters->toArray();
|
205 |
+
}
|
206 |
|
207 |
return $result;
|
208 |
}
|
602 |
return $this;
|
603 |
}
|
604 |
|
605 |
+
/**
|
606 |
+
* Get the additionalParameters of the operation
|
607 |
+
*
|
608 |
+
* @return Paramter|null
|
609 |
+
*/
|
610 |
+
public function getAdditionalParameters()
|
611 |
+
{
|
612 |
+
return $this->additionalParameters;
|
613 |
+
}
|
614 |
+
|
615 |
+
/**
|
616 |
+
* Set the additionalParameters of the operation
|
617 |
+
*
|
618 |
+
* @param Parameter|null $parameter Parameter to set
|
619 |
+
*
|
620 |
+
* @return self
|
621 |
+
*/
|
622 |
+
public function setAdditionalParameters($parameter)
|
623 |
+
{
|
624 |
+
if ($this->additionalParameters = $parameter) {
|
625 |
+
$this->additionalParameters->setParent($this);
|
626 |
+
}
|
627 |
+
|
628 |
+
return $this;
|
629 |
+
}
|
630 |
+
|
631 |
/**
|
632 |
* Infer the response type from the responseClass value
|
633 |
*/
|
sdk/Aws/Guzzle/Service/Description/Parameter.php
CHANGED
@@ -11,6 +11,7 @@ class Parameter
|
|
11 |
{
|
12 |
protected $name;
|
13 |
protected $description;
|
|
|
14 |
protected $type;
|
15 |
protected $required;
|
16 |
protected $enum;
|
@@ -34,6 +35,7 @@ class Parameter
|
|
34 |
protected $parent;
|
35 |
protected $ref;
|
36 |
protected $format;
|
|
|
37 |
|
38 |
/**
|
39 |
* Create a new Parameter using an associative array of data. The array can contain the following information:
|
@@ -94,9 +96,13 @@ class Parameter
|
|
94 |
{
|
95 |
if ($description) {
|
96 |
if (isset($data['$ref'])) {
|
97 |
-
// Replace references to models with the actual model data
|
98 |
if ($model = $description->getModel($data['$ref'])) {
|
|
|
|
|
99 |
$data = $model->toArray();
|
|
|
|
|
|
|
100 |
}
|
101 |
} elseif (isset($data['extends'])) {
|
102 |
// If this parameter extends from another parameter then start with the actual data
|
@@ -112,6 +118,7 @@ class Parameter
|
|
112 |
$this->{$key} = $value;
|
113 |
}
|
114 |
|
|
|
115 |
$this->required = (bool) $this->required;
|
116 |
$this->data = (array) $this->data;
|
117 |
|
@@ -119,21 +126,8 @@ class Parameter
|
|
119 |
$this->setFilters((array) $this->filters);
|
120 |
}
|
121 |
|
122 |
-
if ($this->type == 'object') {
|
123 |
-
|
124 |
-
$this->properties = array();
|
125 |
-
foreach ($data['properties'] as $name => $property) {
|
126 |
-
$property['name'] = $name;
|
127 |
-
$this->addProperty(new static($property, $description));
|
128 |
-
}
|
129 |
-
}
|
130 |
-
if ($this->additionalProperties && is_array($this->additionalProperties)) {
|
131 |
-
$this->setAdditionalProperties(new static($this->additionalProperties, $description));
|
132 |
-
} elseif ($this->additionalProperties === null) {
|
133 |
-
$this->additionalProperties = true;
|
134 |
-
}
|
135 |
-
} elseif ($this->type == 'array' && $this->items) {
|
136 |
-
$this->setItems(new static($this->items, $description));
|
137 |
}
|
138 |
}
|
139 |
|
@@ -160,19 +154,24 @@ class Parameter
|
|
160 |
}
|
161 |
}
|
162 |
|
163 |
-
|
164 |
-
$
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
|
|
|
|
|
|
|
|
|
|
170 |
}
|
171 |
}
|
172 |
|
173 |
if ($this->type == 'object' && $this->properties) {
|
174 |
$result['properties'] = array();
|
175 |
-
foreach ($this->
|
176 |
$result['properties'][$name] = $property->toArray();
|
177 |
}
|
178 |
}
|
@@ -707,7 +706,14 @@ class Parameter
|
|
707 |
*/
|
708 |
public function getProperties()
|
709 |
{
|
710 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
711 |
}
|
712 |
|
713 |
/**
|
@@ -719,7 +725,17 @@ class Parameter
|
|
719 |
*/
|
720 |
public function getProperty($name)
|
721 |
{
|
722 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
723 |
}
|
724 |
|
725 |
/**
|
@@ -732,6 +748,7 @@ class Parameter
|
|
732 |
public function removeProperty($name)
|
733 |
{
|
734 |
unset($this->properties[$name]);
|
|
|
735 |
|
736 |
return $this;
|
737 |
}
|
@@ -747,6 +764,7 @@ class Parameter
|
|
747 |
{
|
748 |
$this->properties[$property->getName()] = $property;
|
749 |
$property->setParent($this);
|
|
|
750 |
|
751 |
return $this;
|
752 |
}
|
@@ -758,6 +776,11 @@ class Parameter
|
|
758 |
*/
|
759 |
public function getAdditionalProperties()
|
760 |
{
|
|
|
|
|
|
|
|
|
|
|
761 |
return $this->additionalProperties;
|
762 |
}
|
763 |
|
@@ -771,9 +794,6 @@ class Parameter
|
|
771 |
public function setAdditionalProperties($additional)
|
772 |
{
|
773 |
$this->additionalProperties = $additional;
|
774 |
-
if ($additional instanceof self) {
|
775 |
-
$additional->setParent($this);
|
776 |
-
}
|
777 |
|
778 |
return $this;
|
779 |
}
|
@@ -782,6 +802,8 @@ class Parameter
|
|
782 |
* Set the items data of the parameter
|
783 |
*
|
784 |
* @param Parameter|null $items Items to set
|
|
|
|
|
785 |
*/
|
786 |
public function setItems(Parameter $items = null)
|
787 |
{
|
@@ -799,6 +821,11 @@ class Parameter
|
|
799 |
*/
|
800 |
public function getItems()
|
801 |
{
|
|
|
|
|
|
|
|
|
|
|
802 |
return $this->items;
|
803 |
}
|
804 |
|
11 |
{
|
12 |
protected $name;
|
13 |
protected $description;
|
14 |
+
protected $serviceDescription;
|
15 |
protected $type;
|
16 |
protected $required;
|
17 |
protected $enum;
|
35 |
protected $parent;
|
36 |
protected $ref;
|
37 |
protected $format;
|
38 |
+
protected $propertiesCache = null;
|
39 |
|
40 |
/**
|
41 |
* Create a new Parameter using an associative array of data. The array can contain the following information:
|
96 |
{
|
97 |
if ($description) {
|
98 |
if (isset($data['$ref'])) {
|
|
|
99 |
if ($model = $description->getModel($data['$ref'])) {
|
100 |
+
// The name of the original parameter should override the ref name if one is available
|
101 |
+
$name = empty($data['name']) ? null : $data['name'];
|
102 |
$data = $model->toArray();
|
103 |
+
if ($name) {
|
104 |
+
$data['name'] = $name;
|
105 |
+
}
|
106 |
}
|
107 |
} elseif (isset($data['extends'])) {
|
108 |
// If this parameter extends from another parameter then start with the actual data
|
118 |
$this->{$key} = $value;
|
119 |
}
|
120 |
|
121 |
+
$this->serviceDescription = $description;
|
122 |
$this->required = (bool) $this->required;
|
123 |
$this->data = (array) $this->data;
|
124 |
|
126 |
$this->setFilters((array) $this->filters);
|
127 |
}
|
128 |
|
129 |
+
if ($this->type == 'object' && $this->additionalProperties === null) {
|
130 |
+
$this->additionalProperties = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
}
|
132 |
}
|
133 |
|
154 |
}
|
155 |
}
|
156 |
|
157 |
+
if ($this->default !== null) {
|
158 |
+
$result['default'] = $this->default;
|
159 |
+
}
|
160 |
+
|
161 |
+
if ($this->items !== null) {
|
162 |
+
$result['items'] = $this->getItems()->toArray();
|
163 |
+
}
|
164 |
+
|
165 |
+
if ($this->additionalProperties !== null) {
|
166 |
+
$result['additionalProperties'] = $this->getAdditionalProperties();
|
167 |
+
if ($result['additionalProperties'] instanceof self) {
|
168 |
+
$result['additionalProperties'] = $result['additionalProperties']->toArray();
|
169 |
}
|
170 |
}
|
171 |
|
172 |
if ($this->type == 'object' && $this->properties) {
|
173 |
$result['properties'] = array();
|
174 |
+
foreach ($this->getProperties() as $name => $property) {
|
175 |
$result['properties'][$name] = $property->toArray();
|
176 |
}
|
177 |
}
|
706 |
*/
|
707 |
public function getProperties()
|
708 |
{
|
709 |
+
if (!$this->propertiesCache) {
|
710 |
+
$this->propertiesCache = array();
|
711 |
+
foreach (array_keys($this->properties) as $name) {
|
712 |
+
$this->propertiesCache[$name] = $this->getProperty($name);
|
713 |
+
}
|
714 |
+
}
|
715 |
+
|
716 |
+
return $this->propertiesCache;
|
717 |
}
|
718 |
|
719 |
/**
|
725 |
*/
|
726 |
public function getProperty($name)
|
727 |
{
|
728 |
+
if (!isset($this->properties[$name])) {
|
729 |
+
return null;
|
730 |
+
}
|
731 |
+
|
732 |
+
if (!($this->properties[$name] instanceof self)) {
|
733 |
+
$this->properties[$name]['name'] = $name;
|
734 |
+
$this->properties[$name] = new static($this->properties[$name], $this->serviceDescription);
|
735 |
+
$this->properties[$name]->setParent($this);
|
736 |
+
}
|
737 |
+
|
738 |
+
return $this->properties[$name];
|
739 |
}
|
740 |
|
741 |
/**
|
748 |
public function removeProperty($name)
|
749 |
{
|
750 |
unset($this->properties[$name]);
|
751 |
+
$this->propertiesCache = null;
|
752 |
|
753 |
return $this;
|
754 |
}
|
764 |
{
|
765 |
$this->properties[$property->getName()] = $property;
|
766 |
$property->setParent($this);
|
767 |
+
$this->propertiesCache = null;
|
768 |
|
769 |
return $this;
|
770 |
}
|
776 |
*/
|
777 |
public function getAdditionalProperties()
|
778 |
{
|
779 |
+
if (is_array($this->additionalProperties)) {
|
780 |
+
$this->additionalProperties = new static($this->additionalProperties, $this->serviceDescription);
|
781 |
+
$this->additionalProperties->setParent($this);
|
782 |
+
}
|
783 |
+
|
784 |
return $this->additionalProperties;
|
785 |
}
|
786 |
|
794 |
public function setAdditionalProperties($additional)
|
795 |
{
|
796 |
$this->additionalProperties = $additional;
|
|
|
|
|
|
|
797 |
|
798 |
return $this;
|
799 |
}
|
802 |
* Set the items data of the parameter
|
803 |
*
|
804 |
* @param Parameter|null $items Items to set
|
805 |
+
*
|
806 |
+
* @return self
|
807 |
*/
|
808 |
public function setItems(Parameter $items = null)
|
809 |
{
|
821 |
*/
|
822 |
public function getItems()
|
823 |
{
|
824 |
+
if (is_array($this->items)) {
|
825 |
+
$this->items = new static($this->items, $this->serviceDescription);
|
826 |
+
$this->items->setParent($this);
|
827 |
+
}
|
828 |
+
|
829 |
return $this->items;
|
830 |
}
|
831 |
|
sdk/Aws/Guzzle/Service/Description/SchemaFormatter.php
CHANGED
@@ -141,12 +141,15 @@ class SchemaFormatter
|
|
141 |
*/
|
142 |
protected static function dateFormatter($dateTime, $format)
|
143 |
{
|
144 |
-
if (
|
145 |
-
$dateTime = new \DateTime($dateTime, self::getUtcTimeZone());
|
146 |
-
return $dateTime->format($format);
|
147 |
-
} elseif (is_numeric($dateTime)) {
|
148 |
return gmdate($format, (int) $dateTime);
|
149 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
return $dateTime->setTimezone(self::getUtcTimeZone())->format($format);
|
151 |
}
|
152 |
|
141 |
*/
|
142 |
protected static function dateFormatter($dateTime, $format)
|
143 |
{
|
144 |
+
if (is_numeric($dateTime)) {
|
|
|
|
|
|
|
145 |
return gmdate($format, (int) $dateTime);
|
146 |
+
}
|
147 |
+
|
148 |
+
if (is_string($dateTime)) {
|
149 |
+
$dateTime = new \DateTime($dateTime);
|
150 |
+
}
|
151 |
+
|
152 |
+
if ($dateTime instanceof \DateTime) {
|
153 |
return $dateTime->setTimezone(self::getUtcTimeZone())->format($format);
|
154 |
}
|
155 |
|
sdk/Aws/Guzzle/Service/Description/SchemaValidator.php
CHANGED
@@ -192,7 +192,7 @@ class SchemaValidator implements ValidatorInterface
|
|
192 |
|
193 |
// If the value is required and the type is not null, then there is an error if the value is not set
|
194 |
if ($required && $value === null && $type != 'null') {
|
195 |
-
$message = "{$path} is " . ($param->getType() ? ('a required ' . $param->getType()) : 'required');
|
196 |
if ($param->getDescription()) {
|
197 |
$message .= ': ' . $param->getDescription();
|
198 |
}
|
@@ -252,7 +252,7 @@ class SchemaValidator implements ValidatorInterface
|
|
252 |
}
|
253 |
}
|
254 |
|
255 |
-
} elseif ($type == 'integer' || $type == 'numeric') {
|
256 |
if (($min = $param->getMinimum()) && $value < $min) {
|
257 |
$this->errors[] = "{$path} must be greater than or equal to {$min}";
|
258 |
}
|
@@ -285,6 +285,8 @@ class SchemaValidator implements ValidatorInterface
|
|
285 |
return 'integer';
|
286 |
} elseif ($t == 'boolean' && is_bool($value)) {
|
287 |
return 'boolean';
|
|
|
|
|
288 |
} elseif ($t == 'numeric' && is_numeric($value)) {
|
289 |
return 'numeric';
|
290 |
} elseif ($t == 'null' && !$value) {
|
192 |
|
193 |
// If the value is required and the type is not null, then there is an error if the value is not set
|
194 |
if ($required && $value === null && $type != 'null') {
|
195 |
+
$message = "{$path} is " . ($param->getType() ? ('a required ' . implode(' or ', (array) $param->getType())) : 'required');
|
196 |
if ($param->getDescription()) {
|
197 |
$message .= ': ' . $param->getDescription();
|
198 |
}
|
252 |
}
|
253 |
}
|
254 |
|
255 |
+
} elseif ($type == 'integer' || $type == 'number' || $type == 'numeric') {
|
256 |
if (($min = $param->getMinimum()) && $value < $min) {
|
257 |
$this->errors[] = "{$path} must be greater than or equal to {$min}";
|
258 |
}
|
285 |
return 'integer';
|
286 |
} elseif ($t == 'boolean' && is_bool($value)) {
|
287 |
return 'boolean';
|
288 |
+
} elseif ($t == 'number' && is_numeric($value)) {
|
289 |
+
return 'number';
|
290 |
} elseif ($t == 'numeric' && is_numeric($value)) {
|
291 |
return 'numeric';
|
292 |
} elseif ($t == 'null' && !$value) {
|
sdk/Aws/Guzzle/Service/Description/ServiceDescription.php
CHANGED
@@ -198,7 +198,7 @@ class ServiceDescription implements ServiceDescriptionInterface
|
|
198 |
}
|
199 |
|
200 |
if (!($this->models[$id] instanceof Parameter)) {
|
201 |
-
$this->models[$id] = new Parameter($this->models[$id], $this);
|
202 |
}
|
203 |
|
204 |
return $this->models[$id];
|
198 |
}
|
199 |
|
200 |
if (!($this->models[$id] instanceof Parameter)) {
|
201 |
+
$this->models[$id] = new Parameter($this->models[$id] + array('name' => $id), $this);
|
202 |
}
|
203 |
|
204 |
return $this->models[$id];
|
sdk/Aws/Guzzle/Service/Description/ServiceDescriptionLoader.php
CHANGED
@@ -57,7 +57,7 @@ class ServiceDescriptionLoader extends AbstractConfigLoader
|
|
57 |
? $toArray['parameters']
|
58 |
: array_merge($resolved, $toArray['parameters']);
|
59 |
|
60 |
-
$op =
|
61 |
if (!$hasClass && isset($toArray['class'])) {
|
62 |
$op['class'] = $toArray['class'];
|
63 |
}
|
57 |
? $toArray['parameters']
|
58 |
: array_merge($resolved, $toArray['parameters']);
|
59 |
|
60 |
+
$op = $op + $toArray;
|
61 |
if (!$hasClass && isset($toArray['class'])) {
|
62 |
$op['class'] = $toArray['class'];
|
63 |
}
|
sdk/Aws/Guzzle/Service/Exception/ResponseClassException.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Guzzle\Service\Exception;
|
4 |
+
|
5 |
+
use Guzzle\Common\Exception\RuntimeException;
|
6 |
+
|
7 |
+
class ResponseClassException extends RuntimeException
|
8 |
+
{
|
9 |
+
}
|
sdk/Aws/Guzzle/Service/composer.json
CHANGED
@@ -23,7 +23,7 @@
|
|
23 |
"target-dir": "Guzzle/Service",
|
24 |
"extra": {
|
25 |
"branch-alias": {
|
26 |
-
"dev-master": "3.
|
27 |
}
|
28 |
}
|
29 |
}
|
23 |
"target-dir": "Guzzle/Service",
|
24 |
"extra": {
|
25 |
"branch-alias": {
|
26 |
+
"dev-master": "3.4-dev"
|
27 |
}
|
28 |
}
|
29 |
}
|
sdk/Aws/Guzzle/Stream/PhpStreamRequestFactory.php
ADDED
@@ -0,0 +1,259 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Guzzle\Stream;
|
4 |
+
|
5 |
+
use Guzzle\Common\Exception\InvalidArgumentException;
|
6 |
+
use Guzzle\Common\Exception\RuntimeException;
|
7 |
+
use Guzzle\Http\Message\EntityEnclosingRequestInterface;
|
8 |
+
use Guzzle\Http\Message\RequestInterface;
|
9 |
+
use Guzzle\Http\Url;
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Factory used to create fopen streams using PHP's http and https stream wrappers
|
13 |
+
*
|
14 |
+
* Note: PHP's http stream wrapper only supports streaming downloads. It does not support streaming uploads.
|
15 |
+
*/
|
16 |
+
class PhpStreamRequestFactory implements StreamRequestFactoryInterface
|
17 |
+
{
|
18 |
+
/**
|
19 |
+
* @var resource Stream context options
|
20 |
+
*/
|
21 |
+
protected $context;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* @var array Stream context
|
25 |
+
*/
|
26 |
+
protected $contextOptions;
|
27 |
+
|
28 |
+
/**
|
29 |
+
* @var Url Stream URL
|
30 |
+
*/
|
31 |
+
protected $url;
|
32 |
+
|
33 |
+
/**
|
34 |
+
* @var array Last response headers received by the HTTP request
|
35 |
+
*/
|
36 |
+
protected $lastResponseHeaders;
|
37 |
+
|
38 |
+
/**
|
39 |
+
* {@inheritdoc}
|
40 |
+
*
|
41 |
+
* The $params array can contain the following custom keys specific to the PhpStreamRequestFactory:
|
42 |
+
* - stream_class: The name of a class to create instead of a Guzzle\Stream\Stream object
|
43 |
+
*/
|
44 |
+
public function fromRequest(RequestInterface $request, $context = array(), array $params = array())
|
45 |
+
{
|
46 |
+
if (is_resource($context)) {
|
47 |
+
$this->contextOptions = stream_context_get_options($context);
|
48 |
+
$this->context = $context;
|
49 |
+
} elseif (is_array($context) || !$context) {
|
50 |
+
$this->contextOptions = $context;
|
51 |
+
$this->createContext($params);
|
52 |
+
} elseif ($context) {
|
53 |
+
throw new InvalidArgumentException('$context must be an array or resource');
|
54 |
+
}
|
55 |
+
|
56 |
+
$this->setUrl($request);
|
57 |
+
$this->addDefaultContextOptions($request);
|
58 |
+
$this->addSslOptions($request);
|
59 |
+
$this->addBodyOptions($request);
|
60 |
+
$this->addProxyOptions($request);
|
61 |
+
|
62 |
+
// Dispatch the before send event
|
63 |
+
$request->dispatch('request.before_send', array(
|
64 |
+
'request' => $request,
|
65 |
+
'context' => $this->context,
|
66 |
+
'context_options' => $this->contextOptions
|
67 |
+
));
|
68 |
+
|
69 |
+
// Create the file handle but silence errors
|
70 |
+
return $this->createStream($params)
|
71 |
+
->setCustomData('request', $request)
|
72 |
+
->setCustomData('response_headers', $this->getLastResponseHeaders());
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Set an option on the context and the internal options array
|
77 |
+
*
|
78 |
+
* @param string $wrapper Stream wrapper name of http
|
79 |
+
* @param string $name Context name
|
80 |
+
* @param mixed $value Context value
|
81 |
+
* @param bool $overwrite Set to true to overwrite an existing value
|
82 |
+
*/
|
83 |
+
protected function setContextValue($wrapper, $name, $value, $overwrite = false)
|
84 |
+
{
|
85 |
+
if (!isset($this->contextOptions[$wrapper])) {
|
86 |
+
$this->contextOptions[$wrapper] = array($name => $value);
|
87 |
+
} elseif (!$overwrite && isset($this->contextOptions[$wrapper][$name])) {
|
88 |
+
return;
|
89 |
+
}
|
90 |
+
$this->contextOptions[$wrapper][$name] = $value;
|
91 |
+
stream_context_set_option($this->context, $wrapper, $name, $value);
|
92 |
+
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Create a stream context
|
96 |
+
*
|
97 |
+
* @param array $params Parameter array
|
98 |
+
*/
|
99 |
+
protected function createContext(array $params)
|
100 |
+
{
|
101 |
+
$options = $this->contextOptions;
|
102 |
+
$this->context = $this->createResource(function () use ($params, $options) {
|
103 |
+
return stream_context_create($options, $params);
|
104 |
+
});
|
105 |
+
}
|
106 |
+
|
107 |
+
/**
|
108 |
+
* Get the last response headers received by the HTTP request
|
109 |
+
*
|
110 |
+
* @return array
|
111 |
+
*/
|
112 |
+
public function getLastResponseHeaders()
|
113 |
+
{
|
114 |
+
return $this->lastResponseHeaders;
|
115 |
+
}
|
116 |
+
|
117 |
+
/**
|
118 |
+
* Adds the default context options to the stream context options
|
119 |
+
*
|
120 |
+
* @param RequestInterface $request Request
|
121 |
+
*/
|
122 |
+
protected function addDefaultContextOptions(RequestInterface $request)
|
123 |
+
{
|
124 |
+
$this->setContextValue('http', 'method', $request->getMethod());
|
125 |
+
$this->setContextValue('http', 'header', $request->getHeaderLines());
|
126 |
+
// Force 1.0 for now until PHP fully support chunked transfer-encoding decoding
|
127 |
+
$this->setContextValue('http', 'protocol_version', '1.0');
|
128 |
+
$this->setContextValue('http', 'ignore_errors', true);
|
129 |
+
}
|
130 |
+
|
131 |
+
/**
|
132 |
+
* Set the URL to use with the factory
|
133 |
+
*
|
134 |
+
* @param RequestInterface $request Request that owns the URL
|
135 |
+
*/
|
136 |
+
protected function setUrl(RequestInterface $request)
|
137 |
+
{
|
138 |
+
$this->url = $request->getUrl(true);
|
139 |
+
|
140 |
+
// Check for basic Auth username
|
141 |
+
if ($request->getUsername()) {
|
142 |
+
$this->url->setUsername($request->getUsername());
|
143 |
+
}
|
144 |
+
|
145 |
+
// Check for basic Auth password
|
146 |
+
if ($request->getPassword()) {
|
147 |
+
$this->url->setPassword($request->getPassword());
|
148 |
+
}
|
149 |
+
}
|
150 |
+
|
151 |
+
/**
|
152 |
+
* Add SSL options to the stream context
|
153 |
+
*
|
154 |
+
* @param RequestInterface $request Request
|
155 |
+
*/
|
156 |
+
protected function addSslOptions(RequestInterface $request)
|
157 |
+
{
|
158 |
+
if ($verify = $request->getCurlOptions()->get(CURLOPT_SSL_VERIFYPEER)) {
|
159 |
+
$this->setContextValue('ssl', 'verify_peer', true, true);
|
160 |
+
if ($cafile = $request->getCurlOptions()->get(CURLOPT_CAINFO)) {
|
161 |
+
$this->setContextValue('ssl', 'cafile', $cafile, true);
|
162 |
+
}
|
163 |
+
} else {
|
164 |
+
$this->setContextValue('ssl', 'verify_peer', false, true);
|
165 |
+
}
|
166 |
+
}
|
167 |
+
|
168 |
+
/**
|
169 |
+
* Add body (content) specific options to the context options
|
170 |
+
*
|
171 |
+
* @param RequestInterface $request
|
172 |
+
*/
|
173 |
+
protected function addBodyOptions(RequestInterface $request)
|
174 |
+
{
|
175 |
+
// Add the content for the request if needed
|
176 |
+
if (!($request instanceof EntityEnclosingRequestInterface)) {
|
177 |
+
return;
|
178 |
+
}
|
179 |
+
|
180 |
+
if (count($request->getPostFields())) {
|
181 |
+
$this->setContextValue('http', 'content', (string) $request->getPostFields(), true);
|
182 |
+
} elseif ($request->getBody()) {
|
183 |
+
$this->setContextValue('http', 'content', (string) $request->getBody(), true);
|
184 |
+
}
|
185 |
+
|
186 |
+
// Always ensure a content-length header is sent
|
187 |
+
if (isset($this->contextOptions['http']['content'])) {
|
188 |
+
$headers = isset($this->contextOptions['http']['header']) ? $this->contextOptions['http']['header'] : array();
|
189 |
+
$headers[] = 'Content-Length: ' . strlen($this->contextOptions['http']['content']);
|
190 |
+
$this->setContextValue('http', 'header', $headers, true);
|
191 |
+
}
|
192 |
+
}
|
193 |
+
|
194 |
+
/**
|
195 |
+
* Add proxy parameters to the context if needed
|
196 |
+
*
|
197 |
+
* @param RequestInterface $request Request
|
198 |
+
*/
|
199 |
+
protected function addProxyOptions(RequestInterface $request)
|
200 |
+
{
|
201 |
+
if ($proxy = $request->getCurlOptions()->get(CURLOPT_PROXY)) {
|
202 |
+
$this->setContextValue('http', 'proxy', $proxy);
|
203 |
+
}
|
204 |
+
}
|
205 |
+
|
206 |
+
/**
|
207 |
+
* Create the stream for the request with the context options
|
208 |
+
*
|
209 |
+
* @param array $params Parameters of the stream
|
210 |
+
*
|
211 |
+
* @return StreamInterface
|
212 |
+
*/
|
213 |
+
protected function createStream(array $params)
|
214 |
+
{
|
215 |
+
$http_response_header = null;
|
216 |
+
$url = $this->url;
|
217 |
+
$context = $this->context;
|
218 |
+
$fp = $this->createResource(function () use ($context, $url, &$http_response_header) {
|
219 |
+
return fopen((string) $url, 'r', false, $context);
|
220 |
+
});
|
221 |
+
|
222 |
+
// Track the response headers of the request
|
223 |
+
if (isset($http_response_header)) {
|
224 |
+
$this->lastResponseHeaders = $http_response_header;
|
225 |
+
}
|
226 |
+
|
227 |
+
// Determine the class to instantiate
|
228 |
+
$className = isset($params['stream_class']) ? $params['stream_class'] : __NAMESPACE__ . '\\Stream';
|
229 |
+
|
230 |
+
return new $className($fp);
|
231 |
+
}
|
232 |
+
|
233 |
+
/**
|
234 |
+
* Create a resource and check to ensure it was created successfully
|
235 |
+
*
|
236 |
+
* @param callable $callback Closure to invoke that must return a valid resource
|
237 |
+
*
|
238 |
+
* @return resource
|
239 |
+
* @throws RuntimeException on error
|
240 |
+
*/
|
241 |
+
protected function createResource($callback)
|
242 |
+
{
|
243 |
+
// Turn off error reporting while we try to initiate the request
|
244 |
+
$level = error_reporting(0);
|
245 |
+
$resource = call_user_func($callback);
|
246 |
+
error_reporting($level);
|
247 |
+
|
248 |
+
// If the resource could not be created, then grab the last error and throw an exception
|
249 |
+
if (false === $resource) {
|
250 |
+
$message = 'Error creating resource. ';
|
251 |
+
foreach (error_get_last() as $key => $value) {
|
252 |
+
$message .= "[{$key}] {$value} ";
|
253 |
+
}
|
254 |
+
throw new RuntimeException(trim($message));
|
255 |
+
}
|
256 |
+
|
257 |
+
return $resource;
|
258 |
+
}
|
259 |
+
}
|
sdk/Aws/Guzzle/Stream/Stream.php
CHANGED
@@ -31,6 +31,11 @@ class Stream implements StreamInterface
|
|
31 |
*/
|
32 |
protected $cache = array();
|
33 |
|
|
|
|
|
|
|
|
|
|
|
34 |
/**
|
35 |
* @var array Hash table of readable and writeable stream types for fast lookups
|
36 |
*/
|
@@ -38,12 +43,12 @@ class Stream implements StreamInterface
|
|
38 |
'read' => array(
|
39 |
'r' => true, 'w+' => true, 'r+' => true, 'x+' => true, 'c+' => true,
|
40 |
'rb' => true, 'w+b' => true, 'r+b' => true, 'x+b' => true, 'c+b' => true,
|
41 |
-
'rt' => true, 'w+t' => true, 'r+t' => true, 'x+t' => true, 'c+t' => true
|
42 |
),
|
43 |
'write' => array(
|
44 |
'w' => true, 'w+' => true, 'rw' => true, 'r+' => true, 'x+' => true, 'c+' => true,
|
45 |
-
'w+b' => true, 'r+b' => true, 'x+b' => true, 'c+b' => true,
|
46 |
-
'w+t' => true, 'r+t' => true, 'x+t' => true, 'c+t' => true
|
47 |
)
|
48 |
);
|
49 |
|
@@ -65,9 +70,7 @@ class Stream implements StreamInterface
|
|
65 |
*/
|
66 |
public function __destruct()
|
67 |
{
|
68 |
-
|
69 |
-
fclose($this->stream);
|
70 |
-
}
|
71 |
}
|
72 |
|
73 |
/**
|
@@ -86,6 +89,18 @@ class Stream implements StreamInterface
|
|
86 |
return $body;
|
87 |
}
|
88 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
/**
|
90 |
* Calculate a hash of a Stream
|
91 |
*
|
@@ -103,7 +118,7 @@ class Stream implements StreamInterface
|
|
103 |
}
|
104 |
|
105 |
$ctx = hash_init($algo);
|
106 |
-
while ($data = $stream->read(
|
107 |
hash_update($ctx, $data);
|
108 |
}
|
109 |
|
@@ -188,9 +203,13 @@ class Stream implements StreamInterface
|
|
188 |
return $this->size;
|
189 |
}
|
190 |
|
191 |
-
// If the stream is a file based stream and local, then
|
192 |
-
if ($this->isLocal()
|
193 |
-
|
|
|
|
|
|
|
|
|
194 |
}
|
195 |
|
196 |
// Only get the size based on the content if the the stream is readable and seekable
|
@@ -228,6 +247,14 @@ class Stream implements StreamInterface
|
|
228 |
return feof($this->stream);
|
229 |
}
|
230 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
231 |
/**
|
232 |
* {@inheritdoc}
|
233 |
*/
|
@@ -280,7 +307,11 @@ class Stream implements StreamInterface
|
|
280 |
}
|
281 |
|
282 |
$bytes = fwrite($this->stream, $string);
|
283 |
-
|
|
|
|
|
|
|
|
|
284 |
|
285 |
return $bytes;
|
286 |
}
|
@@ -301,14 +332,43 @@ class Stream implements StreamInterface
|
|
301 |
return $this->seek(0);
|
302 |
}
|
303 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
304 |
/**
|
305 |
* Reprocess stream metadata
|
306 |
*/
|
307 |
protected function rebuildCache()
|
308 |
{
|
309 |
$this->cache = stream_get_meta_data($this->stream);
|
310 |
-
$this->cache[self::STREAM_TYPE] = strtolower($this->cache[self::STREAM_TYPE]);
|
311 |
-
$this->cache[self::WRAPPER_TYPE] = strtolower($this->cache[self::WRAPPER_TYPE]);
|
312 |
$this->cache[self::IS_LOCAL] = stream_is_local($this->stream);
|
313 |
$this->cache[self::IS_READABLE] = isset(self::$readWriteHash['read'][$this->cache['mode']]);
|
314 |
$this->cache[self::IS_WRITABLE] = isset(self::$readWriteHash['write'][$this->cache['mode']]);
|
31 |
*/
|
32 |
protected $cache = array();
|
33 |
|
34 |
+
/**
|
35 |
+
* @var array Custom stream data
|
36 |
+
*/
|
37 |
+
protected $customData = array();
|
38 |
+
|
39 |
/**
|
40 |
* @var array Hash table of readable and writeable stream types for fast lookups
|
41 |
*/
|
43 |
'read' => array(
|
44 |
'r' => true, 'w+' => true, 'r+' => true, 'x+' => true, 'c+' => true,
|
45 |
'rb' => true, 'w+b' => true, 'r+b' => true, 'x+b' => true, 'c+b' => true,
|
46 |
+
'rt' => true, 'w+t' => true, 'r+t' => true, 'x+t' => true, 'c+t' => true, 'a+' => true
|
47 |
),
|
48 |
'write' => array(
|
49 |
'w' => true, 'w+' => true, 'rw' => true, 'r+' => true, 'x+' => true, 'c+' => true,
|
50 |
+
'wb' => true, 'w+b' => true, 'r+b' => true, 'x+b' => true, 'c+b' => true,
|
51 |
+
'w+t' => true, 'r+t' => true, 'x+t' => true, 'c+t' => true, 'a' => true, 'a+' => true
|
52 |
)
|
53 |
);
|
54 |
|
70 |
*/
|
71 |
public function __destruct()
|
72 |
{
|
73 |
+
$this->close();
|
|
|
|
|
74 |
}
|
75 |
|
76 |
/**
|
89 |
return $body;
|
90 |
}
|
91 |
|
92 |
+
/**
|
93 |
+
* {@inheritdoc}
|
94 |
+
*/
|
95 |
+
public function close()
|
96 |
+
{
|
97 |
+
if (is_resource($this->stream)) {
|
98 |
+
fclose($this->stream);
|
99 |
+
}
|
100 |
+
$this->cache[self::IS_READABLE] = false;
|
101 |
+
$this->cache[self::IS_WRITABLE] = false;
|
102 |
+
}
|
103 |
+
|
104 |
/**
|
105 |
* Calculate a hash of a Stream
|
106 |
*
|
118 |
}
|
119 |
|
120 |
$ctx = hash_init($algo);
|
121 |
+
while ($data = $stream->read(8192)) {
|
122 |
hash_update($ctx, $data);
|
123 |
}
|
124 |
|
203 |
return $this->size;
|
204 |
}
|
205 |
|
206 |
+
// If the stream is a file based stream and local, then use fstat
|
207 |
+
if ($this->isLocal()) {
|
208 |
+
clearstatcache(true, $this->getUri());
|
209 |
+
$stats = fstat($this->stream);
|
210 |
+
if (isset($stats['size'])) {
|
211 |
+
return $stats['size'];
|
212 |
+
}
|
213 |
}
|
214 |
|
215 |
// Only get the size based on the content if the the stream is readable and seekable
|
247 |
return feof($this->stream);
|
248 |
}
|
249 |
|
250 |
+
/**
|
251 |
+
* {@inheritdoc}
|
252 |
+
*/
|
253 |
+
public function feof()
|
254 |
+
{
|
255 |
+
return $this->isConsumed();
|
256 |
+
}
|
257 |
+
|
258 |
/**
|
259 |
* {@inheritdoc}
|
260 |
*/
|
307 |
}
|
308 |
|
309 |
$bytes = fwrite($this->stream, $string);
|
310 |
+
|
311 |
+
// We can't know the size after writing if any bytes were written
|
312 |
+
if ($bytes) {
|
313 |
+
$this->size = null;
|
314 |
+
}
|
315 |
|
316 |
return $bytes;
|
317 |
}
|
332 |
return $this->seek(0);
|
333 |
}
|
334 |
|
335 |
+
/**
|
336 |
+
* {@inheritdoc}
|
337 |
+
*/
|
338 |
+
public function readLine($maxLength = null)
|
339 |
+
{
|
340 |
+
if (!$this->cache[self::IS_READABLE]) {
|
341 |
+
return false;
|
342 |
+
} else {
|
343 |
+
return $maxLength ? fgets($this->getStream(), $maxLength) : fgets($this->getStream());
|
344 |
+
}
|
345 |
+
}
|
346 |
+
|
347 |
+
/**
|
348 |
+
* {@inheritdoc}
|
349 |
+
*/
|
350 |
+
public function setCustomData($key, $value)
|
351 |
+
{
|
352 |
+
$this->customData[$key] = $value;
|
353 |
+
|
354 |
+
return $this;
|
355 |
+
}
|
356 |
+
|
357 |
+
/**
|
358 |
+
* {@inheritdoc}
|
359 |
+
*/
|
360 |
+
public function getCustomData($key)
|
361 |
+
{
|
362 |
+
return isset($this->customData[$key]) ? $this->customData[$key] : null;
|
363 |
+
}
|
364 |
+
|
365 |
+
|
366 |
/**
|
367 |
* Reprocess stream metadata
|
368 |
*/
|
369 |
protected function rebuildCache()
|
370 |
{
|
371 |
$this->cache = stream_get_meta_data($this->stream);
|
|
|
|
|
372 |
$this->cache[self::IS_LOCAL] = stream_is_local($this->stream);
|
373 |
$this->cache[self::IS_READABLE] = isset(self::$readWriteHash['read'][$this->cache['mode']]);
|
374 |
$this->cache[self::IS_WRITABLE] = isset(self::$readWriteHash['write'][$this->cache['mode']]);
|
sdk/Aws/Guzzle/Stream/StreamInterface.php
CHANGED
@@ -14,6 +14,11 @@ interface StreamInterface
|
|
14 |
*/
|
15 |
public function __toString();
|
16 |
|
|
|
|
|
|
|
|
|
|
|
17 |
/**
|
18 |
* Get stream metadata
|
19 |
*
|
@@ -50,7 +55,7 @@ interface StreamInterface
|
|
50 |
/**
|
51 |
* Wrapper specific data attached to this stream.
|
52 |
*
|
53 |
-
* @return
|
54 |
*/
|
55 |
public function getWrapperData();
|
56 |
|
@@ -96,6 +101,13 @@ interface StreamInterface
|
|
96 |
*/
|
97 |
public function isConsumed();
|
98 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
/**
|
100 |
* Check if the stream is a local stream vs a remote stream
|
101 |
*
|
@@ -115,7 +127,7 @@ interface StreamInterface
|
|
115 |
*
|
116 |
* @param int $size Size of the stream contents in bytes
|
117 |
*
|
118 |
-
* @return
|
119 |
*/
|
120 |
public function setSize($size);
|
121 |
|
@@ -161,4 +173,32 @@ interface StreamInterface
|
|
161 |
* @return bool Returns true on success or false on failure
|
162 |
*/
|
163 |
public function rewind();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
164 |
}
|
14 |
*/
|
15 |
public function __toString();
|
16 |
|
17 |
+
/**
|
18 |
+
* Close the underlying stream
|
19 |
+
*/
|
20 |
+
public function close();
|
21 |
+
|
22 |
/**
|
23 |
* Get stream metadata
|
24 |
*
|
55 |
/**
|
56 |
* Wrapper specific data attached to this stream.
|
57 |
*
|
58 |
+
* @return array
|
59 |
*/
|
60 |
public function getWrapperData();
|
61 |
|
101 |
*/
|
102 |
public function isConsumed();
|
103 |
|
104 |
+
/**
|
105 |
+
* Alias of isConsumed
|
106 |
+
*
|
107 |
+
* @return bool
|
108 |
+
*/
|
109 |
+
public function feof();
|
110 |
+
|
111 |
/**
|
112 |
* Check if the stream is a local stream vs a remote stream
|
113 |
*
|
127 |
*
|
128 |
* @param int $size Size of the stream contents in bytes
|
129 |
*
|
130 |
+
* @return self
|
131 |
*/
|
132 |
public function setSize($size);
|
133 |
|
173 |
* @return bool Returns true on success or false on failure
|
174 |
*/
|
175 |
public function rewind();
|
176 |
+
|
177 |
+
/**
|
178 |
+
* Read a line from the stream up to the maximum allowed buffer length
|
179 |
+
*
|
180 |
+
* @param int $maxLength Maximum buffer length
|
181 |
+
*
|
182 |
+
* @return string|bool
|
183 |
+
*/
|
184 |
+
public function readLine($maxLength = null);
|
185 |
+
|
186 |
+
/**
|
187 |
+
* Set custom data on the stream
|
188 |
+
*
|
189 |
+
* @param string $key Key to set
|
190 |
+
* @param mixed $value Value to set
|
191 |
+
*
|
192 |
+
* @return self
|
193 |
+
*/
|
194 |
+
public function setCustomData($key, $value);
|
195 |
+
|
196 |
+
/**
|
197 |
+
* Get custom data from the stream
|
198 |
+
*
|
199 |
+
* @param string $key Key to retrieve
|
200 |
+
*
|
201 |
+
* @return null|mixed
|
202 |
+
*/
|
203 |
+
public function getCustomData($key);
|
204 |
}
|
sdk/Aws/Guzzle/Stream/StreamRequestFactoryInterface.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Guzzle\Stream;
|
4 |
+
|
5 |
+
use Guzzle\Http\Message\RequestInterface;
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Interface used for creating streams from requests
|
9 |
+
*/
|
10 |
+
interface StreamRequestFactoryInterface
|
11 |
+
{
|
12 |
+
/**
|
13 |
+
* Create a stream based on a request object
|
14 |
+
*
|
15 |
+
* @param RequestInterface $request Base the stream on a request
|
16 |
+
* @param array|resource $context A stream_context_options resource or array of parameters used to create a
|
17 |
+
* stream context.
|
18 |
+
* @param array $params Optional array of parameters specific to the factory
|
19 |
+
*
|
20 |
+
* @return StreamInterface Returns a stream object
|
21 |
+
* @throws \Guzzle\Common\Exception\RuntimeException if the stream cannot be opened or an error occurs
|
22 |
+
*/
|
23 |
+
public function fromRequest(RequestInterface $request, $context = array(), array $params = array());
|
24 |
+
}
|
sdk/Aws/Guzzle/Stream/composer.json
CHANGED
@@ -15,13 +15,16 @@
|
|
15 |
"php": ">=5.3.2",
|
16 |
"guzzle/common": "self.version"
|
17 |
},
|
|
|
|
|
|
|
18 |
"autoload": {
|
19 |
"psr-0": { "Guzzle\\Stream": "" }
|
20 |
},
|
21 |
"target-dir": "Guzzle/Stream",
|
22 |
"extra": {
|
23 |
"branch-alias": {
|
24 |
-
"dev-master": "3.
|
25 |
}
|
26 |
}
|
27 |
}
|
15 |
"php": ">=5.3.2",
|
16 |
"guzzle/common": "self.version"
|
17 |
},
|
18 |
+
"suggest": {
|
19 |
+
"guzzle/http": "To convert Guzzle request objects to PHP streams"
|
20 |
+
},
|
21 |
"autoload": {
|
22 |
"psr-0": { "Guzzle\\Stream": "" }
|
23 |
},
|
24 |
"target-dir": "Guzzle/Stream",
|
25 |
"extra": {
|
26 |
"branch-alias": {
|
27 |
+
"dev-master": "3.4-dev"
|
28 |
}
|
29 |
}
|
30 |
}
|
sdk/Aws/Symfony/Component/ClassLoader/ApcClassLoader.php
ADDED
@@ -0,0 +1,137 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of the Symfony package.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier <fabien@symfony.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Symfony\Component\ClassLoader;
|
13 |
+
|
14 |
+
/**
|
15 |
+
* ApcClassLoader implements a wrapping autoloader cached in APC for PHP 5.3.
|
16 |
+
*
|
17 |
+
* It expects an object implementing a findFile method to find the file. This
|
18 |
+
* allow using it as a wrapper around the other loaders of the component (the
|
19 |
+
* ClassLoader and the UniversalClassLoader for instance) but also around any
|
20 |
+
* other autoloader following this convention (the Composer one for instance)
|
21 |
+
*
|
22 |
+
* $loader = new ClassLoader();
|
23 |
+
*
|
24 |
+
* // register classes with namespaces
|
25 |
+
* $loader->add('Symfony\Component', __DIR__.'/component');
|
26 |
+
* $loader->add('Symfony', __DIR__.'/framework');
|
27 |
+
*
|
28 |
+
* $cachedLoader = new ApcClassLoader('my_prefix', $loader);
|
29 |
+
*
|
30 |
+
* // activate the cached autoloader
|
31 |
+
* $cachedLoader->register();
|
32 |
+
*
|
33 |
+
* // eventually deactivate the non-cached loader if it was registered previously
|
34 |
+
* // to be sure to use the cached one.
|
35 |
+
* $loader->unregister();
|
36 |
+
*
|
37 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
38 |
+
* @author Kris Wallsmith <kris@symfony.com>
|
39 |
+
*
|
40 |
+
* @api
|
41 |
+
*/
|
42 |
+
class ApcClassLoader
|
43 |
+
{
|
44 |
+
private $prefix;
|
45 |
+
|
46 |
+
/**
|
47 |
+
* The class loader object being decorated.
|
48 |
+
*
|
49 |
+
* @var \Symfony\Component\ClassLoader\ClassLoader
|
50 |
+
* A class loader object that implements the findFile() method.
|
51 |
+
*/
|
52 |
+
protected $decorated;
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Constructor.
|
56 |
+
*
|
57 |
+
* @param string $prefix The APC namespace prefix to use.
|
58 |
+
* @param object $decorated A class loader object that implements the findFile() method.
|
59 |
+
*
|
60 |
+
* @throws \RuntimeException
|
61 |
+
* @throws \InvalidArgumentException
|
62 |
+
*
|
63 |
+
* @api
|
64 |
+
*/
|
65 |
+
public function __construct($prefix, $decorated)
|
66 |
+
{
|
67 |
+
if (!extension_loaded('apc')) {
|
68 |
+
throw new \RuntimeException('Unable to use ApcClassLoader as APC is not enabled.');
|
69 |
+
}
|
70 |
+
|
71 |
+
if (!method_exists($decorated, 'findFile')) {
|
72 |
+
throw new \InvalidArgumentException('The class finder must implement a "findFile" method.');
|
73 |
+
}
|
74 |
+
|
75 |
+
$this->prefix = $prefix;
|
76 |
+
$this->decorated = $decorated;
|
77 |
+
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* Registers this instance as an autoloader.
|
81 |
+
*
|
82 |
+
* @param Boolean $prepend Whether to prepend the autoloader or not
|
83 |
+
*/
|
84 |
+
public function register($prepend = false)
|
85 |
+
{
|
86 |
+
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Unregisters this instance as an autoloader.
|
91 |
+
*/
|
92 |
+
public function unregister()
|
93 |
+
{
|
94 |
+
spl_autoload_unregister(array($this, 'loadClass'));
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Loads the given class or interface.
|
99 |
+
*
|
100 |
+
* @param string $class The name of the class
|
101 |
+
*
|
102 |
+
* @return Boolean|null True, if loaded
|
103 |
+
*/
|
104 |
+
public function loadClass($class)
|
105 |
+
{
|
106 |
+
if ($file = $this->findFile($class)) {
|
107 |
+
require $file;
|
108 |
+
|
109 |
+
return true;
|
110 |
+
}
|
111 |
+
}
|
112 |
+
|
113 |
+
/**
|
114 |
+
* Finds a file by class name while caching lookups to APC.
|
115 |
+
*
|
116 |
+
* @param string $class A class name to resolve to file
|
117 |
+
*
|
118 |
+
* @return string|null
|
119 |
+
*/
|
120 |
+
public function findFile($class)
|
121 |
+
{
|
122 |
+
if (false === $file = apc_fetch($this->prefix.$class)) {
|
123 |
+
apc_store($this->prefix.$class, $file = $this->decorated->findFile($class));
|
124 |
+
}
|
125 |
+
|
126 |
+
return $file;
|
127 |
+
}
|
128 |
+
|
129 |
+
/**
|
130 |
+
* Passes through all unknown calls onto the decorated object.
|
131 |
+
*/
|
132 |
+
public function __call($method, $args)
|
133 |
+
{
|
134 |
+
return call_user_func_array(array($this->decorated, $method), $args);
|
135 |
+
}
|
136 |
+
|
137 |
+
}
|
sdk/Aws/Symfony/Component/ClassLoader/ApcUniversalClassLoader.php
ADDED
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of the Symfony package.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier <fabien@symfony.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Symfony\Component\ClassLoader;
|
13 |
+
|
14 |
+
/**
|
15 |
+
* ApcUniversalClassLoader implements a "universal" autoloader cached in APC for PHP 5.3.
|
16 |
+
*
|
17 |
+
* It is able to load classes that use either:
|
18 |
+
*
|
19 |
+
* * The technical interoperability standards for PHP 5.3 namespaces and
|
20 |
+
* class names (https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md);
|
21 |
+
*
|
22 |
+
* * The PEAR naming convention for classes (http://pear.php.net/).
|
23 |
+
*
|
24 |
+
* Classes from a sub-namespace or a sub-hierarchy of PEAR classes can be
|
25 |
+
* looked for in a list of locations to ease the vendoring of a sub-set of
|
26 |
+
* classes for large projects.
|
27 |
+
*
|
28 |
+
* Example usage:
|
29 |
+
*
|
30 |
+
* require 'vendor/symfony/src/Symfony/Component/ClassLoader/UniversalClassLoader.php';
|
31 |
+
* require 'vendor/symfony/src/Symfony/Component/ClassLoader/ApcUniversalClassLoader.php';
|
32 |
+
*
|
33 |
+
* use Symfony\Component\ClassLoader\ApcUniversalClassLoader;
|
34 |
+
*
|
35 |
+
* $loader = new ApcUniversalClassLoader('apc.prefix.');
|
36 |
+
*
|
37 |
+
* // register classes with namespaces
|
38 |
+
* $loader->registerNamespaces(array(
|
39 |
+
* 'Symfony\Component' => __DIR__.'/component',
|
40 |
+
* 'Symfony' => __DIR__.'/framework',
|
41 |
+
* 'Sensio' => array(__DIR__.'/src', __DIR__.'/vendor'),
|
42 |
+
* ));
|
43 |
+
*
|
44 |
+
* // register a library using the PEAR naming convention
|
45 |
+
* $loader->registerPrefixes(array(
|
46 |
+
* 'Swift_' => __DIR__.'/Swift',
|
47 |
+
* ));
|
48 |
+
*
|
49 |
+
* // activate the autoloader
|
50 |
+
* $loader->register();
|
51 |
+
*
|
52 |
+
* In this example, if you try to use a class in the Symfony\Component
|
53 |
+
* namespace or one of its children (Symfony\Component\Console for instance),
|
54 |
+
* the autoloader will first look for the class under the component/
|
55 |
+
* directory, and it will then fallback to the framework/ directory if not
|
56 |
+
* found before giving up.
|
57 |
+
*
|
58 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
59 |
+
* @author Kris Wallsmith <kris@symfony.com>
|
60 |
+
*
|
61 |
+
* @api
|
62 |
+
*/
|
63 |
+
class ApcUniversalClassLoader extends UniversalClassLoader
|
64 |
+
{
|
65 |
+
private $prefix;
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Constructor.
|
69 |
+
*
|
70 |
+
* @param string $prefix A prefix to create a namespace in APC
|
71 |
+
*
|
72 |
+
* @throws \RuntimeException
|
73 |
+
*
|
74 |
+
* @api
|
75 |
+
*/
|
76 |
+
public function __construct($prefix)
|
77 |
+
{
|
78 |
+
if (!extension_loaded('apc')) {
|
79 |
+
throw new \RuntimeException('Unable to use ApcUniversalClassLoader as APC is not enabled.');
|
80 |
+
}
|
81 |
+
|
82 |
+
$this->prefix = $prefix;
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Finds a file by class name while caching lookups to APC.
|
87 |
+
*
|
88 |
+
* @param string $class A class name to resolve to file
|
89 |
+
*
|
90 |
+
* @return string|null The path, if found
|
91 |
+
*/
|
92 |
+
public function findFile($class)
|
93 |
+
{
|
94 |
+
if (false === $file = apc_fetch($this->prefix.$class)) {
|
95 |
+
apc_store($this->prefix.$class, $file = parent::findFile($class));
|
96 |
+
}
|
97 |
+
|
98 |
+
return $file;
|
99 |
+
}
|
100 |
+
}
|
sdk/Aws/Symfony/Component/ClassLoader/CHANGELOG.md
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
CHANGELOG
|
2 |
+
=========
|
3 |
+
|
4 |
+
2.1.0
|
5 |
+
-----
|
6 |
+
|
7 |
+
* added a DebugClassLoader able to wrap any autoloader providing a findFile
|
8 |
+
method
|
9 |
+
* added a new ApcClassLoader and XcacheClassLoader using composition to wrap
|
10 |
+
other loaders
|
11 |
+
* added a new ClassLoader which does not distinguish between namespaced and
|
12 |
+
pear-like classes (as the PEAR convention is a subset of PSR-0) and
|
13 |
+
supports using Composer's namespace maps
|
14 |
+
* added a class map generator
|
15 |
+
* added support for loading globally-installed PEAR packages
|
sdk/Aws/Symfony/Component/ClassLoader/ClassCollectionLoader.php
ADDED
@@ -0,0 +1,367 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of the Symfony package.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier <fabien@symfony.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Symfony\Component\ClassLoader;
|
13 |
+
|
14 |
+
/**
|
15 |
+
* ClassCollectionLoader.
|
16 |
+
*
|
17 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
18 |
+
*/
|
19 |
+
class ClassCollectionLoader
|
20 |
+
{
|
21 |
+
private static $loaded;
|
22 |
+
private static $seen;
|
23 |
+
private static $useTokenizer = true;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Loads a list of classes and caches them in one big file.
|
27 |
+
*
|
28 |
+
* @param array $classes An array of classes to load
|
29 |
+
* @param string $cacheDir A cache directory
|
30 |
+
* @param string $name The cache name prefix
|
31 |
+
* @param Boolean $autoReload Whether to flush the cache when the cache is stale or not
|
32 |
+
* @param Boolean $adaptive Whether to remove already declared classes or not
|
33 |
+
* @param string $extension File extension of the resulting file
|
34 |
+
*
|
35 |
+
* @throws \InvalidArgumentException When class can't be loaded
|
36 |
+
*/
|
37 |
+
public static function load($classes, $cacheDir, $name, $autoReload, $adaptive = false, $extension = '.php')
|
38 |
+
{
|
39 |
+
// each $name can only be loaded once per PHP process
|
40 |
+
if (isset(self::$loaded[$name])) {
|
41 |
+
return;
|
42 |
+
}
|
43 |
+
|
44 |
+
self::$loaded[$name] = true;
|
45 |
+
|
46 |
+
$declared = array_merge(get_declared_classes(), get_declared_interfaces());
|
47 |
+
if (function_exists('get_declared_traits')) {
|
48 |
+
$declared = array_merge($declared, get_declared_traits());
|
49 |
+
}
|
50 |
+
|
51 |
+
if ($adaptive) {
|
52 |
+
// don't include already declared classes
|
53 |
+
$classes = array_diff($classes, $declared);
|
54 |
+
|
55 |
+
// the cache is different depending on which classes are already declared
|
56 |
+
$name = $name.'-'.substr(md5(implode('|', $classes)), 0, 5);
|
57 |
+
}
|
58 |
+
|
59 |
+
$classes = array_unique($classes);
|
60 |
+
|
61 |
+
$cache = $cacheDir.'/'.$name.$extension;
|
62 |
+
|
63 |
+
// auto-reload
|
64 |
+
$reload = false;
|
65 |
+
if ($autoReload) {
|
66 |
+
$metadata = $cacheDir.'/'.$name.$extension.'.meta';
|
67 |
+
if (!is_file($metadata) || !is_file($cache)) {
|
68 |
+
$reload = true;
|
69 |
+
} else {
|
70 |
+
$time = filemtime($cache);
|
71 |
+
$meta = unserialize(file_get_contents($metadata));
|
72 |
+
|
73 |
+
sort($meta[1]);
|
74 |
+
sort($classes);
|
75 |
+
|
76 |
+
if ($meta[1] != $classes) {
|
77 |
+
$reload = true;
|
78 |
+
} else {
|
79 |
+
foreach ($meta[0] as $resource) {
|
80 |
+
if (!is_file($resource) || filemtime($resource) > $time) {
|
81 |
+
$reload = true;
|
82 |
+
|
83 |
+
break;
|
84 |
+
}
|
85 |
+
}
|
86 |
+
}
|
87 |
+
}
|
88 |
+
}
|
89 |
+
|
90 |
+
if (!$reload && is_file($cache)) {
|
91 |
+
require_once $cache;
|
92 |
+
|
93 |
+
return;
|
94 |
+
}
|
95 |
+
|
96 |
+
$files = array();
|
97 |
+
$content = '';
|
98 |
+
foreach (self::getOrderedClasses($classes) as $class) {
|
99 |
+
if (in_array($class->getName(), $declared)) {
|
100 |
+
continue;
|
101 |
+
}
|
102 |
+
|
103 |
+
$files[] = $class->getFileName();
|
104 |
+
|
105 |
+
$c = preg_replace(array('/^\s*<\?php/', '/\?>\s*$/'), '', file_get_contents($class->getFileName()));
|
106 |
+
|
107 |
+
// fakes namespace declaration for global code
|
108 |
+
if (!$class->inNamespace()) {
|
109 |
+
$c = "\nnamespace\n{\n".$c."\n}\n";
|
110 |
+
}
|
111 |
+
|
112 |
+
$c = self::fixNamespaceDeclarations('<?php '.$c);
|
113 |
+
$c = preg_replace('/^\s*<\?php/', '', $c);
|
114 |
+
|
115 |
+
$content .= $c;
|
116 |
+
}
|
117 |
+
|
118 |
+
// cache the core classes
|
119 |
+
if (!is_dir(dirname($cache))) {
|
120 |
+
mkdir(dirname($cache), 0777, true);
|
121 |
+
}
|
122 |
+
self::writeCacheFile($cache, '<?php '.$content);
|
123 |
+
|
124 |
+
if ($autoReload) {
|
125 |
+
// save the resources
|
126 |
+
self::writeCacheFile($metadata, serialize(array($files, $classes)));
|
127 |
+
}
|
128 |
+
}
|
129 |
+
|
130 |
+
/**
|
131 |
+
* Adds brackets around each namespace if it's not already the case.
|
132 |
+
*
|
133 |
+
* @param string $source Namespace string
|
134 |
+
*
|
135 |
+
* @return string Namespaces with brackets
|
136 |
+
*/
|
137 |
+
public static function fixNamespaceDeclarations($source)
|
138 |
+
{
|
139 |
+
if (!function_exists('token_get_all') || !self::$useTokenizer) {
|
140 |
+
if (preg_match('/namespace(.*?)\s*;/', $source)) {
|
141 |
+
$source = preg_replace('/namespace(.*?)\s*;/', "namespace$1\n{", $source)."}\n";
|
142 |
+
}
|
143 |
+
|
144 |
+
return $source;
|
145 |
+
}
|
146 |
+
|
147 |
+
$rawChunk = '';
|
148 |
+
$output = '';
|
149 |
+
$inNamespace = false;
|
150 |
+
$tokens = token_get_all($source);
|
151 |
+
|
152 |
+
for (reset($tokens); false !== $token = current($tokens); next($tokens)) {
|
153 |
+
if (is_string($token)) {
|
154 |
+
$rawChunk .= $token;
|
155 |
+
} elseif (in_array($token[0], array(T_COMMENT, T_DOC_COMMENT))) {
|
156 |
+
// strip comments
|
157 |
+
continue;
|
158 |
+
} elseif (T_NAMESPACE === $token[0]) {
|
159 |
+
if ($inNamespace) {
|
160 |
+
$rawChunk .= "}\n";
|
161 |
+
}
|
162 |
+
$rawChunk .= $token[1];
|
163 |
+
|
164 |
+
// namespace name and whitespaces
|
165 |
+
while (($t = next($tokens)) && is_array($t) && in_array($t[0], array(T_WHITESPACE, T_NS_SEPARATOR, T_STRING))) {
|
166 |
+
$rawChunk .= $t[1];
|
167 |
+
}
|
168 |
+
if ('{' === $t) {
|
169 |
+
$inNamespace = false;
|
170 |
+
prev($tokens);
|
171 |
+
} else {
|
172 |
+
$rawChunk = rtrim($rawChunk)."\n{";
|
173 |
+
$inNamespace = true;
|
174 |
+
}
|
175 |
+
} elseif (T_START_HEREDOC === $token[0]) {
|
176 |
+
$output .= self::compressCode($rawChunk).$token[1];
|
177 |
+
do {
|
178 |
+
$token = next($tokens);
|
179 |
+
$output .= is_string($token) ? $token : $token[1];
|
180 |
+
} while ($token[0] !== T_END_HEREDOC);
|
181 |
+
$output .= "\n";
|
182 |
+
$rawChunk = '';
|
183 |
+
} elseif (T_CONSTANT_ENCAPSED_STRING === $token[0]) {
|
184 |
+
$output .= self::compressCode($rawChunk).$token[1];
|
185 |
+
$rawChunk = '';
|
186 |
+
} else {
|
187 |
+
$rawChunk .= $token[1];
|
188 |
+
}
|
189 |
+
}
|
190 |
+
|
191 |
+
if ($inNamespace) {
|
192 |
+
$rawChunk .= "}\n";
|
193 |
+
}
|
194 |
+
|
195 |
+
return $output.self::compressCode($rawChunk);
|
196 |
+
}
|
197 |
+
|
198 |
+
/**
|
199 |
+
* This method is only useful for testing.
|
200 |
+
*/
|
201 |
+
public static function enableTokenizer($bool)
|
202 |
+
{
|
203 |
+
self::$useTokenizer = (Boolean) $bool;
|
204 |
+
}
|
205 |
+
|
206 |
+
/**
|
207 |
+
* Strips leading & trailing ws, multiple EOL, multiple ws.
|
208 |
+
*
|
209 |
+
* @param string $code Original PHP code
|
210 |
+
*
|
211 |
+
* @return string compressed code
|
212 |
+
*/
|
213 |
+
private static function compressCode($code)
|
214 |
+
{
|
215 |
+
return preg_replace(
|
216 |
+
array('/^\s+/m', '/\s+$/m', '/([\n\r]+ *[\n\r]+)+/', '/[ \t]+/'),
|
217 |
+
array('', '', "\n", ' '),
|
218 |
+
$code
|
219 |
+
);
|
220 |
+
}
|
221 |
+
|
222 |
+
/**
|
223 |
+
* Writes a cache file.
|
224 |
+
*
|
225 |
+
* @param string $file Filename
|
226 |
+
* @param string $content Temporary file content
|
227 |
+
*
|
228 |
+
* @throws \RuntimeException when a cache file cannot be written
|
229 |
+
*/
|
230 |
+
private static function writeCacheFile($file, $content)
|
231 |
+
{
|
232 |
+
$tmpFile = tempnam(dirname($file), basename($file));
|
233 |
+
if (false !== @file_put_contents($tmpFile, $content) && @rename($tmpFile, $file)) {
|
234 |
+
@chmod($file, 0666 & ~umask());
|
235 |
+
|
236 |
+
return;
|
237 |
+
}
|
238 |
+
|
239 |
+
throw new \RuntimeException(sprintf('Failed to write cache file "%s".', $file));
|
240 |
+
}
|
241 |
+
|
242 |
+
/**
|
243 |
+
* Gets an ordered array of passed classes including all their dependencies.
|
244 |
+
*
|
245 |
+
* @param array $classes
|
246 |
+
*
|
247 |
+
* @return \ReflectionClass[] An array of sorted \ReflectionClass instances (dependencies added if needed)
|
248 |
+
*
|
249 |
+
* @throws \InvalidArgumentException When a class can't be loaded
|
250 |
+
*/
|
251 |
+
private static function getOrderedClasses(array $classes)
|
252 |
+
{
|
253 |
+
$map = array();
|
254 |
+
self::$seen = array();
|
255 |
+
foreach ($classes as $class) {
|
256 |
+
try {
|
257 |
+
$reflectionClass = new \ReflectionClass($class);
|
258 |
+
} catch (\ReflectionException $e) {
|
259 |
+
throw new \InvalidArgumentException(sprintf('Unable to load class "%s"', $class));
|
260 |
+
}
|
261 |
+
|
262 |
+
$map = array_merge($map, self::getClassHierarchy($reflectionClass));
|
263 |
+
}
|
264 |
+
|
265 |
+
return $map;
|
266 |
+
}
|
267 |
+
|
268 |
+
private static function getClassHierarchy(\ReflectionClass $class)
|
269 |
+
{
|
270 |
+
if (isset(self::$seen[$class->getName()])) {
|
271 |
+
return array();
|
272 |
+
}
|
273 |
+
|
274 |
+
self::$seen[$class->getName()] = true;
|
275 |
+
|
276 |
+
$classes = array($class);
|
277 |
+
$parent = $class;
|
278 |
+
while (($parent = $parent->getParentClass()) && $parent->isUserDefined() && !isset(self::$seen[$parent->getName()])) {
|
279 |
+
self::$seen[$parent->getName()] = true;
|
280 |
+
|
281 |
+
array_unshift($classes, $parent);
|
282 |
+
}
|
283 |
+
|
284 |
+
$traits = array();
|
285 |
+
|
286 |
+
if (function_exists('get_declared_traits')) {
|
287 |
+
foreach ($classes as $c) {
|
288 |
+
foreach (self::resolveDependencies(self::computeTraitDeps($c), $c) as $trait) {
|
289 |
+
if ($trait !== $c) {
|
290 |
+
$traits[] = $trait;
|
291 |
+
}
|
292 |
+
}
|
293 |
+
}
|
294 |
+
}
|
295 |
+
|
296 |
+
return array_merge(self::getInterfaces($class), $traits, $classes);
|
297 |
+
}
|
298 |
+
|
299 |
+
private static function getInterfaces(\ReflectionClass $class)
|
300 |
+
{
|
301 |
+
$classes = array();
|
302 |
+
|
303 |
+
foreach ($class->getInterfaces() as $interface) {
|
304 |
+
$classes = array_merge($classes, self::getInterfaces($interface));
|
305 |
+
}
|
306 |
+
|
307 |
+
if ($class->isUserDefined() && $class->isInterface() && !isset(self::$seen[$class->getName()])) {
|
308 |
+
self::$seen[$class->getName()] = true;
|
309 |
+
|
310 |
+
$classes[] = $class;
|
311 |
+
}
|
312 |
+
|
313 |
+
return $classes;
|
314 |
+
}
|
315 |
+
|
316 |
+
private static function computeTraitDeps(\ReflectionClass $class)
|
317 |
+
{
|
318 |
+
$traits = $class->getTraits();
|
319 |
+
$deps = array($class->getName() => $traits);
|
320 |
+
while ($trait = array_pop($traits)) {
|
321 |
+
if ($trait->isUserDefined() && !isset(self::$seen[$trait->getName()])) {
|
322 |
+
self::$seen[$trait->getName()] = true;
|
323 |
+
$traitDeps = $trait->getTraits();
|
324 |
+
$deps[$trait->getName()] = $traitDeps;
|
325 |
+
$traits = array_merge($traits, $traitDeps);
|
326 |
+
}
|
327 |
+
}
|
328 |
+
|
329 |
+
return $deps;
|
330 |
+
}
|
331 |
+
|
332 |
+
/**
|
333 |
+
* Dependencies resolution.
|
334 |
+
*
|
335 |
+
* This function does not check for circular dependencies as it should never
|
336 |
+
* occur with PHP traits.
|
337 |
+
*
|
338 |
+
* @param array $tree The dependency tree
|
339 |
+
* @param \ReflectionClass $node The node
|
340 |
+
* @param \ArrayObject $resolved An array of already resolved dependencies
|
341 |
+
* @param \ArrayObject $unresolved An array of dependencies to be resolved
|
342 |
+
*
|
343 |
+
* @return \ArrayObject The dependencies for the given node
|
344 |
+
*
|
345 |
+
* @throws \RuntimeException if a circular dependency is detected
|
346 |
+
*/
|
347 |
+
private static function resolveDependencies(array $tree, $node, \ArrayObject $resolved = null, \ArrayObject $unresolved = null)
|
348 |
+
{
|
349 |
+
if (null === $resolved) {
|
350 |
+
$resolved = new \ArrayObject();
|
351 |
+
}
|
352 |
+
if (null === $unresolved) {
|
353 |
+
$unresolved = new \ArrayObject();
|
354 |
+
}
|
355 |
+
$nodeName = $node->getName();
|
356 |
+
$unresolved[$nodeName] = $node;
|
357 |
+
foreach ($tree[$nodeName] as $dependency) {
|
358 |
+
if (!$resolved->offsetExists($dependency->getName())) {
|
359 |
+
self::resolveDependencies($tree, $dependency, $resolved, $unresolved);
|
360 |
+
}
|
361 |
+
}
|
362 |
+
$resolved[$nodeName] = $node;
|
363 |
+
unset($unresolved[$nodeName]);
|
364 |
+
|
365 |
+
return $resolved;
|
366 |
+
}
|
367 |
+
}
|
sdk/Aws/Symfony/Component/ClassLoader/ClassLoader.php
ADDED
@@ -0,0 +1,203 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of the Symfony package.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier <fabien@symfony.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Symfony\Component\ClassLoader;
|
13 |
+
|
14 |
+
/**
|
15 |
+
* ClassLoader implements an PSR-0 class loader
|
16 |
+
*
|
17 |
+
* See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md
|
18 |
+
*
|
19 |
+
* $loader = new ClassLoader();
|
20 |
+
*
|
21 |
+
* // register classes with namespaces
|
22 |
+
* $loader->addPrefix('Symfony\Component', __DIR__.'/component');
|
23 |
+
* $loader->addPrefix('Symfony', __DIR__.'/framework');
|
24 |
+
*
|
25 |
+
* // activate the autoloader
|
26 |
+
* $loader->register();
|
27 |
+
*
|
28 |
+
* // to enable searching the include path (e.g. for PEAR packages)
|
29 |
+
* $loader->setUseIncludePath(true);
|
30 |
+
*
|
31 |
+
* In this example, if you try to use a class in the Symfony\Component
|
32 |
+
* namespace or one of its children (Symfony\Component\Console for instance),
|
33 |
+
* the autoloader will first look for the class under the component/
|
34 |
+
* directory, and it will then fallback to the framework/ directory if not
|
35 |
+
* found before giving up.
|
36 |
+
*
|
37 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
38 |
+
* @author Jordi Boggiano <j.boggiano@seld.be>
|
39 |
+
*/
|
40 |
+
class ClassLoader
|
41 |
+
{
|
42 |
+
private $prefixes = array();
|
43 |
+
private $fallbackDirs = array();
|
44 |
+
private $useIncludePath = false;
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Returns prefixes.
|
48 |
+
*
|
49 |
+
* @return array
|
50 |
+
*/
|
51 |
+
public function getPrefixes()
|
52 |
+
{
|
53 |
+
return $this->prefixes;
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Returns fallback directories.
|
58 |
+
*
|
59 |
+
* @return array
|
60 |
+
*/
|
61 |
+
public function getFallbackDirs()
|
62 |
+
{
|
63 |
+
return $this->fallbackDirs;
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Adds prefixes.
|
68 |
+
*
|
69 |
+
* @param array $prefixes Prefixes to add
|
70 |
+
*/
|
71 |
+
public function addPrefixes(array $prefixes)
|
72 |
+
{
|
73 |
+
foreach ($prefixes as $prefix => $path) {
|
74 |
+
$this->addPrefix($prefix, $path);
|
75 |
+
}
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Registers a set of classes
|
80 |
+
*
|
81 |
+
* @param string $prefix The classes prefix
|
82 |
+
* @param array|string $paths The location(s) of the classes
|
83 |
+
*/
|
84 |
+
public function addPrefix($prefix, $paths)
|
85 |
+
{
|
86 |
+
if (!$prefix) {
|
87 |
+
foreach ((array) $paths as $path) {
|
88 |
+
$this->fallbackDirs[] = $path;
|
89 |
+
}
|
90 |
+
|
91 |
+
return;
|
92 |
+
}
|
93 |
+
if (isset($this->prefixes[$prefix])) {
|
94 |
+
$this->prefixes[$prefix] = array_merge(
|
95 |
+
$this->prefixes[$prefix],
|
96 |
+
(array) $paths
|
97 |
+
);
|
98 |
+
} else {
|
99 |
+
$this->prefixes[$prefix] = (array) $paths;
|
100 |
+
}
|
101 |
+
}
|
102 |
+
|
103 |
+
/**
|
104 |
+
* Turns on searching the include for class files.
|
105 |
+
*
|
106 |
+
* @param Boolean $useIncludePath
|
107 |
+
*/
|
108 |
+
public function setUseIncludePath($useIncludePath)
|
109 |
+
{
|
110 |
+
$this->useIncludePath = $useIncludePath;
|
111 |
+
}
|
112 |
+
|
113 |
+
/**
|
114 |
+
* Can be used to check if the autoloader uses the include path to check
|
115 |
+
* for classes.
|
116 |
+
*
|
117 |
+
* @return Boolean
|
118 |
+
*/
|
119 |
+
public function getUseIncludePath()
|
120 |
+
{
|
121 |
+
return $this->useIncludePath;
|
122 |
+
}
|
123 |
+
|
124 |
+
/**
|
125 |
+
* Registers this instance as an autoloader.
|
126 |
+
*
|
127 |
+
* @param Boolean $prepend Whether to prepend the autoloader or not
|
128 |
+
*/
|
129 |
+
public function register($prepend = false)
|
130 |
+
{
|
131 |
+
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
|
132 |
+
}
|
133 |
+
|
134 |
+
/**
|
135 |
+
* Unregisters this instance as an autoloader.
|
136 |
+
*/
|
137 |
+
public function unregister()
|
138 |
+
{
|
139 |
+
spl_autoload_unregister(array($this, 'loadClass'));
|
140 |
+
}
|
141 |
+
|
142 |
+
/**
|
143 |
+
* Loads the given class or interface.
|
144 |
+
*
|
145 |
+
* @param string $class The name of the class
|
146 |
+
*
|
147 |
+
* @return Boolean|null True, if loaded
|
148 |
+
*/
|
149 |
+
public function loadClass($class)
|
150 |
+
{
|
151 |
+
if ($file = $this->findFile($class)) {
|
152 |
+
require $file;
|
153 |
+
|
154 |
+
return true;
|
155 |
+
}
|
156 |
+
}
|
157 |
+
|
158 |
+
/**
|
159 |
+
* Finds the path to the file where the class is defined.
|
160 |
+
*
|
161 |
+
* @param string $class The name of the class
|
162 |
+
*
|
163 |
+
* @return string|null The path, if found
|
164 |
+
*/
|
165 |
+
public function findFile($class)
|
166 |
+
{
|
167 |
+
if ('\\' == $class[0]) {
|
168 |
+
$class = substr($class, 1);
|
169 |
+
}
|
170 |
+
|
171 |
+
if (false !== $pos = strrpos($class, '\\')) {
|
172 |
+
// namespaced class name
|
173 |
+
$classPath = str_replace('\\', DIRECTORY_SEPARATOR, substr($class, 0, $pos)) . DIRECTORY_SEPARATOR;
|
174 |
+
$className = substr($class, $pos + 1);
|
175 |
+
} else {
|
176 |
+
// PEAR-like class name
|
177 |
+
$classPath = null;
|
178 |
+
$className = $class;
|
179 |
+
}
|
180 |
+
|
181 |
+
$classPath .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';
|
182 |
+
|
183 |
+
foreach ($this->prefixes as $prefix => $dirs) {
|
184 |
+
if (0 === strpos($class, $prefix)) {
|
185 |
+
foreach ($dirs as $dir) {
|
186 |
+
if (file_exists($dir . DIRECTORY_SEPARATOR . $classPath)) {
|
187 |
+
return $dir . DIRECTORY_SEPARATOR . $classPath;
|
188 |
+
}
|
189 |
+
}
|
190 |
+
}
|
191 |
+
}
|
192 |
+
|
193 |
+
foreach ($this->fallbackDirs as $dir) {
|
194 |
+
if (file_exists($dir . DIRECTORY_SEPARATOR . $classPath)) {
|
195 |
+
return $dir . DIRECTORY_SEPARATOR . $classPath;
|
196 |
+
}
|
197 |
+
}
|
198 |
+
|
199 |
+
if ($this->useIncludePath && $file = stream_resolve_include_path($classPath)) {
|
200 |
+
return $file;
|
201 |
+
}
|
202 |
+
}
|
203 |
+
}
|
sdk/Aws/Symfony/Component/ClassLoader/ClassMapGenerator.php
ADDED
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of the Symfony package.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier <fabien@symfony.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Symfony\Component\ClassLoader;
|
13 |
+
|
14 |
+
/**
|
15 |
+
* ClassMapGenerator
|
16 |
+
*
|
17 |
+
* @author Gyula Sallai <salla016@gmail.com>
|
18 |
+
*/
|
19 |
+
class ClassMapGenerator
|
20 |
+
{
|
21 |
+
/**
|
22 |
+
* Generate a class map file
|
23 |
+
*
|
24 |
+
* @param array|string $dirs Directories or a single path to search in
|
25 |
+
* @param string $file The name of the class map file
|
26 |
+
*/
|
27 |
+
public static function dump($dirs, $file)
|
28 |
+
{
|
29 |
+
$dirs = (array) $dirs;
|
30 |
+
$maps = array();
|
31 |
+
|
32 |
+
foreach ($dirs as $dir) {
|
33 |
+
$maps = array_merge($maps, static::createMap($dir));
|
34 |
+
}
|
35 |
+
|
36 |
+
file_put_contents($file, sprintf('<?php return %s;', var_export($maps, true)));
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Iterate over all files in the given directory searching for classes
|
41 |
+
*
|
42 |
+
* @param Iterator|string $dir The directory to search in or an iterator
|
43 |
+
*
|
44 |
+
* @return array A class map array
|
45 |
+
*/
|
46 |
+
public static function createMap($dir)
|
47 |
+
{
|
48 |
+
if (is_string($dir)) {
|
49 |
+
$dir = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($dir));
|
50 |
+
}
|
51 |
+
|
52 |
+
$map = array();
|
53 |
+
|
54 |
+
foreach ($dir as $file) {
|
55 |
+
if (!$file->isFile()) {
|
56 |
+
continue;
|
57 |
+
}
|
58 |
+
|
59 |
+
$path = $file->getRealPath();
|
60 |
+
|
61 |
+
if (pathinfo($path, PATHINFO_EXTENSION) !== 'php') {
|
62 |
+
continue;
|
63 |
+
}
|
64 |
+
|
65 |
+
$classes = self::findClasses($path);
|
66 |
+
|
67 |
+
foreach ($classes as $class) {
|
68 |
+
$map[$class] = $path;
|
69 |
+
}
|
70 |
+
|
71 |
+
}
|
72 |
+
|
73 |
+
return $map;
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Extract the classes in the given file
|
78 |
+
*
|
79 |
+
* @param string $path The file to check
|
80 |
+
*
|
81 |
+
* @return array The found classes
|
82 |
+
*/
|
83 |
+
private static function findClasses($path)
|
84 |
+
{
|
85 |
+
$contents = file_get_contents($path);
|
86 |
+
$tokens = token_get_all($contents);
|
87 |
+
$T_TRAIT = version_compare(PHP_VERSION, '5.4', '<') ? -1 : T_TRAIT;
|
88 |
+
|
89 |
+
$classes = array();
|
90 |
+
|
91 |
+
$namespace = '';
|
92 |
+
for ($i = 0, $max = count($tokens); $i < $max; $i++) {
|
93 |
+
$token = $tokens[$i];
|
94 |
+
|
95 |
+
if (is_string($token)) {
|
96 |
+
continue;
|
97 |
+
}
|
98 |
+
|
99 |
+
$class = '';
|
100 |
+
|
101 |
+
switch ($token[0]) {
|
102 |
+
case T_NAMESPACE:
|
103 |
+
$namespace = '';
|
104 |
+
// If there is a namespace, extract it
|
105 |
+
while (($t = $tokens[++$i]) && is_array($t)) {
|
106 |
+
if (in_array($t[0], array(T_STRING, T_NS_SEPARATOR))) {
|
107 |
+
$namespace .= $t[1];
|
108 |
+
}
|
109 |
+
}
|
110 |
+
$namespace .= '\\';
|
111 |
+
break;
|
112 |
+
case T_CLASS:
|
113 |
+
case T_INTERFACE:
|
114 |
+
case $T_TRAIT:
|
115 |
+
// Find the classname
|
116 |
+
while (($t = $tokens[++$i]) && is_array($t)) {
|
117 |
+
if (T_STRING === $t[0]) {
|
118 |
+
$class .= $t[1];
|
119 |
+
} elseif ($class !== '' && T_WHITESPACE == $t[0]) {
|
120 |
+
break;
|
121 |
+
}
|
122 |
+
}
|
123 |
+
|
124 |
+
$classes[] = ltrim($namespace . $class, '\\');
|
125 |
+
break;
|
126 |
+
default:
|
127 |
+
break;
|
128 |
+
}
|
129 |
+
}
|
130 |
+
|
131 |
+
return $classes;
|
132 |
+
}
|
133 |
+
}
|
sdk/Aws/Symfony/Component/ClassLoader/DebugClassLoader.php
ADDED
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of the Symfony package.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier <fabien@symfony.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Symfony\Component\ClassLoader;
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Autoloader checking if the class is really defined in the file found.
|
16 |
+
*
|
17 |
+
* The DebugClassLoader will wrap all registered autoloaders providing a
|
18 |
+
* findFile method and will throw an exception if a file is found but does
|
19 |
+
* not declare the class.
|
20 |
+
*
|
21 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
22 |
+
* @author Christophe Coevoet <stof@notk.org>
|
23 |
+
*
|
24 |
+
* @api
|
25 |
+
*/
|
26 |
+
class DebugClassLoader
|
27 |
+
{
|
28 |
+
private $classFinder;
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Constructor.
|
32 |
+
*
|
33 |
+
* @param object $classFinder
|
34 |
+
*
|
35 |
+
* @api
|
36 |
+
*/
|
37 |
+
public function __construct($classFinder)
|
38 |
+
{
|
39 |
+
$this->classFinder = $classFinder;
|
40 |
+
}
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Replaces all autoloaders implementing a findFile method by a DebugClassLoader wrapper.
|
44 |
+
*/
|
45 |
+
public static function enable()
|
46 |
+
{
|
47 |
+
if (!is_array($functions = spl_autoload_functions())) {
|
48 |
+
return;
|
49 |
+
}
|
50 |
+
|
51 |
+
foreach ($functions as $function) {
|
52 |
+
spl_autoload_unregister($function);
|
53 |
+
}
|
54 |
+
|
55 |
+
foreach ($functions as $function) {
|
56 |
+
if (is_array($function) && !$function[0] instanceof self && method_exists($function[0], 'findFile')) {
|
57 |
+
$function = array(new static($function[0]), 'loadClass');
|
58 |
+
}
|
59 |
+
|
60 |
+
spl_autoload_register($function);
|
61 |
+
}
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Unregisters this instance as an autoloader.
|
66 |
+
*/
|
67 |
+
public function unregister()
|
68 |
+
{
|
69 |
+
spl_autoload_unregister(array($this, 'loadClass'));
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Finds a file by class name
|
74 |
+
*
|
75 |
+
* @param string $class A class name to resolve to file
|
76 |
+
*
|
77 |
+
* @return string|null
|
78 |
+
*/
|
79 |
+
public function findFile($class)
|
80 |
+
{
|
81 |
+
return $this->classFinder->findFile($class);
|
82 |
+
}
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Loads the given class or interface.
|
86 |
+
*
|
87 |
+
* @param string $class The name of the class
|
88 |
+
*
|
89 |
+
* @return Boolean|null True, if loaded
|
90 |
+
*
|
91 |
+
* @throws \RuntimeException
|
92 |
+
*/
|
93 |
+
public function loadClass($class)
|
94 |
+
{
|
95 |
+
if ($file = $this->classFinder->findFile($class)) {
|
96 |
+
require $file;
|
97 |
+
|
98 |
+
if (!class_exists($class, false) && !interface_exists($class, false) && (!function_exists('trait_exists') || !trait_exists($class, false))) {
|
99 |
+
if (false !== strpos($class, '/')) {
|
100 |
+
throw new \RuntimeException(sprintf('Trying to autoload a class with an invalid name "%s". Be careful that the namespace separator is "\" in PHP, not "/".', $class));
|
101 |
+
}
|
102 |
+
|
103 |
+
throw new \RuntimeException(sprintf('The autoloader expected class "%s" to be defined in file "%s". The file was found but the class was not in it, the class name or namespace probably has a typo.', $class, $file));
|
104 |
+
}
|
105 |
+
|
106 |
+
return true;
|
107 |
+
}
|
108 |
+
}
|
109 |
+
}
|
sdk/Aws/Symfony/Component/ClassLoader/DebugUniversalClassLoader.php
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of the Symfony package.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier <fabien@symfony.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Symfony\Component\ClassLoader;
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Checks that the class is actually declared in the included file.
|
16 |
+
*
|
17 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
18 |
+
*/
|
19 |
+
class DebugUniversalClassLoader extends UniversalClassLoader
|
20 |
+
{
|
21 |
+
/**
|
22 |
+
* Replaces all regular UniversalClassLoader instances by a DebugUniversalClassLoader ones.
|
23 |
+
*/
|
24 |
+
public static function enable()
|
25 |
+
{
|
26 |
+
if (!is_array($functions = spl_autoload_functions())) {
|
27 |
+
return;
|
28 |
+
}
|
29 |
+
|
30 |
+
foreach ($functions as $function) {
|
31 |
+
spl_autoload_unregister($function);
|
32 |
+
}
|
33 |
+
|
34 |
+
foreach ($functions as $function) {
|
35 |
+
if (is_array($function) && $function[0] instanceof UniversalClassLoader) {
|
36 |
+
$loader = new static();
|
37 |
+
$loader->registerNamespaceFallbacks($function[0]->getNamespaceFallbacks());
|
38 |
+
$loader->registerPrefixFallbacks($function[0]->getPrefixFallbacks());
|
39 |
+
$loader->registerNamespaces($function[0]->getNamespaces());
|
40 |
+
$loader->registerPrefixes($function[0]->getPrefixes());
|
41 |
+
$loader->useIncludePath($function[0]->getUseIncludePath());
|
42 |
+
|
43 |
+
$function[0] = $loader;
|
44 |
+
}
|
45 |
+
|
46 |
+
spl_autoload_register($function);
|
47 |
+
}
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* {@inheritDoc}
|
52 |
+
*/
|
53 |
+
public function loadClass($class)
|
54 |
+
{
|
55 |
+
if ($file = $this->findFile($class)) {
|
56 |
+
require $file;
|
57 |
+
|
58 |
+
if (!class_exists($class, false) && !interface_exists($class, false) && (!function_exists('trait_exists') || !trait_exists($class, false))) {
|
59 |
+
throw new \RuntimeException(sprintf('The autoloader expected class "%s" to be defined in file "%s". The file was found but the class was not in it, the class name or namespace probably has a typo.', $class, $file));
|
60 |
+
}
|
61 |
+
}
|
62 |
+
}
|
63 |
+
}
|
sdk/Aws/Symfony/Component/ClassLoader/LICENSE
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Copyright (c) 2004-2013 Fabien Potencier
|
2 |
+
|
3 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
of this software and associated documentation files (the "Software"), to deal
|
5 |
+
in the Software without restriction, including without limitation the rights
|
6 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
copies of the Software, and to permit persons to whom the Software is furnished
|
8 |
+
to do so, subject to the following conditions:
|
9 |
+
|
10 |
+
The above copyright notice and this permission notice shall be included in all
|
11 |
+
copies or substantial portions of the Software.
|
12 |
+
|
13 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
THE SOFTWARE.
|
sdk/Aws/Symfony/Component/ClassLoader/MapClassLoader.php
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of the Symfony package.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier <fabien@symfony.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Symfony\Component\ClassLoader;
|
13 |
+
|
14 |
+
/**
|
15 |
+
* A class loader that uses a mapping file to look up paths.
|
16 |
+
*
|
17 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
18 |
+
*/
|
19 |
+
class MapClassLoader
|
20 |
+
{
|
21 |
+
private $map = array();
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Constructor.
|
25 |
+
*
|
26 |
+
* @param array $map A map where keys are classes and values the absolute file path
|
27 |
+
*/
|
28 |
+
public function __construct(array $map)
|
29 |
+
{
|
30 |
+
$this->map = $map;
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Registers this instance as an autoloader.
|
35 |
+
*
|
36 |
+
* @param Boolean $prepend Whether to prepend the autoloader or not
|
37 |
+
*/
|
38 |
+
public function register($prepend = false)
|
39 |
+
{
|
40 |
+
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Loads the given class or interface.
|
45 |
+
*
|
46 |
+
* @param string $class The name of the class
|
47 |
+
*/
|
48 |
+
public function loadClass($class)
|
49 |
+
{
|
50 |
+
if ('\\' === $class[0]) {
|
51 |
+
$class = substr($class, 1);
|
52 |
+
}
|
53 |
+
|
54 |
+
if (isset($this->map[$class])) {
|
55 |
+
require $this->map[$class];
|
56 |
+
}
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Finds the path to the file where the class is defined.
|
61 |
+
*
|
62 |
+
* @param string $class The name of the class
|
63 |
+
*
|
64 |
+
* @return string|null The path, if found
|
65 |
+
*/
|
66 |
+
public function findFile($class)
|
67 |
+
{
|
68 |
+
if ('\\' === $class[0]) {
|
69 |
+
$class = substr($class, 1);
|
70 |
+
}
|
71 |
+
|
72 |
+
if (isset($this->map[$class])) {
|
73 |
+
return $this->map[$class];
|
74 |
+
}
|
75 |
+
}
|
76 |
+
}
|
sdk/Aws/Symfony/Component/ClassLoader/README.md
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
ClassLoader Component
|
2 |
+
=====================
|
3 |
+
|
4 |
+
ClassLoader loads your project classes automatically if they follow some
|
5 |
+
standard PHP conventions.
|
6 |
+
|
7 |
+
The Universal ClassLoader is able to autoload classes that implement the PSR-0
|
8 |
+
standard or the PEAR naming convention.
|
9 |
+
|
10 |
+
First, register the autoloader:
|
11 |
+
|
12 |
+
require_once __DIR__.'/src/Symfony/Component/ClassLoader/UniversalClassLoader.php';
|
13 |
+
|
14 |
+
use Symfony\Component\ClassLoader\UniversalClassLoader;
|
15 |
+
|
16 |
+
$loader = new UniversalClassLoader();
|
17 |
+
$loader->register();
|
18 |
+
|
19 |
+
Then, register some namespaces with the `registerNamespace()` method:
|
20 |
+
|
21 |
+
$loader->registerNamespace('Symfony', __DIR__.'/src');
|
22 |
+
$loader->registerNamespace('Monolog', __DIR__.'/vendor/monolog/src');
|
23 |
+
|
24 |
+
The `registerNamespace()` method takes a namespace prefix and a path where to
|
25 |
+
look for the classes as arguments.
|
26 |
+
|
27 |
+
You can also register a sub-namespaces:
|
28 |
+
|
29 |
+
$loader->registerNamespace('Doctrine\\Common', __DIR__.'/vendor/doctrine-common/lib');
|
30 |
+
|
31 |
+
The order of registration is significant and the first registered namespace
|
32 |
+
takes precedence over later registered one.
|
33 |
+
|
34 |
+
You can also register more than one path for a given namespace:
|
35 |
+
|
36 |
+
$loader->registerNamespace('Symfony', array(__DIR__.'/src', __DIR__.'/symfony/src'));
|
37 |
+
|
38 |
+
Alternatively, you can use the `registerNamespaces()` method to register more
|
39 |
+
than one namespace at once:
|
40 |
+
|
41 |
+
$loader->registerNamespaces(array(
|
42 |
+
'Symfony' => array(__DIR__.'/src', __DIR__.'/symfony/src'),
|
43 |
+
'Doctrine\\Common' => __DIR__.'/vendor/doctrine-common/lib',
|
44 |
+
'Doctrine' => __DIR__.'/vendor/doctrine/lib',
|
45 |
+
'Monolog' => __DIR__.'/vendor/monolog/src',
|
46 |
+
));
|
47 |
+
|
48 |
+
For better performance, you can use the APC based version of the universal
|
49 |
+
class loader:
|
50 |
+
|
51 |
+
require_once __DIR__.'/src/Symfony/Component/ClassLoader/UniversalClassLoader.php';
|
52 |
+
require_once __DIR__.'/src/Symfony/Component/ClassLoader/ApcUniversalClassLoader.php';
|
53 |
+
|
54 |
+
use Symfony\Component\ClassLoader\ApcUniversalClassLoader;
|
55 |
+
|
56 |
+
$loader = new ApcUniversalClassLoader('apc.prefix.');
|
57 |
+
|
58 |
+
Furthermore, the component provides tools to aggregate classes into a single
|
59 |
+
file, which is especially useful to improve performance on servers that do not
|
60 |
+
provide byte caches.
|
61 |
+
|
62 |
+
Resources
|
63 |
+
---------
|
64 |
+
|
65 |
+
You can run the unit tests with the following command:
|
66 |
+
|
67 |
+
$ cd path/to/Symfony/Component/ClassLoader/
|
68 |
+
$ composer.phar install --dev
|
69 |
+
$ phpunit
|
sdk/Aws/{symfony/class-loader/Symfony → Symfony}/Component/ClassLoader/UniversalClassLoader.php
RENAMED
@@ -242,11 +242,15 @@ class UniversalClassLoader
|
|
242 |
* Loads the given class or interface.
|
243 |
*
|
244 |
* @param string $class The name of the class
|
|
|
|
|
245 |
*/
|
246 |
public function loadClass($class)
|
247 |
{
|
248 |
if ($file = $this->findFile($class)) {
|
249 |
require $file;
|
|
|
|
|
250 |
}
|
251 |
}
|
252 |
|
242 |
* Loads the given class or interface.
|
243 |
*
|
244 |
* @param string $class The name of the class
|
245 |
+
*
|
246 |
+
* @return Boolean|null True, if loaded
|
247 |
*/
|
248 |
public function loadClass($class)
|
249 |
{
|
250 |
if ($file = $this->findFile($class)) {
|
251 |
require $file;
|
252 |
+
|
253 |
+
return true;
|
254 |
}
|
255 |
}
|
256 |
|
sdk/Aws/Symfony/Component/ClassLoader/XcacheClassLoader.php
ADDED
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of the Symfony package.
|
5 |
+
*
|
6 |
+
* (c) Fabien Potencier <fabien@symfony.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Symfony\Component\ClassLoader;
|
13 |
+
|
14 |
+
/**
|
15 |
+
* XcacheClassLoader implements a wrapping autoloader cached in Xcache for PHP 5.3.
|
16 |
+
*
|
17 |
+
* It expects an object implementing a findFile method to find the file. This
|
18 |
+
* allows using it as a wrapper around the other loaders of the component (the
|
19 |
+
* ClassLoader and the UniversalClassLoader for instance) but also around any
|
20 |
+
* other autoloader following this convention (the Composer one for instance)
|
21 |
+
*
|
22 |
+
* $loader = new ClassLoader();
|
23 |
+
*
|
24 |
+
* // register classes with namespaces
|
25 |
+
* $loader->add('Symfony\Component', __DIR__.'/component');
|
26 |
+
* $loader->add('Symfony', __DIR__.'/framework');
|
27 |
+
*
|
28 |
+
* $cachedLoader = new XcacheClassLoader('my_prefix', $loader);
|
29 |
+
*
|
30 |
+
* // activate the cached autoloader
|
31 |
+
* $cachedLoader->register();
|
32 |
+
*
|
33 |
+
* // eventually deactivate the non-cached loader if it was registered previously
|
34 |
+
* // to be sure to use the cached one.
|
35 |
+
* $loader->unregister();
|
36 |
+
*
|
37 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
38 |
+
* @author Kris Wallsmith <kris@symfony.com>
|
39 |
+
* @author Kim Hemsø Rasmussen <kimhemsoe@gmail.com>
|
40 |
+
*
|
41 |
+
* @api
|
42 |
+
*/
|
43 |
+
class XcacheClassLoader
|
44 |
+
{
|
45 |
+
private $prefix;
|
46 |
+
private $classFinder;
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Constructor.
|
50 |
+
*
|
51 |
+
* @param string $prefix A prefix to create a namespace in Xcache
|
52 |
+
* @param object $classFinder An object that implements findFile() method.
|
53 |
+
*
|
54 |
+
* @throws \RuntimeException
|
55 |
+
* @throws \InvalidArgumentException
|
56 |
+
*
|
57 |
+
* @api
|
58 |
+
*/
|
59 |
+
public function __construct($prefix, $classFinder)
|
60 |
+
{
|
61 |
+
if (!extension_loaded('Xcache')) {
|
62 |
+
throw new \RuntimeException('Unable to use XcacheClassLoader as Xcache is not enabled.');
|
63 |
+
}
|
64 |
+
|
65 |
+
if (!method_exists($classFinder, 'findFile')) {
|
66 |
+
throw new \InvalidArgumentException('The class finder must implement a "findFile" method.');
|
67 |
+
}
|
68 |
+
|
69 |
+
$this->prefix = $prefix;
|
70 |
+
$this->classFinder = $classFinder;
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Registers this instance as an autoloader.
|
75 |
+
*
|
76 |
+
* @param Boolean $prepend Whether to prepend the autoloader or not
|
77 |
+
*/
|
78 |
+
public function register($prepend = false)
|
79 |
+
{
|
80 |
+
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Unregisters this instance as an autoloader.
|
85 |
+
*/
|
86 |
+
public function unregister()
|
87 |
+
{
|
88 |
+
spl_autoload_unregister(array($this, 'loadClass'));
|
89 |
+
}
|
90 |
+
|
91 |
+
/**
|
92 |
+
* Loads the given class or interface.
|
93 |
+
*
|
94 |
+
* @param string $class The name of the class
|
95 |
+
*
|
96 |
+
* @return Boolean|null True, if loaded
|
97 |
+
*/
|
98 |
+
public function loadClass($class)
|
99 |
+
{
|
100 |
+
if ($file = $this->findFile($class)) {
|
101 |
+
require $file;
|
102 |
+
|
103 |
+
return true;
|
104 |
+
}
|
105 |
+
}
|
106 |
+
|
107 |
+
/**
|
108 |
+
* Finds a file by class name while caching lookups to Xcache.
|
109 |
+
*
|
110 |
+
* @param string $class A class name to resolve to file
|
111 |
+
*
|
112 |
+
* @return string|null
|
113 |
+
*/
|
114 |
+
public function findFile($class)
|
115 |
+
{
|
116 |
+
if (xcache_isset($this->prefix.$class)) {
|
117 |
+
$file = xcache_get($this->prefix.$class);
|
118 |
+
} else {
|
119 |
+
xcache_set($this->prefix.$class, $file = $this->classFinder->findFile($class));
|
120 |
+
}
|
121 |
+
|
122 |
+
return $file;
|
123 |
+
}
|
124 |
+
}
|
sdk/Aws/Symfony/Component/ClassLoader/composer.json
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "symfony/class-loader",
|
3 |
+
"type": "library",
|
4 |
+
"description": "Symfony ClassLoader Component",
|
5 |
+
"keywords": [],
|
6 |
+
"homepage": "http://symfony.com",
|
7 |
+
"license": "MIT",
|
8 |
+
"authors": [
|
9 |
+
{
|
10 |
+
"name": "Fabien Potencier",
|
11 |
+
"email": "fabien@symfony.com"
|
12 |
+
},
|
13 |
+
{
|
14 |
+
"name": "Symfony Community",
|
15 |
+
"homepage": "http://symfony.com/contributors"
|
16 |
+
}
|
17 |
+
],
|
18 |
+
"minimum-stability": "dev",
|
19 |
+
"require": {
|
20 |
+
"php": ">=5.3.3"
|
21 |
+
},
|
22 |
+
"require-dev": {
|
23 |
+
"symfony/finder": "~2.0"
|
24 |
+
},
|
25 |
+
"autoload": {
|
26 |
+
"psr-0": { "Symfony\\Component\\ClassLoader\\": "" }
|
27 |
+
},
|
28 |
+
"target-dir": "Symfony/Component/ClassLoader",
|
29 |
+
"extra": {
|
30 |
+
"branch-alias": {
|
31 |
+
"dev-master": "2.2-dev"
|
32 |
+
}
|
33 |
+
}
|
34 |
+
}
|
sdk/Aws/Symfony/Component/ClassLoader/phpunit.xml.dist
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
|
3 |
+
<phpunit backupGlobals="false"
|
4 |
+
backupStaticAttributes="false"
|
5 |
+
colors="true"
|
6 |
+
convertErrorsToExceptions="true"
|
7 |
+
convertNoticesToExceptions="true"
|
8 |
+
convertWarningsToExceptions="true"
|
9 |
+
processIsolation="false"
|
10 |
+
stopOnFailure="false"
|
11 |
+
syntaxCheck="false"
|
12 |
+
bootstrap="vendor/autoload.php"
|
13 |
+
>
|
14 |
+
<testsuites>
|
15 |
+
<testsuite name="Symfony ClassLoader Component Test Suite">
|
16 |
+
<directory>./Tests/</directory>
|
17 |
+
</testsuite>
|
18 |
+
</testsuites>
|
19 |
+
|
20 |
+
<filter>
|
21 |
+
<whitelist>
|
22 |
+
<directory>./</directory>
|
23 |
+
<exclude>
|
24 |
+
<directory>./Resources</directory>
|
25 |
+
<directory>./Tests</directory>
|
26 |
+
<directory>./vendor</directory>
|
27 |
+
</exclude>
|
28 |
+
</whitelist>
|
29 |
+
</filter>
|
30 |
+
</phpunit>
|
sdk/Aws/Symfony/Component/EventDispatcher/CHANGELOG.md
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
CHANGELOG
|
2 |
+
=========
|
3 |
+
|
4 |
+
2.1.0
|
5 |
+
-----
|
6 |
+
|
7 |
+
* added TraceableEventDispatcherInterface
|
8 |
+
* added ContainerAwareEventDispatcher
|
9 |
+
* added a reference to the EventDispatcher on the Event
|
10 |
+
* added a reference to the Event name on the event
|
11 |
+
* added fluid interface to the dispatch() method which now returns the Event
|
12 |
+
object
|
13 |
+
* added GenericEvent event class
|
14 |
+
* added the possibility for subscribers to subscribe several times for the
|
15 |
+
same event
|
16 |
+
* added ImmutableEventDispatcher
|
sdk/Aws/{symfony/event-dispatcher/Symfony → Symfony}/Component/EventDispatcher/ContainerAwareEventDispatcher.php
RENAMED
@@ -60,6 +60,8 @@ class ContainerAwareEventDispatcher extends EventDispatcher
|
|
60 |
* @param integer $priority The higher this value, the earlier an event listener
|
61 |
* will be triggered in the chain.
|
62 |
* Defaults to 0.
|
|
|
|
|
63 |
*/
|
64 |
public function addListenerService($eventName, $callback, $priority = 0)
|
65 |
{
|
60 |
* @param integer $priority The higher this value, the earlier an event listener
|
61 |
* will be triggered in the chain.
|
62 |
* Defaults to 0.
|
63 |
+
*
|
64 |
+
* @throws \InvalidArgumentException
|
65 |
*/
|
66 |
public function addListenerService($eventName, $callback, $priority = 0)
|
67 |
{
|
sdk/Aws/{symfony/event-dispatcher/Symfony → Symfony}/Component/EventDispatcher/Debug/TraceableEventDispatcherInterface.php
RENAMED
File without changes
|
sdk/Aws/{symfony/event-dispatcher/Symfony → Symfony}/Component/EventDispatcher/Event.php
RENAMED
@@ -74,11 +74,11 @@ class Event
|
|
74 |
/**
|
75 |
* Stores the EventDispatcher that dispatches this Event
|
76 |
*
|
77 |
-
* @param
|
78 |
*
|
79 |
* @api
|
80 |
*/
|
81 |
-
public function setDispatcher(
|
82 |
{
|
83 |
$this->dispatcher = $dispatcher;
|
84 |
}
|
@@ -86,7 +86,7 @@ class Event
|
|
86 |
/**
|
87 |
* Returns the EventDispatcher that dispatches this Event
|
88 |
*
|
89 |
-
* @return
|
90 |
*
|
91 |
* @api
|
92 |
*/
|
74 |
/**
|
75 |
* Stores the EventDispatcher that dispatches this Event
|
76 |
*
|
77 |
+
* @param EventDispatcherInterface $dispatcher
|
78 |
*
|
79 |
* @api
|
80 |
*/
|
81 |
+
public function setDispatcher(EventDispatcherInterface $dispatcher)
|
82 |
{
|
83 |
$this->dispatcher = $dispatcher;
|
84 |
}
|
86 |
/**
|
87 |
* Returns the EventDispatcher that dispatches this Event
|
88 |
*
|
89 |
+
* @return EventDispatcherInterface
|
90 |
*
|
91 |
* @api
|
92 |
*/
|
sdk/Aws/{symfony/event-dispatcher/Symfony → Symfony}/Component/EventDispatcher/EventDispatcher.php
RENAMED
@@ -106,7 +106,7 @@ class EventDispatcher implements EventDispatcherInterface
|
|
106 |
}
|
107 |
|
108 |
foreach ($this->listeners[$eventName] as $priority => $listeners) {
|
109 |
-
if (false !== ($key = array_search($listener, $listeners))) {
|
110 |
unset($this->listeners[$eventName][$priority][$key], $this->sorted[$eventName]);
|
111 |
}
|
112 |
}
|
106 |
}
|
107 |
|
108 |
foreach ($this->listeners[$eventName] as $priority => $listeners) {
|
109 |
+
if (false !== ($key = array_search($listener, $listeners, true))) {
|
110 |
unset($this->listeners[$eventName][$priority][$key], $this->sorted[$eventName]);
|
111 |
}
|
112 |
}
|
sdk/Aws/{symfony/event-dispatcher/Symfony → Symfony}/Component/EventDispatcher/EventDispatcherInterface.php
RENAMED
File without changes
|
sdk/Aws/{symfony/event-dispatcher/Symfony → Symfony}/Component/EventDispatcher/EventSubscriberInterface.php
RENAMED
File without changes
|
sdk/Aws/{symfony/event-dispatcher/Symfony → Symfony}/Component/EventDispatcher/GenericEvent.php
RENAMED
@@ -144,8 +144,6 @@ class GenericEvent extends Event implements \ArrayAccess, \IteratorAggregate
|
|
144 |
*
|
145 |
* @param string $key Array key to set.
|
146 |
* @param mixed $value Value.
|
147 |
-
*
|
148 |
-
* @return void
|
149 |
*/
|
150 |
public function offsetSet($key, $value)
|
151 |
{
|
@@ -156,8 +154,6 @@ class GenericEvent extends Event implements \ArrayAccess, \IteratorAggregate
|
|
156 |
* ArrayAccess for unset argument.
|
157 |
*
|
158 |
* @param string $key Array key.
|
159 |
-
*
|
160 |
-
* @return void
|
161 |
*/
|
162 |
public function offsetUnset($key)
|
163 |
{
|
144 |
*
|
145 |
* @param string $key Array key to set.
|
146 |
* @param mixed $value Value.
|
|
|
|
|
147 |
*/
|
148 |
public function offsetSet($key, $value)
|
149 |
{
|
154 |
* ArrayAccess for unset argument.
|
155 |
*
|
156 |
* @param string $key Array key.
|
|
|
|
|
157 |
*/
|
158 |
public function offsetUnset($key)
|
159 |
{
|
sdk/Aws/{symfony/event-dispatcher/Symfony → Symfony}/Component/EventDispatcher/ImmutableEventDispatcher.php
RENAMED
File without changes
|
sdk/Aws/Symfony/Component/EventDispatcher/LICENSE
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Copyright (c) 2004-2013 Fabien Potencier
|
2 |
+
|
3 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
of this software and associated documentation files (the "Software"), to deal
|
5 |
+
in the Software without restriction, including without limitation the rights
|
6 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
copies of the Software, and to permit persons to whom the Software is furnished
|
8 |
+
to do so, subject to the following conditions:
|
9 |
+
|
10 |
+
The above copyright notice and this permission notice shall be included in all
|
11 |
+
copies or substantial portions of the Software.
|
12 |
+
|
13 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
THE SOFTWARE.
|
sdk/Aws/Symfony/Component/EventDispatcher/README.md
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
EventDispatcher Component
|
2 |
+
=========================
|
3 |
+
|
4 |
+
EventDispatcher implements a lightweight version of the Observer design
|
5 |
+
pattern.
|
6 |
+
|
7 |
+
use Symfony\Component\EventDispatcher\EventDispatcher;
|
8 |
+
use Symfony\Component\EventDispatcher\Event;
|
9 |
+
|
10 |
+
$dispatcher = new EventDispatcher();
|
11 |
+
|
12 |
+
$dispatcher->addListener('event_name', function (Event $event) {
|
13 |
+
// ...
|
14 |
+
});
|
15 |
+
|
16 |
+
$dispatcher->dispatch('event_name');
|
17 |
+
|
18 |
+
Resources
|
19 |
+
---------
|
20 |
+
|
21 |
+
You can run the unit tests with the following command:
|
22 |
+
|
23 |
+
$ cd path/to/Symfony/Component/EventDispatcher/
|
24 |
+
$ composer.phar install --dev
|
25 |
+
$ phpunit
|
sdk/Aws/Symfony/Component/EventDispatcher/composer.json
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "symfony/event-dispatcher",
|
3 |
+
"type": "library",
|
4 |
+
"description": "Symfony EventDispatcher Component",
|
5 |
+
"keywords": [],
|
6 |
+
"homepage": "http://symfony.com",
|
7 |
+
"license": "MIT",
|
8 |
+
"authors": [
|
9 |
+
{
|
10 |
+
"name": "Fabien Potencier",
|
11 |
+
"email": "fabien@symfony.com"
|
12 |
+
},
|
13 |
+
{
|
14 |
+
"name": "Symfony Community",
|
15 |
+
"homepage": "http://symfony.com/contributors"
|
16 |
+
}
|
17 |
+
],
|
18 |
+
"require": {
|
19 |
+
"php": ">=5.3.3"
|
20 |
+
},
|
21 |
+
"require-dev": {
|
22 |
+
"symfony/dependency-injection": "~2.0"
|
23 |
+
},
|
24 |
+
"suggest": {
|
25 |
+
"symfony/dependency-injection": "2.2.*",
|
26 |
+
"symfony/http-kernel": "2.2.*"
|
27 |
+
},
|
28 |
+
"autoload": {
|
29 |
+
"psr-0": { "Symfony\\Component\\EventDispatcher\\": "" }
|
30 |
+
},
|
31 |
+
"target-dir": "Symfony/Component/EventDispatcher",
|
32 |
+
"minimum-stability": "dev",
|
33 |
+
"extra": {
|
34 |
+
"branch-alias": {
|
35 |
+
"dev-master": "2.2-dev"
|
36 |
+
}
|
37 |
+
}
|
38 |
+
}
|
sdk/Aws/Symfony/Component/EventDispatcher/phpunit.xml.dist
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
|
3 |
+
<phpunit backupGlobals="false"
|
4 |
+
backupStaticAttributes="false"
|
5 |
+
colors="true"
|
6 |
+
convertErrorsToExceptions="true"
|
7 |
+
convertNoticesToExceptions="true"
|
8 |
+
convertWarningsToExceptions="true"
|
9 |
+
processIsolation="false"
|
10 |
+
stopOnFailure="false"
|
11 |
+
syntaxCheck="false"
|
12 |
+
bootstrap="vendor/autoload.php"
|
13 |
+
>
|
14 |
+
<testsuites>
|
15 |
+
<testsuite name="Symfony EventDispatcher Component Test Suite">
|
16 |
+
<directory>./Tests/</directory>
|
17 |
+
</testsuite>
|
18 |
+
</testsuites>
|
19 |
+
|
20 |
+
<filter>
|
21 |
+
<whitelist>
|
22 |
+
<directory>./</directory>
|
23 |
+
<exclude>
|
24 |
+
<directory>./Resources</directory>
|
25 |
+
<directory>./Tests</directory>
|
26 |
+
<directory>./vendor</directory>
|
27 |
+
</exclude>
|
28 |
+
</whitelist>
|
29 |
+
</filter>
|
30 |
+
</phpunit>
|
sdk/Aws_v1/lib/cachecore/_sql/README
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
The .sql files in this directory contain the code to create the tables for database caching.
|
2 |
+
|
3 |
+
If you're not using database caching, you can safely ignore these.
|
4 |
+
|
5 |
+
If you ARE using database caching, simply load the correct *.sql file into your database to set up the required tables.
|
sdk/Aws_v1/lib/cachecore/_sql/mysql.sql
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
CREATE TABLE `cache` (
|
2 |
+
`id` char(40) NOT NULL default '',
|
3 |
+
`expires` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
|
4 |
+
`data` longtext,
|
5 |
+
PRIMARY KEY (`id`),
|
6 |
+
UNIQUE KEY `id` (`id`)
|
7 |
+
) ENGINE=MyISAM DEFAULT CHARSET=utf8
|
sdk/Aws_v1/lib/cachecore/_sql/pgsql.sql
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
CREATE TABLE "cache" (
|
2 |
+
expires timestamp without time zone NOT NULL,
|
3 |
+
id character(40) NOT NULL,
|
4 |
+
data text NOT NULL
|
5 |
+
)
|
6 |
+
WITH (OIDS=TRUE);
|
sdk/Aws_v1/lib/cachecore/_sql/sqlite3.sql
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
CREATE TABLE cache (id TEXT, expires NUMERIC, data BLOB);
|
2 |
+
CREATE UNIQUE INDEX idx ON cache(id ASC);
|
sdk/Aws_v1/sdk.class.php
CHANGED
@@ -33,8 +33,8 @@ class Parser_Exception extends Exception {}
|
|
33 |
// INTERMEDIARY CONSTANTS
|
34 |
|
35 |
define('CFRUNTIME_NAME', 'aws-sdk-php');
|
36 |
-
define('CFRUNTIME_VERSION', '1.6.
|
37 |
-
define('CFRUNTIME_BUILD', '
|
38 |
$user_agent = sprintf('%s/%s PHP/%s', CFRUNTIME_NAME, CFRUNTIME_VERSION, PHP_VERSION);
|
39 |
if (function_exists('curl_version'))
|
40 |
{
|
33 |
// INTERMEDIARY CONSTANTS
|
34 |
|
35 |
define('CFRUNTIME_NAME', 'aws-sdk-php');
|
36 |
+
define('CFRUNTIME_VERSION', '1.6.2');
|
37 |
+
define('CFRUNTIME_BUILD', '20130314130000');
|
38 |
$user_agent = sprintf('%s/%s PHP/%s', CFRUNTIME_NAME, CFRUNTIME_VERSION, PHP_VERSION);
|
39 |
if (function_exists('curl_version'))
|
40 |
{
|
sdk/Aws_v1/services/ec2.class.php
CHANGED
@@ -29,7 +29,7 @@
|
|
29 |
*
|
30 |
* Visit <a href="http://aws.amazon.com/ec2/">http://aws.amazon.com/ec2/</a> for more information.
|
31 |
*
|
32 |
-
* @version 2013.03.
|
33 |
* @license See the included NOTICE.md file for complete information.
|
34 |
* @copyright See the included NOTICE.md file for complete information.
|
35 |
* @link http://aws.amazon.com/ec2/ Amazon EC2
|
@@ -3505,8 +3505,7 @@ class AmazonEC2 extends CFRuntime
|
|
3505 |
*
|
3506 |
* @param string $vpc_id (Required)
|
3507 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
3508 |
-
* <li><code>
|
3509 |
-
* <li><code>EnableDnsHostnames</code> - <code>string</code> - Optional - </li>
|
3510 |
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
3511 |
* <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
|
3512 |
* @return CFResponse A <CFResponse> object containing a parsed HTTP response.
|
@@ -4365,18 +4364,19 @@ class AmazonEC2 extends CFRuntime
|
|
4365 |
/**
|
4366 |
*
|
4367 |
*
|
|
|
4368 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
4369 |
-
* <li><code>VpcId</code> - <code>string</code> - Optional - </li>
|
4370 |
* <li><code>EnableDnsSupport.Value</code> - <code>boolean</code> - Optional - Boolean value</li>
|
4371 |
* <li><code>EnableDnsHostnames.Value</code> - <code>boolean</code> - Optional - Boolean value</li>
|
4372 |
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
4373 |
* <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
|
4374 |
* @return CFResponse A <CFResponse> object containing a parsed HTTP response.
|
4375 |
*/
|
4376 |
-
public function modify_vpc_attribute($opt = null)
|
4377 |
{
|
4378 |
if (!$opt) $opt = array();
|
4379 |
-
|
|
|
4380 |
return $this->authenticate('ModifyVpcAttribute', $opt);
|
4381 |
}
|
4382 |
|
29 |
*
|
30 |
* Visit <a href="http://aws.amazon.com/ec2/">http://aws.amazon.com/ec2/</a> for more information.
|
31 |
*
|
32 |
+
* @version 2013.03.14
|
33 |
* @license See the included NOTICE.md file for complete information.
|
34 |
* @copyright See the included NOTICE.md file for complete information.
|
35 |
* @link http://aws.amazon.com/ec2/ Amazon EC2
|
3505 |
*
|
3506 |
* @param string $vpc_id (Required)
|
3507 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
3508 |
+
* <li><code>Attribute</code> - <code>string</code> - Optional - [Allowed values: <code>enableDnsSupport</code>, <code>enableDnsHostnames</code>]</li>
|
|
|
3509 |
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
3510 |
* <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
|
3511 |
* @return CFResponse A <CFResponse> object containing a parsed HTTP response.
|
4364 |
/**
|
4365 |
*
|
4366 |
*
|
4367 |
+
* @param string $vpc_id (Required)
|
4368 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
|
|
4369 |
* <li><code>EnableDnsSupport.Value</code> - <code>boolean</code> - Optional - Boolean value</li>
|
4370 |
* <li><code>EnableDnsHostnames.Value</code> - <code>boolean</code> - Optional - Boolean value</li>
|
4371 |
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
4372 |
* <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
|
4373 |
* @return CFResponse A <CFResponse> object containing a parsed HTTP response.
|
4374 |
*/
|
4375 |
+
public function modify_vpc_attribute($vpc_id, $opt = null)
|
4376 |
{
|
4377 |
if (!$opt) $opt = array();
|
4378 |
+
$opt['VpcId'] = $vpc_id;
|
4379 |
+
|
4380 |
return $this->authenticate('ModifyVpcAttribute', $opt);
|
4381 |
}
|
4382 |
|
sdk/Aws_v1/services/rds.class.php
CHANGED
@@ -39,7 +39,7 @@
|
|
39 |
* <a href="http://docs.amazonwebservices.com/AmazonRDS/latest/UserGuide/">Amazon RDS User
|
40 |
* Guide</a>.
|
41 |
*
|
42 |
-
* @version 2013.
|
43 |
* @license See the included NOTICE.md file for complete information.
|
44 |
* @copyright See the included NOTICE.md file for complete information.
|
45 |
* @link http://aws.amazon.com/rds/ Amazon Relational Database Service
|
@@ -158,7 +158,7 @@ class AmazonRDS extends CFRuntime
|
|
158 |
*/
|
159 |
public function __construct(array $options = array())
|
160 |
{
|
161 |
-
$this->api_version = '2013-
|
162 |
$this->hostname = self::DEFAULT_URL;
|
163 |
$this->auth_class = 'AuthV4Query';
|
164 |
|
@@ -188,10 +188,10 @@ class AmazonRDS extends CFRuntime
|
|
188 |
// SERVICE METHODS
|
189 |
|
190 |
/**
|
191 |
-
*
|
192 |
*
|
193 |
-
* @param string $subscription_name (Required)
|
194 |
-
* @param string $source_identifier (Required)
|
195 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
196 |
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
197 |
* <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
|
@@ -482,31 +482,15 @@ class AmazonRDS extends CFRuntime
|
|
482 |
}
|
483 |
|
484 |
/**
|
485 |
-
*
|
486 |
-
* Resource Name) created by either the RDS console, the SNS console, or the SNS API. To obtain an
|
487 |
-
* ARN with SNS, you must create a topic in Amazon SNS and subscribe to the topic. The ARN is
|
488 |
-
* displayed in the SNS console.
|
489 |
-
*
|
490 |
-
* You can specify the type of source (SourceType) you want to be notified of, provide a list of
|
491 |
-
* RDS sources (SourceIds) that triggers the events, and provide a list of event categories
|
492 |
-
* (EventCategories) for events you want to be notified of. For example, you can specify
|
493 |
-
* SourceType = db-instance, SourceIds = mydbinstance1, mydbinstance2 and EventCategories =
|
494 |
-
* Availability, Backup.
|
495 |
-
*
|
496 |
-
* If you specify both the SourceType and SourceIds, such as SourceType = db-instance and
|
497 |
-
* SourceIdentifier = myDBInstance1, you will be notified of all the db-instance events for the
|
498 |
-
* specified source. If you specify a SourceType but do not specify a SourceIdentifier, you will
|
499 |
-
* receive notice of the events for that source type for all your RDS sources. If you do not
|
500 |
-
* specify either the SourceType nor the SourceIdentifier, you will be notified of events
|
501 |
-
* generated from all RDS sources belonging to your customer account.
|
502 |
*
|
503 |
-
* @param string $subscription_name (Required)
|
504 |
-
* @param string $sns_topic_arn (Required)
|
505 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
506 |
-
* <li><code>SourceType</code> - <code>string</code> - Optional -
|
507 |
-
* <li><code>EventCategories</code> - <code>string|array</code> - Optional -
|
508 |
-
* <li><code>SourceIds</code> - <code>string|array</code> - Optional -
|
509 |
-
* <li><code>Enabled</code> - <code>boolean</code> - Optional -
|
510 |
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
511 |
* <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
|
512 |
* @return CFResponse A <CFResponse> object containing a parsed HTTP response.
|
@@ -670,9 +654,9 @@ class AmazonRDS extends CFRuntime
|
|
670 |
}
|
671 |
|
672 |
/**
|
673 |
-
*
|
674 |
*
|
675 |
-
* @param string $subscription_name (Required)
|
676 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
677 |
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
678 |
* <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
|
@@ -743,6 +727,27 @@ class AmazonRDS extends CFRuntime
|
|
743 |
return $this->authenticate('DescribeDBInstances', $opt);
|
744 |
}
|
745 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
746 |
/**
|
747 |
* Returns a list of DBParameterGroup descriptions. If a DBParameterGroupName is specified, the
|
748 |
* list will contain only the description of the specified DBParameterGroup.
|
@@ -866,13 +871,10 @@ class AmazonRDS extends CFRuntime
|
|
866 |
}
|
867 |
|
868 |
/**
|
869 |
-
*
|
870 |
-
* source type. You can see a list of the event categories and source types in the <a href=
|
871 |
-
* "http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Events.html">Events</a> topic in
|
872 |
-
* the Amazon RDS User Guide.
|
873 |
*
|
874 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
875 |
-
* <li><code>SourceType</code> - <code>string</code> - Optional -
|
876 |
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
877 |
* <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
|
878 |
* @return CFResponse A <CFResponse> object containing a parsed HTTP response.
|
@@ -885,16 +887,12 @@ class AmazonRDS extends CFRuntime
|
|
885 |
}
|
886 |
|
887 |
/**
|
888 |
-
*
|
889 |
-
* subscription includes SubscriptionName, SNSTopicARN, CustomerID, SourceType, SourceID,
|
890 |
-
* CreationTime, and Status.
|
891 |
-
*
|
892 |
-
* If you specify a SubscriptionName, lists the description for that subscription.
|
893 |
*
|
894 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
895 |
-
* <li><code>SubscriptionName</code> - <code>string</code> - Optional -
|
896 |
-
* <li><code>MaxRecords</code> - <code>integer</code> - Optional -
|
897 |
-
* <li><code>Marker</code> - <code>string</code> - Optional -
|
898 |
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
899 |
* <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
|
900 |
* @return CFResponse A <CFResponse> object containing a parsed HTTP response.
|
@@ -907,14 +905,10 @@ class AmazonRDS extends CFRuntime
|
|
907 |
}
|
908 |
|
909 |
/**
|
910 |
-
* Returns events related to DB
|
911 |
-
*
|
912 |
-
*
|
913 |
-
*
|
914 |
-
*
|
915 |
-
* You can see a list of event categories and source types in the <a href=
|
916 |
-
* "http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Events.html">Events</a> topic in
|
917 |
-
* the Amazon RDS User Guide.
|
918 |
*
|
919 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
920 |
* <li><code>SourceIdentifier</code> - <code>string</code> - Optional - The identifier of the event source for which events will be returned. If not specified, then all sources are included in the response. Constraints:<ul><li>If SourceIdentifier is supplied, SourceType must also be provided.</li><li>If the source type is DBInstance, then a DBInstanceIdentifier must be supplied.</li><li>If the source type is DBSecurityGroup, a DBSecurityGroupName must be supplied.</li><li>If the source type is DBParameterGroup, a DBParameterGroupName must be supplied.</li><li>If the source type is DBSnapshot, a DBSnapshotIdentifier must be supplied.</li><li>Cannot end with a hyphen or contain two consecutive hyphens.</li></ul></li>
|
@@ -922,7 +916,7 @@ class AmazonRDS extends CFRuntime
|
|
922 |
* <li><code>StartTime</code> - <code>string</code> - Optional - The beginning of the time interval to retrieve events for, specified in ISO 8601 format. For more information about ISO 8601, go to the <a href="http://en.wikipedia.org/wiki/ISO_8601">ISO8601 Wikipedia page.</a> Example: 2009-07-08T18:00Z May be passed as a number of seconds since UNIX Epoch, or any string compatible with <php:strtotime()>.</li>
|
923 |
* <li><code>EndTime</code> - <code>string</code> - Optional - The end of the time interval for which to retrieve events, specified in ISO 8601 format. For more information about ISO 8601, go to the <a href="http://en.wikipedia.org/wiki/ISO_8601">ISO8601 Wikipedia page.</a> Example: 2009-07-08T18:00Z May be passed as a number of seconds since UNIX Epoch, or any string compatible with <php:strtotime()>.</li>
|
924 |
* <li><code>Duration</code> - <code>integer</code> - Optional - The number of minutes to retrieve events for. Default: 60</li>
|
925 |
-
* <li><code>EventCategories</code> - <code>string|array</code> - Optional -
|
926 |
* <li><code>MaxRecords</code> - <code>integer</code> - Optional - The maximum number of records to include in the response. If more records exist than the specified <code>MaxRecords</code> value, a pagination token called a marker is included in the response so that the remaining results may be retrieved. Default: 100 Constraints: minimum 20, maximum 100</li>
|
927 |
* <li><code>Marker</code> - <code>string</code> - Optional - An optional pagination token provided by a previous DescribeEvents request. If this parameter is specified, the response includes only records beyond the marker, up to the value specified by <code>MaxRecords</code>.</li>
|
928 |
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
@@ -960,7 +954,7 @@ class AmazonRDS extends CFRuntime
|
|
960 |
/**
|
961 |
* Describes all available options.
|
962 |
*
|
963 |
-
* @param string $engine_name (Required) Options available for the given
|
964 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
965 |
* <li><code>MajorEngineVersion</code> - <code>string</code> - Optional - If specified, filters the results to include only options for the specified major engine version.</li>
|
966 |
* <li><code>MaxRecords</code> - <code>integer</code> - Optional - The maximum number of records to include in the response. If more records exist than the specified <code>MaxRecords</code> value, a pagination token called a marker is included in the response so that the remaining results can be retrieved. Default: 100 Constraints: minimum 20, maximum 100</li>
|
@@ -1068,6 +1062,25 @@ class AmazonRDS extends CFRuntime
|
|
1068 |
return $this->authenticate('DescribeReservedDBInstancesOfferings', $opt);
|
1069 |
}
|
1070 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1071 |
/**
|
1072 |
* Lists all tags on a DB Instance.
|
1073 |
*
|
@@ -1212,21 +1225,14 @@ class AmazonRDS extends CFRuntime
|
|
1212 |
}
|
1213 |
|
1214 |
/**
|
1215 |
-
*
|
1216 |
-
* source identifiers using this call; to change source identifiers for a subscription, use the
|
1217 |
-
* <code>AddSourceIdentifierToSubscription</code> and
|
1218 |
-
* <code>RemoveSourceIdentifierFromSubscription</code> calls.
|
1219 |
-
*
|
1220 |
-
* You can see a list of the event categories for a given SourceType in the <a href=
|
1221 |
-
* "http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Events.html">Events</a> topic in
|
1222 |
-
* the Amazon RDS User Guide or by using the <strong>DescribeEventCategories</strong> action.
|
1223 |
*
|
1224 |
-
* @param string $subscription_name (Required)
|
1225 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
1226 |
-
* <li><code>SnsTopicArn</code> - <code>string</code> - Optional -
|
1227 |
-
* <li><code>SourceType</code> - <code>string</code> - Optional -
|
1228 |
-
* <li><code>EventCategories</code> - <code>string|array</code> - Optional -
|
1229 |
-
* <li><code>Enabled</code> - <code>boolean</code> - Optional -
|
1230 |
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
1231 |
* <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
|
1232 |
* @return CFResponse A <CFResponse> object containing a parsed HTTP response.
|
@@ -1259,6 +1265,19 @@ class AmazonRDS extends CFRuntime
|
|
1259 |
* <li><code>Port</code> - <code>integer</code> - Optional - The optional port for the option.</li>
|
1260 |
* <li><code>DBSecurityGroupMemberships</code> - <code>string|array</code> - Optional - A list of DBSecurityGroupMemebrship name strings used for this option. Pass a string for a single value, or an indexed array for multiple values.</li>
|
1261 |
* <li><code>VpcSecurityGroupMemberships</code> - <code>string|array</code> - Optional - A list of VpcSecurityGroupMemebrship name strings used for this option. Pass a string for a single value, or an indexed array for multiple values.</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1262 |
* </ul></li>
|
1263 |
* </ul></li>
|
1264 |
* <li><code>OptionsToRemove</code> - <code>string|array</code> - Optional - Options in this list are removed from the Option Group. Pass a string for a single value, or an indexed array for multiple values.</li>
|
@@ -1355,10 +1374,10 @@ class AmazonRDS extends CFRuntime
|
|
1355 |
}
|
1356 |
|
1357 |
/**
|
1358 |
-
*
|
1359 |
*
|
1360 |
-
* @param string $subscription_name (Required)
|
1361 |
-
* @param string $source_identifier (Required)
|
1362 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
1363 |
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
1364 |
* <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
|
39 |
* <a href="http://docs.amazonwebservices.com/AmazonRDS/latest/UserGuide/">Amazon RDS User
|
40 |
* Guide</a>.
|
41 |
*
|
42 |
+
* @version 2013.03.14
|
43 |
* @license See the included NOTICE.md file for complete information.
|
44 |
* @copyright See the included NOTICE.md file for complete information.
|
45 |
* @link http://aws.amazon.com/rds/ Amazon Relational Database Service
|
158 |
*/
|
159 |
public function __construct(array $options = array())
|
160 |
{
|
161 |
+
$this->api_version = '2013-02-12';
|
162 |
$this->hostname = self::DEFAULT_URL;
|
163 |
$this->auth_class = 'AuthV4Query';
|
164 |
|
188 |
// SERVICE METHODS
|
189 |
|
190 |
/**
|
191 |
+
*
|
192 |
*
|
193 |
+
* @param string $subscription_name (Required)
|
194 |
+
* @param string $source_identifier (Required)
|
195 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
196 |
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
197 |
* <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
|
482 |
}
|
483 |
|
484 |
/**
|
485 |
+
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
486 |
*
|
487 |
+
* @param string $subscription_name (Required)
|
488 |
+
* @param string $sns_topic_arn (Required)
|
489 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
490 |
+
* <li><code>SourceType</code> - <code>string</code> - Optional - </li>
|
491 |
+
* <li><code>EventCategories</code> - <code>string|array</code> - Optional - Pass a string for a single value, or an indexed array for multiple values.</li>
|
492 |
+
* <li><code>SourceIds</code> - <code>string|array</code> - Optional - Pass a string for a single value, or an indexed array for multiple values.</li>
|
493 |
+
* <li><code>Enabled</code> - <code>boolean</code> - Optional - </li>
|
494 |
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
495 |
* <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
|
496 |
* @return CFResponse A <CFResponse> object containing a parsed HTTP response.
|
654 |
}
|
655 |
|
656 |
/**
|
657 |
+
*
|
658 |
*
|
659 |
+
* @param string $subscription_name (Required)
|
660 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
661 |
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
662 |
* <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
|
727 |
return $this->authenticate('DescribeDBInstances', $opt);
|
728 |
}
|
729 |
|
730 |
+
/**
|
731 |
+
* Returns a list of DB log files for the DB instance.
|
732 |
+
*
|
733 |
+
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
734 |
+
* <li><code>DBInstanceIdentifier</code> - <code>string</code> - Optional - The customer-assigned name of the DB Instance that contains the log files you want to list. Constraints:<ul><li>Must contain from 1 to 63 alphanumeric characters or hyphens</li><li>First character must be a letter</li><li>Cannot end with a hyphen or contain two consecutive hyphens</li></ul></li>
|
735 |
+
* <li><code>FilenameContains</code> - <code>string</code> - Optional - Filters the available log files for log file names that contain the specified string.</li>
|
736 |
+
* <li><code>FileLastWritten</code> - <code>long</code> - Optional - Filters the available log files for files written since the specified date.</li>
|
737 |
+
* <li><code>FileSize</code> - <code>long</code> - Optional - Filters the available log files for files larger than the specified size.</li>
|
738 |
+
* <li><code>MaxRecords</code> - <code>integer</code> - Optional - The maximum number of records to include in the response. If more records exist than the specified MaxRecords value, a pagination token called a marker is included in the response so that the remaining results can be retrieved.</li>
|
739 |
+
* <li><code>Marker</code> - <code>string</code> - Optional - The pagination token provided in the previous request. If this parameter is specified the response includes only records beyond the marker, up to MaxRecords.</li>
|
740 |
+
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
741 |
+
* <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
|
742 |
+
* @return CFResponse A <CFResponse> object containing a parsed HTTP response.
|
743 |
+
*/
|
744 |
+
public function describe_db_log_files($opt = null)
|
745 |
+
{
|
746 |
+
if (!$opt) $opt = array();
|
747 |
+
|
748 |
+
return $this->authenticate('DescribeDBLogFiles', $opt);
|
749 |
+
}
|
750 |
+
|
751 |
/**
|
752 |
* Returns a list of DBParameterGroup descriptions. If a DBParameterGroupName is specified, the
|
753 |
* list will contain only the description of the specified DBParameterGroup.
|
871 |
}
|
872 |
|
873 |
/**
|
874 |
+
*
|
|
|
|
|
|
|
875 |
*
|
876 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
877 |
+
* <li><code>SourceType</code> - <code>string</code> - Optional - </li>
|
878 |
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
879 |
* <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
|
880 |
* @return CFResponse A <CFResponse> object containing a parsed HTTP response.
|
887 |
}
|
888 |
|
889 |
/**
|
890 |
+
*
|
|
|
|
|
|
|
|
|
891 |
*
|
892 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
893 |
+
* <li><code>SubscriptionName</code> - <code>string</code> - Optional - </li>
|
894 |
+
* <li><code>MaxRecords</code> - <code>integer</code> - Optional - </li>
|
895 |
+
* <li><code>Marker</code> - <code>string</code> - Optional - </li>
|
896 |
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
897 |
* <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
|
898 |
* @return CFResponse A <CFResponse> object containing a parsed HTTP response.
|
905 |
}
|
906 |
|
907 |
/**
|
908 |
+
* Returns events related to DB Instances, DB Security Groups, DB Snapshots and DB Parameter
|
909 |
+
* Groups for the past 14 days. Events specific to a particular DB Instance, DB Security Group,
|
910 |
+
* database snapshot or DB Parameter Group can be obtained by providing the name as a parameter.
|
911 |
+
* By default, the past hour of events are returned.
|
|
|
|
|
|
|
|
|
912 |
*
|
913 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
914 |
* <li><code>SourceIdentifier</code> - <code>string</code> - Optional - The identifier of the event source for which events will be returned. If not specified, then all sources are included in the response. Constraints:<ul><li>If SourceIdentifier is supplied, SourceType must also be provided.</li><li>If the source type is DBInstance, then a DBInstanceIdentifier must be supplied.</li><li>If the source type is DBSecurityGroup, a DBSecurityGroupName must be supplied.</li><li>If the source type is DBParameterGroup, a DBParameterGroupName must be supplied.</li><li>If the source type is DBSnapshot, a DBSnapshotIdentifier must be supplied.</li><li>Cannot end with a hyphen or contain two consecutive hyphens.</li></ul></li>
|
916 |
* <li><code>StartTime</code> - <code>string</code> - Optional - The beginning of the time interval to retrieve events for, specified in ISO 8601 format. For more information about ISO 8601, go to the <a href="http://en.wikipedia.org/wiki/ISO_8601">ISO8601 Wikipedia page.</a> Example: 2009-07-08T18:00Z May be passed as a number of seconds since UNIX Epoch, or any string compatible with <php:strtotime()>.</li>
|
917 |
* <li><code>EndTime</code> - <code>string</code> - Optional - The end of the time interval for which to retrieve events, specified in ISO 8601 format. For more information about ISO 8601, go to the <a href="http://en.wikipedia.org/wiki/ISO_8601">ISO8601 Wikipedia page.</a> Example: 2009-07-08T18:00Z May be passed as a number of seconds since UNIX Epoch, or any string compatible with <php:strtotime()>.</li>
|
918 |
* <li><code>Duration</code> - <code>integer</code> - Optional - The number of minutes to retrieve events for. Default: 60</li>
|
919 |
+
* <li><code>EventCategories</code> - <code>string|array</code> - Optional - Pass a string for a single value, or an indexed array for multiple values.</li>
|
920 |
* <li><code>MaxRecords</code> - <code>integer</code> - Optional - The maximum number of records to include in the response. If more records exist than the specified <code>MaxRecords</code> value, a pagination token called a marker is included in the response so that the remaining results may be retrieved. Default: 100 Constraints: minimum 20, maximum 100</li>
|
921 |
* <li><code>Marker</code> - <code>string</code> - Optional - An optional pagination token provided by a previous DescribeEvents request. If this parameter is specified, the response includes only records beyond the marker, up to the value specified by <code>MaxRecords</code>.</li>
|
922 |
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
954 |
/**
|
955 |
* Describes all available options.
|
956 |
*
|
957 |
+
* @param string $engine_name (Required) A required parameter. Options available for the given Engine name will be described.
|
958 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
959 |
* <li><code>MajorEngineVersion</code> - <code>string</code> - Optional - If specified, filters the results to include only options for the specified major engine version.</li>
|
960 |
* <li><code>MaxRecords</code> - <code>integer</code> - Optional - The maximum number of records to include in the response. If more records exist than the specified <code>MaxRecords</code> value, a pagination token called a marker is included in the response so that the remaining results can be retrieved. Default: 100 Constraints: minimum 20, maximum 100</li>
|
1062 |
return $this->authenticate('DescribeReservedDBInstancesOfferings', $opt);
|
1063 |
}
|
1064 |
|
1065 |
+
/**
|
1066 |
+
* Downloads the last line of the specified log file.
|
1067 |
+
*
|
1068 |
+
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
1069 |
+
* <li><code>DBInstanceIdentifier</code> - <code>string</code> - Optional - The customer-assigned name of the DB Instance that contains the log files you want to list. Constraints:<ul><li>Must contain from 1 to 63 alphanumeric characters or hyphens</li><li>First character must be a letter</li><li>Cannot end with a hyphen or contain two consecutive hyphens</li></ul></li>
|
1070 |
+
* <li><code>LogFileName</code> - <code>string</code> - Optional - The name of the log file to be downloaded.</li>
|
1071 |
+
* <li><code>Marker</code> - <code>string</code> - Optional - The pagination token provided in the previous request. If this parameter is specified the response includes only records beyond the marker, up to MaxRecords.</li>
|
1072 |
+
* <li><code>NumberOfLines</code> - <code>integer</code> - Optional - The number of lines remaining to be downloaded.</li>
|
1073 |
+
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
1074 |
+
* <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
|
1075 |
+
* @return CFResponse A <CFResponse> object containing a parsed HTTP response.
|
1076 |
+
*/
|
1077 |
+
public function download_db_log_file_portion($opt = null)
|
1078 |
+
{
|
1079 |
+
if (!$opt) $opt = array();
|
1080 |
+
|
1081 |
+
return $this->authenticate('DownloadDBLogFilePortion', $opt);
|
1082 |
+
}
|
1083 |
+
|
1084 |
/**
|
1085 |
* Lists all tags on a DB Instance.
|
1086 |
*
|
1225 |
}
|
1226 |
|
1227 |
/**
|
1228 |
+
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1229 |
*
|
1230 |
+
* @param string $subscription_name (Required)
|
1231 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
1232 |
+
* <li><code>SnsTopicArn</code> - <code>string</code> - Optional - </li>
|
1233 |
+
* <li><code>SourceType</code> - <code>string</code> - Optional - </li>
|
1234 |
+
* <li><code>EventCategories</code> - <code>string|array</code> - Optional - Pass a string for a single value, or an indexed array for multiple values.</li>
|
1235 |
+
* <li><code>Enabled</code> - <code>boolean</code> - Optional - </li>
|
1236 |
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
1237 |
* <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
|
1238 |
* @return CFResponse A <CFResponse> object containing a parsed HTTP response.
|
1265 |
* <li><code>Port</code> - <code>integer</code> - Optional - The optional port for the option.</li>
|
1266 |
* <li><code>DBSecurityGroupMemberships</code> - <code>string|array</code> - Optional - A list of DBSecurityGroupMemebrship name strings used for this option. Pass a string for a single value, or an indexed array for multiple values.</li>
|
1267 |
* <li><code>VpcSecurityGroupMemberships</code> - <code>string|array</code> - Optional - A list of VpcSecurityGroupMemebrship name strings used for this option. Pass a string for a single value, or an indexed array for multiple values.</li>
|
1268 |
+
* <li><code>OptionSettings</code> - <code>array</code> - Optional - A list of option settings applied for this option. <ul>
|
1269 |
+
* <li><code>x</code> - <code>array</code> - Optional - This represents a simple array index. <ul>
|
1270 |
+
* <li><code>Name</code> - <code>string</code> - Optional - The name of the setting.</li>
|
1271 |
+
* <li><code>Value</code> - <code>string</code> - Optional - The value of this setting.</li>
|
1272 |
+
* <li><code>DefaultValue</code> - <code>string</code> - Optional - Default value for this setting.</li>
|
1273 |
+
* <li><code>Description</code> - <code>string</code> - Optional - The description of the setting.</li>
|
1274 |
+
* <li><code>ApplyType</code> - <code>string</code> - Optional - Specifies the apply type for this setting.</li>
|
1275 |
+
* <li><code>DataType</code> - <code>string</code> - Optional - Specifies the valid data type of this setting</li>
|
1276 |
+
* <li><code>AllowedValues</code> - <code>string</code> - Optional - Specifies a valid list/range of values allowed for this setting.</li>
|
1277 |
+
* <li><code>IsModifiable</code> - <code>boolean</code> - Optional - Indicates if the setting is modifiable or not.</li>
|
1278 |
+
* <li><code>IsCollection</code> - <code>boolean</code> - Optional - Indicates if the value for the setting can be a list of values or a single value.</li>
|
1279 |
+
* </ul></li>
|
1280 |
+
* </ul></li>
|
1281 |
* </ul></li>
|
1282 |
* </ul></li>
|
1283 |
* <li><code>OptionsToRemove</code> - <code>string|array</code> - Optional - Options in this list are removed from the Option Group. Pass a string for a single value, or an indexed array for multiple values.</li>
|
1374 |
}
|
1375 |
|
1376 |
/**
|
1377 |
+
*
|
1378 |
*
|
1379 |
+
* @param string $subscription_name (Required)
|
1380 |
+
* @param string $source_identifier (Required)
|
1381 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
1382 |
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
1383 |
* <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
|
sdk/Aws_v1/services/s3.class.php
CHANGED
@@ -3654,7 +3654,7 @@ class AmazonS3 extends CFRuntime
|
|
3654 |
* Creates an Amazon S3 object using the multipart upload APIs. It is analogous to <create_object()>.
|
3655 |
*
|
3656 |
* While each individual part of a multipart upload can hold up to 5 GB of data, this method limits the
|
3657 |
-
* part size to a maximum of 500 MB. The combined size of all parts
|
3658 |
* object is stored in Amazon S3, the data is streamed to multiple storage servers in multiple data
|
3659 |
* centers. This ensures the data remains available in the event of internal network or hardware failure.
|
3660 |
*
|
3654 |
* Creates an Amazon S3 object using the multipart upload APIs. It is analogous to <create_object()>.
|
3655 |
*
|
3656 |
* While each individual part of a multipart upload can hold up to 5 GB of data, this method limits the
|
3657 |
+
* part size to a maximum of 500 MB. The combined size of all parts can not exceed 5 TB of data. When an
|
3658 |
* object is stored in Amazon S3, the data is streamed to multiple storage servers in multiple data
|
3659 |
* centers. This ensures the data remains available in the event of internal network or hardware failure.
|
3660 |
*
|
sdk/OpenCloud/Autoload.php
ADDED
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class SplClassLoader
|
4 |
+
{
|
5 |
+
private $_fileExtension = '.php';
|
6 |
+
private $_namespace;
|
7 |
+
private $_includePath;
|
8 |
+
private $_namespaceSeparator = '\\';
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Creates a new <tt>SplClassLoader</tt> that loads classes of the
|
12 |
+
* specified namespace.
|
13 |
+
*
|
14 |
+
* @param string $ns The namespace to use.
|
15 |
+
*/
|
16 |
+
public function __construct($ns = null, $includePath = null)
|
17 |
+
{
|
18 |
+
$this->_namespace = $ns;
|
19 |
+
$this->_includePath = $includePath;
|
20 |
+
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Sets the namespace separator used by classes in the namespace of
|
24 |
+
* this class loader.
|
25 |
+
*
|
26 |
+
* @param string $sep The separator to use.
|
27 |
+
*/
|
28 |
+
public function setNamespaceSeparator($sep)
|
29 |
+
{
|
30 |
+
$this->_namespaceSeparator = $sep;
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Gets the namespace seperator used by classes in the namespace of
|
35 |
+
* this class loader.
|
36 |
+
*
|
37 |
+
* @return void
|
38 |
+
*/
|
39 |
+
public function getNamespaceSeparator()
|
40 |
+
{
|
41 |
+
return $this->_namespaceSeparator;
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Sets the base include path for all class files in the namespace of
|
46 |
+
* this class loader.
|
47 |
+
*
|
48 |
+
* @param string $includePath
|
49 |
+
*/
|
50 |
+
public function setIncludePath($includePath)
|
51 |
+
{
|
52 |
+
$this->_includePath = $includePath;
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Gets the base include path for all class files in the namespace of
|
57 |
+
* this class loader.
|
58 |
+
*
|
59 |
+
* @return string $includePath
|
60 |
+
*/
|
61 |
+
public function getIncludePath()
|
62 |
+
{
|
63 |
+
return $this->_includePath;
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Sets the file extension of class files in the namespace of this
|
68 |
+
* class loader.
|
69 |
+
*
|
70 |
+
* @param string $fileExtension
|
71 |
+
*/
|
72 |
+
public function setFileExtension($fileExtension)
|
73 |
+
{
|
74 |
+
$this->_fileExtension = $fileExtension;
|
75 |
+
}
|
76 |
+
|
77 |
+
/**
|
78 |
+
* Gets the file extension of class files in the namespace of this
|
79 |
+
* class loader.
|
80 |
+
*
|
81 |
+
* @return string $fileExtension
|
82 |
+
*/
|
83 |
+
public function getFileExtension()
|
84 |
+
{
|
85 |
+
return $this->_fileExtension;
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Installs this class loader on the SPL autoload stack.
|
90 |
+
*/
|
91 |
+
public function register()
|
92 |
+
{
|
93 |
+
spl_autoload_register(array($this, 'loadClass'));
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Uninstalls this class loader from the SPL autoloader stack.
|
98 |
+
*/
|
99 |
+
public function unregister()
|
100 |
+
{
|
101 |
+
spl_autoload_unregister(array($this, 'loadClass'));
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Loads the given class or interface.
|
106 |
+
*
|
107 |
+
* @param string $className The name of the class to load.
|
108 |
+
* @return void
|
109 |
+
*/
|
110 |
+
public function loadClass($className)
|
111 |
+
{
|
112 |
+
if (null === $this->_namespace || $this->_namespace.$this->_namespaceSeparator === substr($className, 0, strlen($this->_namespace.$this->_namespaceSeparator))) {
|
113 |
+
$fileName = '';
|
114 |
+
$namespace = '';
|
115 |
+
if (false !== ($lastNsPos = strripos($className, $this->_namespaceSeparator))) {
|
116 |
+
$namespace = substr($className, 0, $lastNsPos);
|
117 |
+
$className = substr($className, $lastNsPos + 1);
|
118 |
+
$fileName = str_replace($this->_namespaceSeparator, DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR;
|
119 |
+
}
|
120 |
+
$fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . $this->_fileExtension;
|
121 |
+
|
122 |
+
require ($this->_includePath !== null ? $this->_includePath . DIRECTORY_SEPARATOR : '') . $fileName;
|
123 |
+
}
|
124 |
+
}
|
125 |
+
}
|
sdk/OpenCloud/{collection.php → OpenCloud/AbstractClass/Collection.php}
RENAMED
@@ -1,18 +1,6 @@
|
|
1 |
<?php
|
2 |
-
/**
|
3 |
-
* An abstraction for working with ordered sets of objects
|
4 |
-
*
|
5 |
-
* @copyright 2012-2013 Rackspace Hosting, Inc.
|
6 |
-
* See COPYING for licensing information
|
7 |
-
*
|
8 |
-
* @package phpOpenCloud
|
9 |
-
* @version 1.1
|
10 |
-
* @author Glen Campbell <glen.campbell@rackspace.com>
|
11 |
-
*/
|
12 |
-
|
13 |
-
namespace OpenCloud;
|
14 |
|
15 |
-
|
16 |
|
17 |
/**
|
18 |
* Provides an abstraction for working with ordered sets of objects
|
@@ -23,7 +11,7 @@ require_once(__DIR__.'/base.php');
|
|
23 |
* @since 1.0
|
24 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
25 |
*/
|
26 |
-
class Collection extends Base {
|
27 |
|
28 |
private
|
29 |
$service,
|
@@ -38,6 +26,14 @@ class Collection extends Base {
|
|
38 |
/**
|
39 |
* A Collection is an array of objects
|
40 |
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
* @param Service $service - the service associated with the collection
|
42 |
* @param string $itemclass - the Class of each item in the collection
|
43 |
* (assumed to be the name of the factory method)
|
@@ -54,8 +50,8 @@ class Collection extends Base {
|
|
54 |
else
|
55 |
$this->itemclass = $itemclass;
|
56 |
if (!is_array($arr))
|
57 |
-
throw new \OpenCloud\CollectionError(
|
58 |
-
|
59 |
// save the array of items
|
60 |
$this->itemlist=$arr;
|
61 |
}
|
@@ -174,8 +170,8 @@ class Collection extends Base {
|
|
174 |
foreach($this->itemlist as $index => $item) {
|
175 |
$test = call_user_func($testfunc, $item);
|
176 |
if (!is_bool($test))
|
177 |
-
throw new DomainError(
|
178 |
-
|
179 |
'did not return boolean'));
|
180 |
if ($test === FALSE)
|
181 |
unset($this->itemlist[$index]);
|
@@ -250,4 +246,4 @@ class Collection extends Base {
|
|
250 |
return 1;
|
251 |
}
|
252 |
|
253 |
-
}
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
+
namespace OpenCloud\AbstractClass;
|
4 |
|
5 |
/**
|
6 |
* Provides an abstraction for working with ordered sets of objects
|
11 |
* @since 1.0
|
12 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
13 |
*/
|
14 |
+
class Collection extends \OpenCloud\Base\Base {
|
15 |
|
16 |
private
|
17 |
$service,
|
26 |
/**
|
27 |
* A Collection is an array of objects
|
28 |
*
|
29 |
+
* Some assumptions:
|
30 |
+
* * The `Collection` class assumes that there exists on its service
|
31 |
+
* a factory method with the same name of the class. For example, if
|
32 |
+
* you create a Collection of class `Foobar`, it will attempt to call
|
33 |
+
* the method `parent::Foobar()` to create instances of that class.
|
34 |
+
* * It assumes that the factory method can take an array of values, and
|
35 |
+
* it passes that to the method.
|
36 |
+
*
|
37 |
* @param Service $service - the service associated with the collection
|
38 |
* @param string $itemclass - the Class of each item in the collection
|
39 |
* (assumed to be the name of the factory method)
|
50 |
else
|
51 |
$this->itemclass = $itemclass;
|
52 |
if (!is_array($arr))
|
53 |
+
throw new \OpenCloud\Base\Exceptions\CollectionError(
|
54 |
+
\OpenCloud\Base\Lang::translate('Cannot create a Collection without an array'));
|
55 |
// save the array of items
|
56 |
$this->itemlist=$arr;
|
57 |
}
|
170 |
foreach($this->itemlist as $index => $item) {
|
171 |
$test = call_user_func($testfunc, $item);
|
172 |
if (!is_bool($test))
|
173 |
+
throw new \OpenCloud\Base\Exceptions\DomainError(
|
174 |
+
\OpenCloud\Base\Lang::translate('Callback function for Collection::Select() '.
|
175 |
'did not return boolean'));
|
176 |
if ($test === FALSE)
|
177 |
unset($this->itemlist[$index]);
|
246 |
return 1;
|
247 |
}
|
248 |
|
249 |
+
}
|
sdk/OpenCloud/{nova.php → OpenCloud/AbstractClass/Nova.php}
RENAMED
@@ -11,11 +11,9 @@
|
|
11 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
12 |
*/
|
13 |
|
14 |
-
namespace OpenCloud;
|
15 |
|
16 |
-
|
17 |
-
require_once(__DIR__.'/flavor.php');
|
18 |
-
require_once(__DIR__.'/collection.php');
|
19 |
|
20 |
/**
|
21 |
* Nova is an abstraction layer for the OpenStack compute service.
|
@@ -25,8 +23,8 @@ require_once(__DIR__.'/collection.php');
|
|
25 |
* for sharing common code between those other classes.
|
26 |
*/
|
27 |
abstract class Nova extends Service {
|
28 |
-
|
29 |
-
|
30 |
|
31 |
/**
|
32 |
* Called when creating a new Compute service object
|
@@ -44,9 +42,9 @@ abstract class Nova extends Service {
|
|
44 |
* @param string $serviceName - identifies the name of the service in the
|
45 |
* catalog
|
46 |
*/
|
47 |
-
public function __construct(OpenStack $conn,
|
48 |
$serviceType, $serviceName, $serviceRegion, $urltype) {
|
49 |
-
$this->debug(
|
50 |
parent::__construct(
|
51 |
$conn,
|
52 |
$serviceType,
|
@@ -54,28 +52,9 @@ abstract class Nova extends Service {
|
|
54 |
$serviceRegion,
|
55 |
$urltype
|
56 |
);
|
57 |
-
$this->_url = noslash(parent::Url());
|
58 |
} // function __construct()
|
59 |
|
60 |
-
/**
|
61 |
-
* Returns the selected endpoint URL of this Service
|
62 |
-
*
|
63 |
-
* @param string $resource - a child resource. For example,
|
64 |
-
* passing 'servers' would return .../servers. Should *not* be
|
65 |
-
* prefixed with a slash (/).
|
66 |
-
* @param array $args (optional) an array of key-value pairs for query
|
67 |
-
* strings to append to the URL
|
68 |
-
* @returns string - the requested URL
|
69 |
-
*/
|
70 |
-
public function Url($resource='', $args=array()) {
|
71 |
-
$baseurl = $this->_url;
|
72 |
-
if ($resource != '')
|
73 |
-
$baseurl = noslash($baseurl).'/'.$resource;
|
74 |
-
if (!empty($args))
|
75 |
-
$baseurl .= '?'.$this->MakeQueryString($args);
|
76 |
-
return $baseurl;
|
77 |
-
}
|
78 |
-
|
79 |
/**
|
80 |
* Returns a flavor from the service
|
81 |
*
|
@@ -88,7 +67,7 @@ abstract class Nova extends Service {
|
|
88 |
* @return Compute\Flavor object
|
89 |
*/
|
90 |
public function Flavor($id=NULL) {
|
91 |
-
return new Compute\Flavor($this, $id);
|
92 |
} // flavor()
|
93 |
|
94 |
/**
|
@@ -107,10 +86,10 @@ abstract class Nova extends Service {
|
|
107 |
*/
|
108 |
public function FlavorList($details=TRUE, $filter=array()) {
|
109 |
if ($details)
|
110 |
-
$url = $this->Url(Compute\Flavor::ResourceName().'/detail',
|
111 |
$filter);
|
112 |
else
|
113 |
-
$url = $this->Url(Compute\Flavor::ResourceName(), $filter);
|
114 |
return $this->Collection('\OpenCloud\Compute\Flavor', $url);
|
115 |
}
|
116 |
|
11 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
12 |
*/
|
13 |
|
14 |
+
namespace OpenCloud\AbstractClass;
|
15 |
|
16 |
+
use OpenCloud\Base\Lang;
|
|
|
|
|
17 |
|
18 |
/**
|
19 |
* Nova is an abstraction layer for the OpenStack compute service.
|
23 |
* for sharing common code between those other classes.
|
24 |
*/
|
25 |
abstract class Nova extends Service {
|
26 |
+
|
27 |
+
private $_url;
|
28 |
|
29 |
/**
|
30 |
* Called when creating a new Compute service object
|
42 |
* @param string $serviceName - identifies the name of the service in the
|
43 |
* catalog
|
44 |
*/
|
45 |
+
public function __construct(\OpenCloud\OpenStack $conn,
|
46 |
$serviceType, $serviceName, $serviceRegion, $urltype) {
|
47 |
+
$this->debug(Lang::translate('initializing Nova...'));
|
48 |
parent::__construct(
|
49 |
$conn,
|
50 |
$serviceType,
|
52 |
$serviceRegion,
|
53 |
$urltype
|
54 |
);
|
55 |
+
$this->_url = \OpenCloud\Base\Lang::noslash(parent::Url());
|
56 |
} // function __construct()
|
57 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
/**
|
59 |
* Returns a flavor from the service
|
60 |
*
|
67 |
* @return Compute\Flavor object
|
68 |
*/
|
69 |
public function Flavor($id=NULL) {
|
70 |
+
return new \OpenCloud\Compute\Flavor($this, $id);
|
71 |
} // flavor()
|
72 |
|
73 |
/**
|
86 |
*/
|
87 |
public function FlavorList($details=TRUE, $filter=array()) {
|
88 |
if ($details)
|
89 |
+
$url = $this->Url(\OpenCloud\Compute\Flavor::ResourceName().'/detail',
|
90 |
$filter);
|
91 |
else
|
92 |
+
$url = $this->Url(\OpenCloud\Compute\Flavor::ResourceName(), $filter);
|
93 |
return $this->Collection('\OpenCloud\Compute\Flavor', $url);
|
94 |
}
|
95 |
|
sdk/OpenCloud/{objstorebase.php → OpenCloud/AbstractClass/ObjectStore.php}
RENAMED
@@ -11,10 +11,7 @@
|
|
11 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
12 |
*/
|
13 |
|
14 |
-
namespace OpenCloud\
|
15 |
-
|
16 |
-
require_once(__DIR__.'/base.php');
|
17 |
-
require_once(__DIR__.'/metadata.php');
|
18 |
|
19 |
/**
|
20 |
* Intermediate (abstract) class to implement shared
|
@@ -25,7 +22,7 @@ require_once(__DIR__.'/metadata.php');
|
|
25 |
*
|
26 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
27 |
*/
|
28 |
-
abstract class
|
29 |
|
30 |
const
|
31 |
ACCOUNT_META_PREFIX = 'X-Account-',
|
@@ -40,7 +37,7 @@ abstract class ObjStoreBase extends \OpenCloud\Base {
|
|
40 |
* Initializes the metadata component
|
41 |
*/
|
42 |
public function __construct() {
|
43 |
-
$this->metadata = new \OpenCloud\Metadata
|
44 |
}
|
45 |
|
46 |
/**
|
@@ -50,8 +47,8 @@ abstract class ObjStoreBase extends \OpenCloud\Base {
|
|
50 |
* @param \OpenCloud\HttpResponse
|
51 |
* @return void
|
52 |
*/
|
53 |
-
public function GetMetadata(
|
54 |
-
$this->metadata = new \OpenCloud\Metadata
|
55 |
$prefix = $this->Prefix();
|
56 |
$this->metadata->SetArray($response->Headers(), $prefix);
|
57 |
}
|
@@ -90,8 +87,8 @@ abstract class ObjStoreBase extends \OpenCloud\Base {
|
|
90 |
if (property_exists($this, 'name'))
|
91 |
return $this->name;
|
92 |
else
|
93 |
-
throw new \OpenCloud\NameError(sprintf(
|
94 |
-
|
95 |
get_class($this)));
|
96 |
}
|
97 |
|
@@ -130,8 +127,8 @@ abstract class ObjStoreBase extends \OpenCloud\Base {
|
|
130 |
case 'DataObject':
|
131 |
return self::OBJECT_META_PREFIX;
|
132 |
default:
|
133 |
-
throw new MetadataPrefixError(sprintf(
|
134 |
-
|
135 |
}
|
136 |
}
|
137 |
}
|
11 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
12 |
*/
|
13 |
|
14 |
+
namespace OpenCloud\AbstractClass;
|
|
|
|
|
|
|
15 |
|
16 |
/**
|
17 |
* Intermediate (abstract) class to implement shared
|
22 |
*
|
23 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
24 |
*/
|
25 |
+
abstract class ObjectStore extends \OpenCloud\Base\Base {
|
26 |
|
27 |
const
|
28 |
ACCOUNT_META_PREFIX = 'X-Account-',
|
37 |
* Initializes the metadata component
|
38 |
*/
|
39 |
public function __construct() {
|
40 |
+
$this->metadata = new \OpenCloud\Base\Metadata;
|
41 |
}
|
42 |
|
43 |
/**
|
47 |
* @param \OpenCloud\HttpResponse
|
48 |
* @return void
|
49 |
*/
|
50 |
+
public function GetMetadata($response) {
|
51 |
+
$this->metadata = new \OpenCloud\Base\Metadata;
|
52 |
$prefix = $this->Prefix();
|
53 |
$this->metadata->SetArray($response->Headers(), $prefix);
|
54 |
}
|
87 |
if (property_exists($this, 'name'))
|
88 |
return $this->name;
|
89 |
else
|
90 |
+
throw new \OpenCloud\Base\Exceptions\NameError(sprintf(
|
91 |
+
\OpenCloud\Base\Lang::translate('name attribute does not exist for [%s]'),
|
92 |
get_class($this)));
|
93 |
}
|
94 |
|
127 |
case 'DataObject':
|
128 |
return self::OBJECT_META_PREFIX;
|
129 |
default:
|
130 |
+
throw new \OpenCloud\Base\Exceptions\MetadataPrefixError(sprintf(
|
131 |
+
\OpenCloud\Base\Lang::translate('Unrecognized metadata type [%s]'), $type));
|
132 |
}
|
133 |
}
|
134 |
}
|
sdk/OpenCloud/{persistentobject.php → OpenCloud/AbstractClass/PersistentObject.php}
RENAMED
@@ -10,10 +10,9 @@
|
|
10 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
11 |
*/
|
12 |
|
13 |
-
namespace OpenCloud;
|
14 |
|
15 |
-
|
16 |
-
require_once(__DIR__.'/metadata.php');
|
17 |
|
18 |
/**
|
19 |
* represents an object that has the ability to be
|
@@ -62,7 +61,7 @@ require_once(__DIR__.'/metadata.php');
|
|
62 |
*
|
63 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
64 |
*/
|
65 |
-
abstract class PersistentObject extends Base {
|
66 |
|
67 |
protected
|
68 |
$id; // usually overridden as part of the child class
|
@@ -79,7 +78,7 @@ abstract class PersistentObject extends Base {
|
|
79 |
public function __construct($parentobj, $info=NULL) {
|
80 |
$this->_parent = $parentobj;
|
81 |
if (property_exists($this, 'metadata'))
|
82 |
-
$this->metadata = new Metadata;
|
83 |
if (is_string($info) || is_integer($info)) {
|
84 |
$pk = $this->PrimaryKeyField();
|
85 |
$this->{$pk} = (string)$info;
|
@@ -94,8 +93,8 @@ abstract class PersistentObject extends Base {
|
|
94 |
}
|
95 |
}
|
96 |
elseif (isset($info))
|
97 |
-
throw new InvalidArgumentError(sprintf(
|
98 |
-
|
99 |
get_class()));
|
100 |
}
|
101 |
|
@@ -132,8 +131,8 @@ abstract class PersistentObject extends Base {
|
|
132 |
|
133 |
// check the return code
|
134 |
if ($response->HttpStatus() > 204)
|
135 |
-
throw new CreateError(sprintf(
|
136 |
-
|
137 |
get_class($this),
|
138 |
$this->Name(),
|
139 |
$response->HttpStatus(),
|
@@ -185,8 +184,8 @@ abstract class PersistentObject extends Base {
|
|
185 |
|
186 |
// check the return code
|
187 |
if ($response->HttpStatus() > 204)
|
188 |
-
throw new UpdateError(sprintf(
|
189 |
-
|
190 |
get_class($this),
|
191 |
$json,
|
192 |
$response->HttpStatus(),
|
@@ -210,8 +209,8 @@ abstract class PersistentObject extends Base {
|
|
210 |
|
211 |
// check the return code
|
212 |
if ($response->HttpStatus() > 204)
|
213 |
-
throw new DeleteError(sprintf(
|
214 |
-
|
215 |
get_class(),
|
216 |
$this->Name(),
|
217 |
$response->HttpStatus(),
|
@@ -242,7 +241,7 @@ abstract class PersistentObject extends Base {
|
|
242 |
* object might not be a service.
|
243 |
*/
|
244 |
if (!$url && $this->{$pk})
|
245 |
-
$url = noslash($this->Parent()->Url($this->ResourceName()))
|
246 |
. '/' . $this->{$pk};
|
247 |
|
248 |
// add the subresource
|
@@ -258,8 +257,8 @@ abstract class PersistentObject extends Base {
|
|
258 |
}
|
259 |
|
260 |
// otherwise, we don't have a URL yet
|
261 |
-
throw new UrlError(
|
262 |
-
sprintf(
|
263 |
return FALSE;
|
264 |
}
|
265 |
|
@@ -352,11 +351,11 @@ abstract class PersistentObject extends Base {
|
|
352 |
if (!isset($id))
|
353 |
$id = $this->{$pk};
|
354 |
if (!$id)
|
355 |
-
throw new IdRequiredError(sprintf(
|
356 |
-
|
357 |
|
358 |
// retrieve it
|
359 |
-
$this->debug(
|
360 |
$this->{$pk} = $id;
|
361 |
|
362 |
// reset status, if available
|
@@ -368,21 +367,21 @@ abstract class PersistentObject extends Base {
|
|
368 |
|
369 |
// check status codes
|
370 |
if ($response->HttpStatus() == 404)
|
371 |
-
throw new InstanceNotFound(
|
372 |
-
sprintf(
|
373 |
get_class($this), $this->{$pk}, $this->Url()));
|
374 |
|
375 |
if ($response->HttpStatus() >= 300)
|
376 |
-
throw new UnknownError(
|
377 |
-
sprintf(
|
378 |
get_class($this),
|
379 |
$response->HttpStatus(),
|
380 |
$response->HttpBody()));
|
381 |
|
382 |
// check for empty response
|
383 |
if (!$response->HttpBody())
|
384 |
-
throw new EmptyResponseError(sprintf(
|
385 |
-
|
386 |
get_class($this),
|
387 |
$this->Url()));
|
388 |
|
@@ -391,8 +390,8 @@ abstract class PersistentObject extends Base {
|
|
391 |
$this->debug('Refresh() JSON [%s]', $json);
|
392 |
$resp = json_decode($json);
|
393 |
if ($this->CheckJsonError())
|
394 |
-
throw new ServerJsonError(sprintf(
|
395 |
-
|
396 |
$top = $this->JsonName();
|
397 |
if ($top === FALSE) {
|
398 |
foreach($resp as $item => $value) {
|
@@ -421,8 +420,8 @@ abstract class PersistentObject extends Base {
|
|
421 |
if (property_exists($this, 'name'))
|
422 |
return $this->name;
|
423 |
else
|
424 |
-
throw new NameError(sprintf(
|
425 |
-
|
426 |
get_class($this)));
|
427 |
}
|
428 |
|
@@ -461,8 +460,8 @@ abstract class PersistentObject extends Base {
|
|
461 |
*/
|
462 |
public function CheckExtension($alias) {
|
463 |
if (!in_array($alias, $this->Service()->namespaces()))
|
464 |
-
throw new UnsupportedExtensionError(sprintf(
|
465 |
-
|
466 |
return TRUE;
|
467 |
}
|
468 |
|
@@ -496,13 +495,13 @@ abstract class PersistentObject extends Base {
|
|
496 |
$pk = $this->PrimaryKeyField();
|
497 |
// we always require a valid ID
|
498 |
if (!$this->{$pk})
|
499 |
-
throw new IdRequiredError(sprintf(
|
500 |
-
|
501 |
|
502 |
// verify that it is an object
|
503 |
if (!is_object($object))
|
504 |
-
throw new ServerActionError(sprintf(
|
505 |
-
|
506 |
get_class($this)));
|
507 |
|
508 |
// convert the object to json
|
@@ -512,7 +511,7 @@ abstract class PersistentObject extends Base {
|
|
512 |
return FALSE;
|
513 |
|
514 |
// debug - save the request
|
515 |
-
$this->debug(
|
516 |
|
517 |
// get the URL for the POST message
|
518 |
$url = $this->Url('action');
|
@@ -525,15 +524,15 @@ abstract class PersistentObject extends Base {
|
|
525 |
$json
|
526 |
);
|
527 |
if (!is_object($response))
|
528 |
-
throw new HttpError(sprintf(
|
529 |
-
|
530 |
get_class($this)));
|
531 |
|
532 |
// check for errors
|
533 |
if ($response->HttpStatus() >= 300) {
|
534 |
$obj = json_decode($response->HttpBody());
|
535 |
-
throw new ServerActionError(
|
536 |
-
sprintf(
|
537 |
get_class($this), $url, $response->HttpBody()));
|
538 |
}
|
539 |
|
@@ -594,8 +593,8 @@ abstract class PersistentObject extends Base {
|
|
594 |
public static function JsonName() {
|
595 |
if (isset(static::$json_name))
|
596 |
return static::$json_name;
|
597 |
-
throw new DocumentError(sprintf(
|
598 |
-
|
599 |
get_class()));
|
600 |
}
|
601 |
|
@@ -647,8 +646,8 @@ abstract class PersistentObject extends Base {
|
|
647 |
public static function ResourceName() {
|
648 |
if (isset(static::$url_resource))
|
649 |
return static::$url_resource;
|
650 |
-
throw new UrlError(sprintf(
|
651 |
-
|
652 |
get_class()));
|
653 |
}
|
654 |
|
@@ -660,8 +659,8 @@ abstract class PersistentObject extends Base {
|
|
660 |
* @throws CreateError if not overridden
|
661 |
*/
|
662 |
protected function CreateJson() {
|
663 |
-
throw new CreateError(sprintf(
|
664 |
-
|
665 |
get_class($this)));
|
666 |
}
|
667 |
|
@@ -673,8 +672,8 @@ abstract class PersistentObject extends Base {
|
|
673 |
* @throws UpdateError if not overridden
|
674 |
*/
|
675 |
protected function UpdateJson($params = array()) {
|
676 |
-
throw new UpdateError(sprintf(
|
677 |
-
|
678 |
get_class($this)));
|
679 |
}
|
680 |
|
@@ -684,8 +683,8 @@ abstract class PersistentObject extends Base {
|
|
684 |
* @throws CreateError
|
685 |
*/
|
686 |
protected function NoCreate() {
|
687 |
-
throw new CreateError(sprintf(
|
688 |
-
|
689 |
}
|
690 |
|
691 |
/**
|
@@ -694,8 +693,8 @@ abstract class PersistentObject extends Base {
|
|
694 |
* @throws DeleteError
|
695 |
*/
|
696 |
protected function NoDelete() {
|
697 |
-
throw new DeleteError(sprintf(
|
698 |
-
|
699 |
}
|
700 |
|
701 |
/**
|
@@ -704,8 +703,8 @@ abstract class PersistentObject extends Base {
|
|
704 |
* @throws UpdateError
|
705 |
*/
|
706 |
protected function NoUpdate() {
|
707 |
-
throw new UpdateError(sprintf(
|
708 |
-
|
709 |
}
|
710 |
|
711 |
}
|
10 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
11 |
*/
|
12 |
|
13 |
+
namespace OpenCloud\AbstractClass;
|
14 |
|
15 |
+
use OpenCloud\Base\Lang;
|
|
|
16 |
|
17 |
/**
|
18 |
* represents an object that has the ability to be
|
61 |
*
|
62 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
63 |
*/
|
64 |
+
abstract class PersistentObject extends \OpenCloud\Base\Base {
|
65 |
|
66 |
protected
|
67 |
$id; // usually overridden as part of the child class
|
78 |
public function __construct($parentobj, $info=NULL) {
|
79 |
$this->_parent = $parentobj;
|
80 |
if (property_exists($this, 'metadata'))
|
81 |
+
$this->metadata = new \OpenCloud\Base\Metadata;
|
82 |
if (is_string($info) || is_integer($info)) {
|
83 |
$pk = $this->PrimaryKeyField();
|
84 |
$this->{$pk} = (string)$info;
|
93 |
}
|
94 |
}
|
95 |
elseif (isset($info))
|
96 |
+
throw new \OpenCloud\Base\Exceptions\InvalidArgumentError(sprintf(
|
97 |
+
Lang::translate('Argument for [%s] must be string or object'),
|
98 |
get_class()));
|
99 |
}
|
100 |
|
131 |
|
132 |
// check the return code
|
133 |
if ($response->HttpStatus() > 204)
|
134 |
+
throw new \OpenCloud\Base\Exceptions\CreateError(sprintf(
|
135 |
+
Lang::translate('Error creating [%s] [%s], status [%d] response [%s]'),
|
136 |
get_class($this),
|
137 |
$this->Name(),
|
138 |
$response->HttpStatus(),
|
184 |
|
185 |
// check the return code
|
186 |
if ($response->HttpStatus() > 204)
|
187 |
+
throw new \OpenCloud\Base\Exceptions\UpdateError(sprintf(
|
188 |
+
Lang::translate('Error updating [%s] with [%s], status [%d] response [%s]'),
|
189 |
get_class($this),
|
190 |
$json,
|
191 |
$response->HttpStatus(),
|
209 |
|
210 |
// check the return code
|
211 |
if ($response->HttpStatus() > 204)
|
212 |
+
throw new \OpenCloud\Base\Exceptions\DeleteError(sprintf(
|
213 |
+
Lang::translate('Error deleting [%s] [%s], status [%d] response [%s]'),
|
214 |
get_class(),
|
215 |
$this->Name(),
|
216 |
$response->HttpStatus(),
|
241 |
* object might not be a service.
|
242 |
*/
|
243 |
if (!$url && $this->{$pk})
|
244 |
+
$url = Lang::noslash($this->Parent()->Url($this->ResourceName()))
|
245 |
. '/' . $this->{$pk};
|
246 |
|
247 |
// add the subresource
|
257 |
}
|
258 |
|
259 |
// otherwise, we don't have a URL yet
|
260 |
+
throw new \OpenCloud\Base\Exceptions\UrlError(
|
261 |
+
sprintf(Lang::translate('%s does not have a URL yet'), get_class($this)));
|
262 |
return FALSE;
|
263 |
}
|
264 |
|
351 |
if (!isset($id))
|
352 |
$id = $this->{$pk};
|
353 |
if (!$id)
|
354 |
+
throw new \OpenCloud\Base\Exceptions\IdRequiredError(sprintf(
|
355 |
+
Lang::translate('%s has no ID; cannot be refreshed'), get_class()));
|
356 |
|
357 |
// retrieve it
|
358 |
+
$this->debug(Lang::translate('%s id [%s]'), get_class($this), $id);
|
359 |
$this->{$pk} = $id;
|
360 |
|
361 |
// reset status, if available
|
367 |
|
368 |
// check status codes
|
369 |
if ($response->HttpStatus() == 404)
|
370 |
+
throw new \OpenCloud\Base\Exceptions\InstanceNotFound(
|
371 |
+
sprintf(Lang::translate('%s [%s] not found [%s]'),
|
372 |
get_class($this), $this->{$pk}, $this->Url()));
|
373 |
|
374 |
if ($response->HttpStatus() >= 300)
|
375 |
+
throw new \OpenCloud\Base\Exceptions\UnknownError(
|
376 |
+
sprintf(Lang::translate('Unexpected %s error [%d] [%s]'),
|
377 |
get_class($this),
|
378 |
$response->HttpStatus(),
|
379 |
$response->HttpBody()));
|
380 |
|
381 |
// check for empty response
|
382 |
if (!$response->HttpBody())
|
383 |
+
throw new \OpenCloud\Base\Exceptions\EmptyResponseError(sprintf(
|
384 |
+
Lang::translate('%s::Refresh() unexpected empty response, URL [%s]'),
|
385 |
get_class($this),
|
386 |
$this->Url()));
|
387 |
|
390 |
$this->debug('Refresh() JSON [%s]', $json);
|
391 |
$resp = json_decode($json);
|
392 |
if ($this->CheckJsonError())
|
393 |
+
throw new \OpenCloud\Base\Exceptions\ServerJsonError(sprintf(
|
394 |
+
Lang::translate('JSON parse error on %s refresh'), get_class($this)));
|
395 |
$top = $this->JsonName();
|
396 |
if ($top === FALSE) {
|
397 |
foreach($resp as $item => $value) {
|
420 |
if (property_exists($this, 'name'))
|
421 |
return $this->name;
|
422 |
else
|
423 |
+
throw new \OpenCloud\Base\Exceptions\NameError(sprintf(
|
424 |
+
Lang::translate('Name attribute does not exist for [%s]'),
|
425 |
get_class($this)));
|
426 |
}
|
427 |
|
460 |
*/
|
461 |
public function CheckExtension($alias) {
|
462 |
if (!in_array($alias, $this->Service()->namespaces()))
|
463 |
+
throw new \OpenCloud\Base\Exceptions\UnsupportedExtensionError(sprintf(
|
464 |
+
Lang::translate('Extension [%s] is not installed'), $alias));
|
465 |
return TRUE;
|
466 |
}
|
467 |
|
495 |
$pk = $this->PrimaryKeyField();
|
496 |
// we always require a valid ID
|
497 |
if (!$this->{$pk})
|
498 |
+
throw new \OpenCloud\Base\Exceptions\IdRequiredError(sprintf(
|
499 |
+
Lang::translate('%s is not defined'), get_class($this)));
|
500 |
|
501 |
// verify that it is an object
|
502 |
if (!is_object($object))
|
503 |
+
throw new \OpenCloud\Base\Exceptions\ServerActionError(sprintf(
|
504 |
+
Lang::translate('%s::Action() requires an object as its parameter'),
|
505 |
get_class($this)));
|
506 |
|
507 |
// convert the object to json
|
511 |
return FALSE;
|
512 |
|
513 |
// debug - save the request
|
514 |
+
$this->debug(Lang::translate('%s::Action [%s]'), get_class($this), $json);
|
515 |
|
516 |
// get the URL for the POST message
|
517 |
$url = $this->Url('action');
|
524 |
$json
|
525 |
);
|
526 |
if (!is_object($response))
|
527 |
+
throw new \OpenCloud\Base\Exceptions\HttpError(sprintf(
|
528 |
+
Lang::translate('Invalid response for %s::Action() request'),
|
529 |
get_class($this)));
|
530 |
|
531 |
// check for errors
|
532 |
if ($response->HttpStatus() >= 300) {
|
533 |
$obj = json_decode($response->HttpBody());
|
534 |
+
throw new \OpenCloud\Base\Exceptions\ServerActionError(
|
535 |
+
sprintf(Lang::translate('%s::Action() [%s] failed; response [%s]'),
|
536 |
get_class($this), $url, $response->HttpBody()));
|
537 |
}
|
538 |
|
593 |
public static function JsonName() {
|
594 |
if (isset(static::$json_name))
|
595 |
return static::$json_name;
|
596 |
+
throw new \OpenCloud\Base\Exceptions\DocumentError(sprintf(
|
597 |
+
Lang::translate('No JSON object defined for class [%s] in JsonName()'),
|
598 |
get_class()));
|
599 |
}
|
600 |
|
646 |
public static function ResourceName() {
|
647 |
if (isset(static::$url_resource))
|
648 |
return static::$url_resource;
|
649 |
+
throw new \OpenCloud\Base\Exceptions\UrlError(sprintf(
|
650 |
+
Lang::translate('No URL resource defined for class [%s] in ResourceName()'),
|
651 |
get_class()));
|
652 |
}
|
653 |
|
659 |
* @throws CreateError if not overridden
|
660 |
*/
|
661 |
protected function CreateJson() {
|
662 |
+
throw new \OpenCloud\Base\Exceptions\CreateError(sprintf(
|
663 |
+
Lang::translate('[%s] CreateJson() must be overridden'),
|
664 |
get_class($this)));
|
665 |
}
|
666 |
|
672 |
* @throws UpdateError if not overridden
|
673 |
*/
|
674 |
protected function UpdateJson($params = array()) {
|
675 |
+
throw new \OpenCloud\Base\Exceptions\UpdateError(sprintf(
|
676 |
+
Lang::translate('[%s] UpdateJson() must be overridden'),
|
677 |
get_class($this)));
|
678 |
}
|
679 |
|
683 |
* @throws CreateError
|
684 |
*/
|
685 |
protected function NoCreate() {
|
686 |
+
throw new \OpenCloud\Base\Exceptions\CreateError(sprintf(
|
687 |
+
Lang::translate('[%s] does not support Create()'), get_class()));
|
688 |
}
|
689 |
|
690 |
/**
|
693 |
* @throws DeleteError
|
694 |
*/
|
695 |
protected function NoDelete() {
|
696 |
+
throw new \OpenCloud\Base\Exceptions\DeleteError(sprintf(
|
697 |
+
Lang::translate('[%s] does not support Delete()'), get_class()));
|
698 |
}
|
699 |
|
700 |
/**
|
703 |
* @throws UpdateError
|
704 |
*/
|
705 |
protected function NoUpdate() {
|
706 |
+
throw new \OpenCloud\Base\Exceptions\UpdateError(sprintf(
|
707 |
+
Lang::translate('[%s] does not support Update()'), get_class()));
|
708 |
}
|
709 |
|
710 |
}
|
sdk/OpenCloud/{service.php → OpenCloud/AbstractClass/Service.php}
RENAMED
@@ -10,9 +10,9 @@
|
|
10 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
11 |
*/
|
12 |
|
13 |
-
namespace OpenCloud;
|
14 |
|
15 |
-
|
16 |
|
17 |
/**
|
18 |
* This class defines a "service"—a relationship between a specific OpenStack
|
@@ -24,17 +24,15 @@ require_once(__DIR__.'/base.php');
|
|
24 |
*
|
25 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
26 |
*/
|
27 |
-
abstract class Service extends Base {
|
28 |
|
29 |
-
protected
|
30 |
-
$_namespaces=array();
|
31 |
|
32 |
-
private
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
$service_url;
|
38 |
|
39 |
/**
|
40 |
* Creates a service on the specified connection
|
@@ -53,7 +51,7 @@ abstract class Service extends Base {
|
|
53 |
* (e.g., "publicURL")
|
54 |
*/
|
55 |
public function __construct(
|
56 |
-
OpenStack $conn, $type, $name, $region, $urltype=RAXSDK_URL_PUBLIC) {
|
57 |
$this->conn = $conn;
|
58 |
$this->service_type = $type;
|
59 |
$this->service_name = $name;
|
@@ -65,13 +63,19 @@ abstract class Service extends Base {
|
|
65 |
/**
|
66 |
* Returns the URL for the Service
|
67 |
*
|
|
|
68 |
* @param array $query optional k/v pairs for query strings
|
69 |
* @return string
|
70 |
*/
|
71 |
-
public function Url($param=array())
|
72 |
-
|
73 |
-
|
74 |
-
|
|
|
|
|
|
|
|
|
|
|
75 |
|
76 |
/**
|
77 |
* Returns the /extensions for the service
|
@@ -115,7 +119,8 @@ abstract class Service extends Base {
|
|
115 |
* @param string $body An optional body for POST/PUT requests
|
116 |
* @return \OpenCloud\HttpResult
|
117 |
*/
|
118 |
-
public function Request($url,$method='GET',$headers=array(),$body=NULL)
|
|
|
119 |
$headers['X-Auth-Token'] = $this->conn->Token();
|
120 |
if ($tenant = $this->conn->Tenant())
|
121 |
$headers['X-Auth-Project-Id'] = $tenant;
|
@@ -161,8 +166,8 @@ abstract class Service extends Base {
|
|
161 |
|
162 |
// check return code
|
163 |
if ($response->HttpStatus() > 204)
|
164 |
-
throw new \OpenCloud\CollectionError(sprintf(
|
165 |
-
|
166 |
'status [%d] response [%s]'),
|
167 |
$class,
|
168 |
$url,
|
@@ -186,8 +191,8 @@ abstract class Service extends Base {
|
|
186 |
if (isset($link->href))
|
187 |
$next_page_url = $link->href;
|
188 |
else
|
189 |
-
throw new \OpenCloud\DomainError(
|
190 |
-
|
191 |
}
|
192 |
}
|
193 |
}
|
@@ -303,8 +308,8 @@ abstract class Service extends Base {
|
|
303 |
|
304 |
// error if not found
|
305 |
if (!$found)
|
306 |
-
throw new EndpointError(
|
307 |
-
sprintf(
|
308 |
'region [%s] and urlType [%s]'),
|
309 |
$type,
|
310 |
$name,
|
@@ -332,7 +337,7 @@ abstract class Service extends Base {
|
|
332 |
);
|
333 |
if ($urlbase == '')
|
334 |
return array();
|
335 |
-
$ext_url = noslash($urlbase) .
|
336 |
'/' .
|
337 |
$resource;
|
338 |
$response = $this->Request($ext_url);
|
@@ -343,8 +348,8 @@ abstract class Service extends Base {
|
|
343 |
|
344 |
// check for error status
|
345 |
if ($response->HttpStatus() >= 300)
|
346 |
-
throw new HttpError(sprintf(
|
347 |
-
|
348 |
$urlbase, $response->HttpStatus(), $response->HttpBody()));
|
349 |
|
350 |
// we're good; proceed
|
10 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
11 |
*/
|
12 |
|
13 |
+
namespace OpenCloud\AbstractClass;
|
14 |
|
15 |
+
use OpenCloud\Base\Lang;
|
16 |
|
17 |
/**
|
18 |
* This class defines a "service"—a relationship between a specific OpenStack
|
24 |
*
|
25 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
26 |
*/
|
27 |
+
abstract class Service extends \OpenCloud\Base\Base {
|
28 |
|
29 |
+
protected $_namespaces = array();
|
|
|
30 |
|
31 |
+
private $conn;
|
32 |
+
private $service_type;
|
33 |
+
private $service_name;
|
34 |
+
private $service_region;
|
35 |
+
private $service_url;
|
|
|
36 |
|
37 |
/**
|
38 |
* Creates a service on the specified connection
|
51 |
* (e.g., "publicURL")
|
52 |
*/
|
53 |
public function __construct(
|
54 |
+
\OpenCloud\OpenStack $conn, $type, $name, $region, $urltype=RAXSDK_URL_PUBLIC) {
|
55 |
$this->conn = $conn;
|
56 |
$this->service_type = $type;
|
57 |
$this->service_name = $name;
|
63 |
/**
|
64 |
* Returns the URL for the Service
|
65 |
*
|
66 |
+
* @param string $resource optional sub-resource
|
67 |
* @param array $query optional k/v pairs for query strings
|
68 |
* @return string
|
69 |
*/
|
70 |
+
public function Url($resource='', array $param = array())
|
71 |
+
{
|
72 |
+
$baseurl = $this->service_url;
|
73 |
+
if ($resource != '')
|
74 |
+
$baseurl = Lang::noslash($baseurl).'/'.$resource;
|
75 |
+
if (!empty($param))
|
76 |
+
$baseurl .= '?'.$this->MakeQueryString($param);
|
77 |
+
return $baseurl;
|
78 |
+
}
|
79 |
|
80 |
/**
|
81 |
* Returns the /extensions for the service
|
119 |
* @param string $body An optional body for POST/PUT requests
|
120 |
* @return \OpenCloud\HttpResult
|
121 |
*/
|
122 |
+
public function Request($url,$method='GET',$headers=array(),$body=NULL)
|
123 |
+
{
|
124 |
$headers['X-Auth-Token'] = $this->conn->Token();
|
125 |
if ($tenant = $this->conn->Tenant())
|
126 |
$headers['X-Auth-Project-Id'] = $tenant;
|
166 |
|
167 |
// check return code
|
168 |
if ($response->HttpStatus() > 204)
|
169 |
+
throw new \OpenCloud\Base\Exceptions\CollectionError(sprintf(
|
170 |
+
Lang::translate('Unable to retrieve [%s] list from [%s], '.
|
171 |
'status [%d] response [%s]'),
|
172 |
$class,
|
173 |
$url,
|
191 |
if (isset($link->href))
|
192 |
$next_page_url = $link->href;
|
193 |
else
|
194 |
+
throw new \OpenCloud\Base\Exceptions\DomainError(
|
195 |
+
Lang::translate('unexpected [links] found with no [href]'));
|
196 |
}
|
197 |
}
|
198 |
}
|
308 |
|
309 |
// error if not found
|
310 |
if (!$found)
|
311 |
+
throw new \OpenCloud\Base\Exceptions\EndpointError(
|
312 |
+
sprintf(Lang::translate('No endpoints for service type [%s], name [%s], '.
|
313 |
'region [%s] and urlType [%s]'),
|
314 |
$type,
|
315 |
$name,
|
337 |
);
|
338 |
if ($urlbase == '')
|
339 |
return array();
|
340 |
+
$ext_url = \OpenCloud\Base\Lang::noslash($urlbase) .
|
341 |
'/' .
|
342 |
$resource;
|
343 |
$response = $this->Request($ext_url);
|
348 |
|
349 |
// check for error status
|
350 |
if ($response->HttpStatus() >= 300)
|
351 |
+
throw new \OpenCloud\Base\Exceptions\HttpError(sprintf(
|
352 |
+
Lang::translate('Error accessing [%s] - status [%d], response [%s]'),
|
353 |
$urlbase, $response->HttpStatus(), $response->HttpBody()));
|
354 |
|
355 |
// we're good; proceed
|
sdk/OpenCloud/{base.php → OpenCloud/Base/Base.php}
RENAMED
@@ -10,11 +10,7 @@
|
|
10 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
11 |
*/
|
12 |
|
13 |
-
namespace OpenCloud;
|
14 |
-
|
15 |
-
require_once(__DIR__.'/globals.php');
|
16 |
-
require_once(__DIR__.'/exceptions.php');
|
17 |
-
require_once(__DIR__.'/http.php');
|
18 |
|
19 |
/**
|
20 |
* The Base class is the root class for all other objects used or defined by
|
@@ -28,9 +24,53 @@ require_once(__DIR__.'/http.php');
|
|
28 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
29 |
*/
|
30 |
abstract class Base {
|
31 |
-
|
32 |
-
|
33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
|
35 |
// debug() - display a debug message
|
36 |
/**
|
@@ -51,13 +91,15 @@ abstract class Base {
|
|
51 |
* @param mixed $p4 Optional argument to be passed to sprintf()
|
52 |
* @param mixed $p5 Optional argument to be passed to sprintf()
|
53 |
* @return void
|
|
|
|
|
54 |
*/
|
55 |
public function debug($msg,$p1=NULL,$p2=NULL,$p3=NULL,$p4=NULL,$p5=NULL) {
|
56 |
-
global $RAXSDK_DEBUG;
|
57 |
// don't display the message unless the debug flag is set
|
58 |
-
if (
|
59 |
-
|
60 |
-
|
|
|
61 |
}
|
62 |
|
63 |
/**
|
@@ -70,8 +112,8 @@ abstract class Base {
|
|
70 |
* @throws UrlError
|
71 |
*/
|
72 |
public function Url() {
|
73 |
-
throw new UrlError(
|
74 |
-
|
75 |
}
|
76 |
|
77 |
/**
|
@@ -103,19 +145,21 @@ abstract class Base {
|
|
103 |
* @throws \OpenCloud\AttributeError if strict checks are on and
|
104 |
* the property prefix is not in the list of prefixes.
|
105 |
*/
|
106 |
-
public function SetProperty($property, $value, $prefixes=array())
|
107 |
-
|
108 |
-
|
|
|
109 |
$this->$property = $value;
|
110 |
// otherwise, check the prefix
|
111 |
-
elseif ($this->CheckAttributePrefix($property, $prefixes))
|
112 |
$this->$property = $value;
|
113 |
// if that fails, then throw the exception
|
114 |
-
else
|
115 |
-
|
116 |
-
|
117 |
$property,
|
118 |
get_class($this)));
|
|
|
119 |
}
|
120 |
|
121 |
/**
|
@@ -156,28 +200,28 @@ abstract class Base {
|
|
156 |
case JSON_ERROR_NONE:
|
157 |
return FALSE;
|
158 |
case JSON_ERROR_DEPTH:
|
159 |
-
throw new JsonError(
|
160 |
-
|
161 |
break;
|
162 |
case JSON_ERROR_STATE_MISMATCH:
|
163 |
-
throw new JsonError(
|
164 |
-
|
165 |
break;
|
166 |
case JSON_ERROR_CTRL_CHAR:
|
167 |
-
throw new JsonError(
|
168 |
-
|
169 |
'incorrectly encoded'));
|
170 |
break;
|
171 |
case JSON_ERROR_SYNTAX:
|
172 |
-
throw new JsonError(
|
173 |
break;
|
174 |
case JSON_ERROR_UTF8:
|
175 |
-
throw new JsonError(
|
176 |
-
|
177 |
'incorrectly encoded'));
|
178 |
break;
|
179 |
default:
|
180 |
-
throw new JsonError(
|
181 |
}
|
182 |
return TRUE;
|
183 |
}
|
@@ -189,8 +233,9 @@ abstract class Base {
|
|
189 |
*
|
190 |
* This can be stubbed out for unit testing and avoid making live calls.
|
191 |
*/
|
192 |
-
|
193 |
-
|
|
|
194 |
}
|
195 |
|
196 |
/**
|
10 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
11 |
*/
|
12 |
|
13 |
+
namespace OpenCloud\Base;
|
|
|
|
|
|
|
|
|
14 |
|
15 |
/**
|
16 |
* The Base class is the root class for all other objects used or defined by
|
24 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
25 |
*/
|
26 |
abstract class Base {
|
27 |
+
|
28 |
+
private $http_headers = array();
|
29 |
+
private $_errors = array();
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Debug object.
|
33 |
+
*
|
34 |
+
* @var \OpenCloud\Base\Debug
|
35 |
+
* @access private
|
36 |
+
*/
|
37 |
+
private $debug;
|
38 |
+
|
39 |
+
/**
|
40 |
+
* __construct function.
|
41 |
+
*
|
42 |
+
* @access public
|
43 |
+
* @return void
|
44 |
+
*/
|
45 |
+
public function __construct()
|
46 |
+
{
|
47 |
+
$this->setDebug();
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* setDebug function.
|
52 |
+
*
|
53 |
+
* @access public
|
54 |
+
* @return void
|
55 |
+
*/
|
56 |
+
public function setDebug()
|
57 |
+
{
|
58 |
+
$this->debug = new Debug;
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* getDebug function.
|
63 |
+
*
|
64 |
+
* @access public
|
65 |
+
* @return void
|
66 |
+
*/
|
67 |
+
public function getDebug()
|
68 |
+
{
|
69 |
+
if (null === $this->debug) {
|
70 |
+
$this->setDebug();
|
71 |
+
}
|
72 |
+
return $this->debug;
|
73 |
+
}
|
74 |
|
75 |
// debug() - display a debug message
|
76 |
/**
|
91 |
* @param mixed $p4 Optional argument to be passed to sprintf()
|
92 |
* @param mixed $p5 Optional argument to be passed to sprintf()
|
93 |
* @return void
|
94 |
+
*
|
95 |
+
* @TODO - change this method name to something more descriptive/accurate
|
96 |
*/
|
97 |
public function debug($msg,$p1=NULL,$p2=NULL,$p3=NULL,$p4=NULL,$p5=NULL) {
|
|
|
98 |
// don't display the message unless the debug flag is set
|
99 |
+
if ($this->getDebug()->isEnabled()) {
|
100 |
+
printf("Debug:(%s)$msg\n",
|
101 |
+
get_class($this), $p1, $p2, $p3, $p4, $p5);
|
102 |
+
}
|
103 |
}
|
104 |
|
105 |
/**
|
112 |
* @throws UrlError
|
113 |
*/
|
114 |
public function Url() {
|
115 |
+
throw new \OpenCloud\Base\Exceptions\UrlError(
|
116 |
+
\OpenCloud\Base\Lang::translate('URL method must be overridden in class definition'));
|
117 |
}
|
118 |
|
119 |
/**
|
145 |
* @throws \OpenCloud\AttributeError if strict checks are on and
|
146 |
* the property prefix is not in the list of prefixes.
|
147 |
*/
|
148 |
+
public function SetProperty($property, $value, array $prefixes = array())
|
149 |
+
{
|
150 |
+
// if strict checks are off, go ahead and set it
|
151 |
+
if (!RAXSDK_STRICT_PROPERTY_CHECKS) {
|
152 |
$this->$property = $value;
|
153 |
// otherwise, check the prefix
|
154 |
+
} elseif ($this->CheckAttributePrefix($property, $prefixes)) {
|
155 |
$this->$property = $value;
|
156 |
// if that fails, then throw the exception
|
157 |
+
} else {
|
158 |
+
throw new \OpenCloud\Base\Exceptions\AttributeError(sprintf(
|
159 |
+
\OpenCloud\Base\Lang::translate('Unrecognized attribute [%s] for [%s]'),
|
160 |
$property,
|
161 |
get_class($this)));
|
162 |
+
}
|
163 |
}
|
164 |
|
165 |
/**
|
200 |
case JSON_ERROR_NONE:
|
201 |
return FALSE;
|
202 |
case JSON_ERROR_DEPTH:
|
203 |
+
throw new \OpenCloud\Base\Exceptions\JsonError(
|
204 |
+
\OpenCloud\Base\Lang::translate('JSON error: The maximum stack depth has been exceeded'));
|
205 |
break;
|
206 |
case JSON_ERROR_STATE_MISMATCH:
|
207 |
+
throw new \OpenCloud\Base\Exceptions\JsonError(
|
208 |
+
\OpenCloud\Base\Lang::translate('JSON error: Invalid or malformed JSON'));
|
209 |
break;
|
210 |
case JSON_ERROR_CTRL_CHAR:
|
211 |
+
throw new \OpenCloud\Base\Exceptions\JsonError(
|
212 |
+
\OpenCloud\Base\Lang::translate('JSON error: Control character error, possibly '.
|
213 |
'incorrectly encoded'));
|
214 |
break;
|
215 |
case JSON_ERROR_SYNTAX:
|
216 |
+
throw new \OpenCloud\Base\Exceptions\JsonError(\OpenCloud\Base\Lang::translate('JSON error: Syntax error'));
|
217 |
break;
|
218 |
case JSON_ERROR_UTF8:
|
219 |
+
throw new \OpenCloud\Base\Exceptions\JsonError(
|
220 |
+
\OpenCloud\Base\Lang::translate('JSON error: Malformed UTF-8 characters, possibly '.
|
221 |
'incorrectly encoded'));
|
222 |
break;
|
223 |
default:
|
224 |
+
throw new \OpenCloud\Base\Exceptions\JsonError(\OpenCloud\Base\Lang::translate('Unexpected JSON error'));
|
225 |
}
|
226 |
return TRUE;
|
227 |
}
|
233 |
*
|
234 |
* This can be stubbed out for unit testing and avoid making live calls.
|
235 |
*/
|
236 |
+
public function GetHttpRequestObject($url, $method='GET', $options = array())
|
237 |
+
{
|
238 |
+
return new Request\Curl($url, $method, $options);
|
239 |
}
|
240 |
|
241 |
/**
|
sdk/OpenCloud/OpenCloud/Base/Debug.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base;
|
4 |
+
|
5 |
+
class Debug {
|
6 |
+
|
7 |
+
protected $debugState = false;
|
8 |
+
|
9 |
+
public function setDebug($state)
|
10 |
+
{
|
11 |
+
$this->setState($state);
|
12 |
+
}
|
13 |
+
|
14 |
+
public function setState($state = true)
|
15 |
+
{
|
16 |
+
$this->debugState = $state;
|
17 |
+
}
|
18 |
+
|
19 |
+
public function isEnabled()
|
20 |
+
{
|
21 |
+
return $this->debugState;
|
22 |
+
}
|
23 |
+
|
24 |
+
}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/AsyncError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class AsyncError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/AsyncHttpError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class AsyncHttpError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/AsyncTimeoutError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class AsyncTimeoutError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/AttributeError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class AttributeError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/AuthenticationError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class AuthenticationError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/CdnError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class CdnError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/CdnHttpError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class CdnHttpError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/CdnNotAvailableError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class CdnNotAvailableError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/CdnTtlError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class CdnTtlError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/CollectionError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class CollectionError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/ContainerCreateError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class ContainerCreateError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/ContainerDeleteError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class ContainerDeleteError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/ContainerError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class ContainerError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/ContainerNameError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class ContainerNameError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/ContainerNotEmptyError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class ContainerNotEmptyError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/ContainerNotFoundError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class ContainerNotFoundError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/CreateError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class CreateError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/CreateUpdateError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class CreateUpdateError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/CredentialError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class CredentialError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/DatabaseCreateError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class DatabaseCreateError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/DatabaseDeleteError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class DatabaseDeleteError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/DatabaseListError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class DatabaseListError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/DatabaseNameError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class DatabaseNameError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/DatabaseUpdateError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class DatabaseUpdateError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/DeleteError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class DeleteError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/DocumentError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class DocumentError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/DomainError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class DomainError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/EmptyResponseError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class EmptyResponseError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/EndpointError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class EndpointError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/FlavorError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class FlavorError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/HttpError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class HttpError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/HttpForbiddenError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class HttpForbiddenError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/HttpOverLimitError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class HttpOverLimitError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/HttpRetryError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class HttpRetryError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/HttpTimeoutError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class HttpTimeoutError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/HttpUnauthorizedError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class HttpUnauthorizedError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/HttpUrlError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class HttpUrlError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/IOError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class IOError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/IdRequiredError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class IdRequiredError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/ImageError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class ImageError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/InstanceCreateError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class InstanceCreateError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/InstanceDeleteError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class InstanceDeleteError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/InstanceError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class InstanceError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/InstanceFlavorError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class InstanceFlavorError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/InstanceNotFound.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class InstanceNotFound extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/InstanceUpdateError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class InstanceUpdateError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/InvalidArgumentError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class InvalidArgumentError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/InvalidIdTypeError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class InvalidIdTypeError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/InvalidIpTypeError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class InvalidIpTypeError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/InvalidParameterError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class InvalidParameterError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/InvalidRequestError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class InvalidRequestError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/JsonError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class JsonError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/MetadataCreateError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class MetadataCreateError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/MetadataDeleteError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class MetadataDeleteError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/MetadataError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class MetadataError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/MetadataJsonError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class MetadataJsonError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/MetadataKeyError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class MetadataKeyError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/MetadataPrefixError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class MetadataPrefixError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/MetadataUpdateError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class MetadataUpdateError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/MisMatchedChecksumError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class MisMatchedChecksumError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/MissingValueError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class MissingValueError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/NameError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class NameError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/NetworkCreateError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class NetworkCreateError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/NetworkDeleteError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class NetworkDeleteError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/NetworkError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class NetworkError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/NetworkUpdateError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class NetworkUpdateError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/NetworkUrlError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class NetworkUrlError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/NoContentTypeError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class NoContentTypeError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/NoNameError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class NoNameError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/ObjFetchError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class ObjFetchError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/ObjectCopyError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class ObjectCopyError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/ObjectError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class ObjectError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/RecordTypeError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class RecordTypeError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/ServerActionError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class ServerActionError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/ServerCreateError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class ServerCreateError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/ServerDeleteError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class ServerDeleteError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/ServerIpsError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class ServerIpsError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/ServerJsonError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class ServerJsonError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/ServerUpdateError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class ServerUpdateError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/ServerUrlError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class ServerUrlError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/ServiceValueError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class ServiceValueError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/SnapshotError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class SnapshotError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/TempUrlMethodError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class TempUrlMethodError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/UnknownError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class UnknownError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/UnknownParameterError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class UnknownParameterError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/UnrecognizedServiceError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class UnrecognizedServiceError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/UnsupportedExtensionError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class UnsupportedExtensionError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/UnsupportedFeatureExtension.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class UnsupportedFeatureExtension extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/UnsupportedVersionError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class UnsupportedVersionError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/UpdateError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class UpdateError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/UrlError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class UrlError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/UserCreateError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class UserCreateError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/UserDeleteError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class UserDeleteError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/UserListError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class UserListError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/UserNameError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class UserNameError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/UserUpdateError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class UserUpdateError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/VolumeError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class VolumeError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Exceptions/VolumeTypeError.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Exceptions;
|
4 |
+
|
5 |
+
class VolumeTypeError extends \Exception {}
|
sdk/OpenCloud/OpenCloud/Base/Lang.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base;
|
4 |
+
|
5 |
+
class Lang {
|
6 |
+
|
7 |
+
public static function translate($word = null) {
|
8 |
+
|
9 |
+
return $word;
|
10 |
+
}
|
11 |
+
|
12 |
+
public static function noslash($str)
|
13 |
+
{
|
14 |
+
while ($str && (substr($str, -1) == '/')) {
|
15 |
+
$str = substr($str, 0, strlen($str) - 1);
|
16 |
+
}
|
17 |
+
return $str;
|
18 |
+
}
|
19 |
+
|
20 |
+
}
|
sdk/OpenCloud/{metadata.php → OpenCloud/Base/Metadata.php}
RENAMED
@@ -10,9 +10,7 @@
|
|
10 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
11 |
*/
|
12 |
|
13 |
-
namespace OpenCloud;
|
14 |
-
|
15 |
-
require_once(__DIR__.'/base.php');
|
16 |
|
17 |
/**
|
18 |
* The Metadata class represents either Server or Image metadata
|
@@ -66,7 +64,7 @@ class Metadata extends Base {
|
|
66 |
if ($prefix) {
|
67 |
if (strpos($key, $prefix) === 0) {
|
68 |
$name = substr($key, strlen($prefix));
|
69 |
-
$this->debug(
|
70 |
$this->$name = $value;
|
71 |
}
|
72 |
}
|
10 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
11 |
*/
|
12 |
|
13 |
+
namespace OpenCloud\Base;
|
|
|
|
|
14 |
|
15 |
/**
|
16 |
* The Metadata class represents either Server or Image metadata
|
64 |
if ($prefix) {
|
65 |
if (strpos($key, $prefix) === 0) {
|
66 |
$name = substr($key, strlen($prefix));
|
67 |
+
$this->debug(\OpenCloud\Base\Lang::translate('Setting [%s] to [%s]'), $name, $value);
|
68 |
$this->$name = $value;
|
69 |
}
|
70 |
}
|
sdk/OpenCloud/{http.php → OpenCloud/Base/Request/Curl.php}
RENAMED
@@ -1,33 +1,9 @@
|
|
1 |
<?php
|
2 |
-
/**
|
3 |
-
* Performs low-level HTTP operations via CURL
|
4 |
-
*
|
5 |
-
* @copyright 2012-2013 Rackspace Hosting, Inc.
|
6 |
-
* See COPYING for licensing information
|
7 |
-
*
|
8 |
-
* @package phpOpenCloud
|
9 |
-
* @version 1.0
|
10 |
-
* @author Glen Campbell <glen.campbell@rackspace.com>
|
11 |
-
*/
|
12 |
|
13 |
-
namespace OpenCloud;
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
/**
|
19 |
-
* The HttpRequest interface defines methods for wrapping CURL; this allows
|
20 |
-
* those methods to be stubbed out for unit testing, thus allowing us to
|
21 |
-
* test without actually making live calls.
|
22 |
-
*/
|
23 |
-
interface HttpRequest
|
24 |
-
{
|
25 |
-
public function SetOption($name, $value);
|
26 |
-
public function setheaders($arr);
|
27 |
-
public function SetHeader($header, $value);
|
28 |
-
public function Execute();
|
29 |
-
public function close();
|
30 |
-
}
|
31 |
|
32 |
/**
|
33 |
* The CurlRequest class is a simple wrapper to CURL functions. Not only does
|
@@ -38,7 +14,7 @@ interface HttpRequest
|
|
38 |
* @api
|
39 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
40 |
*/
|
41 |
-
class
|
42 |
|
43 |
private
|
44 |
$url,
|
@@ -65,18 +41,17 @@ class CurlRequest implements HTTPRequest {
|
|
65 |
// set our options
|
66 |
$this->SetOption(CURLOPT_CUSTOMREQUEST, $method);
|
67 |
foreach($options as $opt => $value) {
|
68 |
-
$this->debug(
|
69 |
-
$this->
|
70 |
}
|
71 |
|
72 |
// set security handling options
|
73 |
-
if (RAXSDK_SSL_VERIFYHOST != 2)
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
printf("WARNING: RAXSDK_SSL_VERIFYPEER has reduced security\n");
|
80 |
$this->SetOption(CURLOPT_SSL_VERIFYHOST, RAXSDK_SSL_VERIFYHOST);
|
81 |
$this->SetOption(CURLOPT_SSL_VERIFYPEER, RAXSDK_SSL_VERIFYPEER);
|
82 |
if (defined('RAXSDK_CACERTPEM') && file_exists(RAXSDK_CACERTPEM)) {
|
@@ -167,8 +142,8 @@ class CurlRequest implements HTTPRequest {
|
|
167 |
*/
|
168 |
public function setheaders($arr) {
|
169 |
if (!is_array($arr))
|
170 |
-
throw new HttpException(
|
171 |
-
|
172 |
foreach ($arr as $name=>$value)
|
173 |
$this->SetHeader($name, $value);
|
174 |
}
|
@@ -208,15 +183,15 @@ class CurlRequest implements HTTPRequest {
|
|
208 |
do {
|
209 |
$data = curl_exec($this->handle);
|
210 |
if (curl_errno($this->handle)&&($try_counter<$this->retries))
|
211 |
-
$this->debug(
|
212 |
curl_errno($this->handle), $this->url);
|
213 |
} while((++$try_counter<=$this->retries) &&
|
214 |
(curl_errno($this->handle)!=0));
|
215 |
|
216 |
// log retries error
|
217 |
if ($this->retries && curl_errno($this->handle))
|
218 |
-
throw new HttpRetryError(
|
219 |
-
sprintf(
|
220 |
curl_errno($this->handle)));
|
221 |
|
222 |
// check for CURL errors
|
@@ -224,24 +199,24 @@ class CurlRequest implements HTTPRequest {
|
|
224 |
case 0: // everything's ok
|
225 |
break;
|
226 |
case 3:
|
227 |
-
throw new HttpUrlError(
|
228 |
-
sprintf(
|
229 |
break;
|
230 |
case 28: // timeout
|
231 |
-
throw new HttpTimeoutError(
|
232 |
-
|
233 |
break;
|
234 |
default:
|
235 |
-
throw new HttpError(
|
236 |
sprintf(
|
237 |
-
|
238 |
$this->url,
|
239 |
curl_errno($this->handle),
|
240 |
curl_error($this->handle)));
|
241 |
}
|
242 |
|
243 |
// otherwise, return the HttpResponse
|
244 |
-
return new
|
245 |
}
|
246 |
|
247 |
/**
|
@@ -290,132 +265,4 @@ class CurlRequest implements HTTPRequest {
|
|
290 |
return strlen($header);
|
291 |
}
|
292 |
|
293 |
-
} // class CurlRequest
|
294 |
-
|
295 |
-
/**
|
296 |
-
* The HttpResponse returns an object with status information, separated
|
297 |
-
* headers, and any response body necessary.
|
298 |
-
*
|
299 |
-
* @api
|
300 |
-
* @author Glen Campbell <glen.campbell@rackspace.com>
|
301 |
-
*/
|
302 |
-
class HttpResponse extends \OpenCloud\Base {
|
303 |
-
|
304 |
-
private
|
305 |
-
$errno,
|
306 |
-
$error,
|
307 |
-
$info=array(),
|
308 |
-
$body,
|
309 |
-
$headers=array();
|
310 |
-
|
311 |
-
/**
|
312 |
-
* The constructor parses everything necessary
|
313 |
-
*/
|
314 |
-
public function __construct($request, $data) {
|
315 |
-
// save the raw data (who knows? we might need it)
|
316 |
-
$this->body = $data;
|
317 |
-
|
318 |
-
// and split each line into name: value pairs
|
319 |
-
foreach($request->ReturnHeaders() as $line) {
|
320 |
-
if (preg_match('/^([^:]+):\s+(.+?)\s*$/', $line, $matches))
|
321 |
-
$this->headers[$matches[1]] = $matches[2];
|
322 |
-
else
|
323 |
-
$this->headers[$line] = trim($line);
|
324 |
-
}
|
325 |
-
|
326 |
-
// debug caching
|
327 |
-
if (isset($this->headers['Cache-Control']))
|
328 |
-
$this->debug('Cache-Control: %s', $this->headers['Cache-Control']);
|
329 |
-
if (isset($this->headers['Expires']))
|
330 |
-
$this->debug('Expires: %s', $this->headers['Expires']);
|
331 |
-
|
332 |
-
// set some other data
|
333 |
-
$this->info = $request->info();
|
334 |
-
$this->errno = $request->errno();
|
335 |
-
$this->error = $request->error();
|
336 |
-
}
|
337 |
-
|
338 |
-
/**
|
339 |
-
* Returns the full body of the request
|
340 |
-
*
|
341 |
-
* @return string
|
342 |
-
*/
|
343 |
-
public function HttpBody() {
|
344 |
-
return $this->body;
|
345 |
-
}
|
346 |
-
|
347 |
-
/**
|
348 |
-
* Returns an array of headers
|
349 |
-
*
|
350 |
-
* @return associative array('header'=>value)
|
351 |
-
*/
|
352 |
-
public function Headers() {
|
353 |
-
return $this->headers;
|
354 |
-
}
|
355 |
-
|
356 |
-
/**
|
357 |
-
* Returns a single header
|
358 |
-
*
|
359 |
-
* @return string with the value of the requested header, or NULL
|
360 |
-
*/
|
361 |
-
public function Header($name) {
|
362 |
-
return $this->headers[$name];
|
363 |
-
}
|
364 |
-
|
365 |
-
/**
|
366 |
-
* Returns an array of information
|
367 |
-
*
|
368 |
-
* @return array
|
369 |
-
*/
|
370 |
-
public function info() {
|
371 |
-
return $this->info;
|
372 |
-
}
|
373 |
-
|
374 |
-
/**
|
375 |
-
* Returns the most recent error number
|
376 |
-
*
|
377 |
-
* @return integer
|
378 |
-
*/
|
379 |
-
public function errno() {
|
380 |
-
return $this->errno;
|
381 |
-
}
|
382 |
-
|
383 |
-
/**
|
384 |
-
* Returns the most recent error message
|
385 |
-
*
|
386 |
-
* @return string
|
387 |
-
*/
|
388 |
-
public function error() {
|
389 |
-
return $this->error;
|
390 |
-
}
|
391 |
-
|
392 |
-
/**
|
393 |
-
* Returns the HTTP status code
|
394 |
-
*
|
395 |
-
* @return integer
|
396 |
-
*/
|
397 |
-
public function HttpStatus() {
|
398 |
-
return $this->info['http_code'];
|
399 |
-
}
|
400 |
-
|
401 |
-
} // class HttpResponse
|
402 |
-
|
403 |
-
/**
|
404 |
-
* This is a stubbed-out variant of HttpResponse for unit testing
|
405 |
-
*/
|
406 |
-
class BlankResponse extends HttpResponse {
|
407 |
-
public
|
408 |
-
$errno,
|
409 |
-
$error,
|
410 |
-
$info,
|
411 |
-
$body,
|
412 |
-
$headers=array(),
|
413 |
-
$status=200,
|
414 |
-
$rawdata;
|
415 |
-
public function __construct($values=array()) {
|
416 |
-
foreach($values as $name => $value)
|
417 |
-
$this->$name = $value;
|
418 |
-
}
|
419 |
-
public function HttpBody() { return $this->body; }
|
420 |
-
public function HttpStatus() { return $this->status; }
|
421 |
-
}
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
+
namespace OpenCloud\Base\Request;
|
4 |
|
5 |
+
use OpenCloud\Base\Base;
|
6 |
+
use OpenCloud\Base\Request\HttpRequestInterface;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
/**
|
9 |
* The CurlRequest class is a simple wrapper to CURL functions. Not only does
|
14 |
* @api
|
15 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
16 |
*/
|
17 |
+
class Curl extends Base implements HttpRequestInterface {
|
18 |
|
19 |
private
|
20 |
$url,
|
41 |
// set our options
|
42 |
$this->SetOption(CURLOPT_CUSTOMREQUEST, $method);
|
43 |
foreach($options as $opt => $value) {
|
44 |
+
$this->debug(\OpenCloud\Base\Lang::translate('Setting option %s=%s'), $opt, $value);
|
45 |
+
$this->SetOption($opt, $value);
|
46 |
}
|
47 |
|
48 |
// set security handling options
|
49 |
+
if (RAXSDK_SSL_VERIFYHOST != 2) {
|
50 |
+
syslog(LOG_WARNING, \OpenCloud\Base\Lang::translate("WARNING: RAXSDK_SSL_VERIFYHOST has reduced security, value [" . RAXSDK_SSL_VERIFYHOST . "]\n"));
|
51 |
+
}
|
52 |
+
if (RAXSDK_SSL_VERIFYPEER !== TRUE) {
|
53 |
+
syslog(LOG_WARNING, \OpenCloud\Base\Lang::translate("WARNING: RAXSDK_SSL_VERIFYPEER has reduced security\n"));
|
54 |
+
}
|
|
|
55 |
$this->SetOption(CURLOPT_SSL_VERIFYHOST, RAXSDK_SSL_VERIFYHOST);
|
56 |
$this->SetOption(CURLOPT_SSL_VERIFYPEER, RAXSDK_SSL_VERIFYPEER);
|
57 |
if (defined('RAXSDK_CACERTPEM') && file_exists(RAXSDK_CACERTPEM)) {
|
142 |
*/
|
143 |
public function setheaders($arr) {
|
144 |
if (!is_array($arr))
|
145 |
+
throw new \OpenCloud\Base\Exceptions\HttpException(
|
146 |
+
\OpenCloud\Base\Lang::translate('Value passed to CurlRequest::setheaders() must be array'));
|
147 |
foreach ($arr as $name=>$value)
|
148 |
$this->SetHeader($name, $value);
|
149 |
}
|
183 |
do {
|
184 |
$data = curl_exec($this->handle);
|
185 |
if (curl_errno($this->handle)&&($try_counter<$this->retries))
|
186 |
+
$this->debug(\OpenCloud\Base\Lang::translate('Curl error [%d]; retrying [%s]'),
|
187 |
curl_errno($this->handle), $this->url);
|
188 |
} while((++$try_counter<=$this->retries) &&
|
189 |
(curl_errno($this->handle)!=0));
|
190 |
|
191 |
// log retries error
|
192 |
if ($this->retries && curl_errno($this->handle))
|
193 |
+
throw new \OpenCloud\Base\Exceptions\HttpRetryError(
|
194 |
+
sprintf(\OpenCloud\Base\Lang::translate('No more retries available, last error [%d]'),
|
195 |
curl_errno($this->handle)));
|
196 |
|
197 |
// check for CURL errors
|
199 |
case 0: // everything's ok
|
200 |
break;
|
201 |
case 3:
|
202 |
+
throw new \OpenCloud\Base\Exceptions\HttpUrlError(
|
203 |
+
sprintf(\OpenCloud\Base\Lang::translate('Malformed URL [%s]'), $this->url));
|
204 |
break;
|
205 |
case 28: // timeout
|
206 |
+
throw new \OpenCloud\Base\Exceptions\HttpTimeoutError(
|
207 |
+
\OpenCloud\Base\Lang::translate('Operation timed out; check RAXSDK_TIMEOUT value'));
|
208 |
break;
|
209 |
default:
|
210 |
+
throw new \OpenCloud\Base\Exceptions\HttpError(
|
211 |
sprintf(
|
212 |
+
\OpenCloud\Base\Lang::translate('HTTP error on [%s], curl code [%d] message [%s]'),
|
213 |
$this->url,
|
214 |
curl_errno($this->handle),
|
215 |
curl_error($this->handle)));
|
216 |
}
|
217 |
|
218 |
// otherwise, return the HttpResponse
|
219 |
+
return new Response\Http($this, $data);
|
220 |
}
|
221 |
|
222 |
/**
|
265 |
return strlen($header);
|
266 |
}
|
267 |
|
268 |
+
} // class CurlRequest
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sdk/OpenCloud/OpenCloud/Base/Request/HttpRequestInterface.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Request;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* The HttpRequest interface defines methods for wrapping CURL; this allows
|
7 |
+
* those methods to be stubbed out for unit testing, thus allowing us to
|
8 |
+
* test without actually making live calls.
|
9 |
+
*/
|
10 |
+
interface HttpRequestInterface
|
11 |
+
{
|
12 |
+
public function SetOption($name, $value);
|
13 |
+
public function setheaders($arr);
|
14 |
+
public function SetHeader($header, $value);
|
15 |
+
public function Execute();
|
16 |
+
public function close();
|
17 |
+
}
|
sdk/OpenCloud/OpenCloud/Base/Request/Response/Blank.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Request\Response;
|
4 |
+
|
5 |
+
class Blank extends Http {
|
6 |
+
public
|
7 |
+
$errno,
|
8 |
+
$error,
|
9 |
+
$info,
|
10 |
+
$body,
|
11 |
+
$headers=array(),
|
12 |
+
$status=200,
|
13 |
+
$rawdata;
|
14 |
+
public function __construct($values=array()) {
|
15 |
+
foreach($values as $name => $value)
|
16 |
+
$this->$name = $value;
|
17 |
+
}
|
18 |
+
public function HttpBody() { return $this->body; }
|
19 |
+
public function HttpStatus() { return $this->status; }
|
20 |
+
}
|
sdk/OpenCloud/OpenCloud/Base/Request/Response/Http.php
ADDED
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base\Request\Response;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* The HttpResponse returns an object with status information, separated
|
7 |
+
* headers, and any response body necessary.
|
8 |
+
*
|
9 |
+
* @api
|
10 |
+
* @author Glen Campbell <glen.campbell@rackspace.com>
|
11 |
+
*/
|
12 |
+
|
13 |
+
class Http extends \OpenCloud\Base\Base {
|
14 |
+
|
15 |
+
private
|
16 |
+
$errno,
|
17 |
+
$error,
|
18 |
+
$info=array(),
|
19 |
+
$body,
|
20 |
+
$headers=array();
|
21 |
+
|
22 |
+
/**
|
23 |
+
* The constructor parses everything necessary
|
24 |
+
*/
|
25 |
+
public function __construct($request, $data) {
|
26 |
+
// save the raw data (who knows? we might need it)
|
27 |
+
$this->body = $data;
|
28 |
+
|
29 |
+
// and split each line into name: value pairs
|
30 |
+
foreach($request->ReturnHeaders() as $line) {
|
31 |
+
if (preg_match('/^([^:]+):\s+(.+?)\s*$/', $line, $matches))
|
32 |
+
$this->headers[$matches[1]] = $matches[2];
|
33 |
+
else
|
34 |
+
$this->headers[$line] = trim($line);
|
35 |
+
}
|
36 |
+
|
37 |
+
// debug caching
|
38 |
+
if (isset($this->headers['Cache-Control']))
|
39 |
+
$this->debug('Cache-Control: %s', $this->headers['Cache-Control']);
|
40 |
+
if (isset($this->headers['Expires']))
|
41 |
+
$this->debug('Expires: %s', $this->headers['Expires']);
|
42 |
+
|
43 |
+
// set some other data
|
44 |
+
$this->info = $request->info();
|
45 |
+
$this->errno = $request->errno();
|
46 |
+
$this->error = $request->error();
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Returns the full body of the request
|
51 |
+
*
|
52 |
+
* @return string
|
53 |
+
*/
|
54 |
+
public function HttpBody() {
|
55 |
+
return $this->body;
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Returns an array of headers
|
60 |
+
*
|
61 |
+
* @return associative array('header'=>value)
|
62 |
+
*/
|
63 |
+
public function Headers() {
|
64 |
+
return $this->headers;
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Returns a single header
|
69 |
+
*
|
70 |
+
* @return string with the value of the requested header, or NULL
|
71 |
+
*/
|
72 |
+
public function Header($name) {
|
73 |
+
return isset($this->headers[$name]) ? $this->headers[$name] : NULL;
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Returns an array of information
|
78 |
+
*
|
79 |
+
* @return array
|
80 |
+
*/
|
81 |
+
public function info() {
|
82 |
+
return $this->info;
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Returns the most recent error number
|
87 |
+
*
|
88 |
+
* @return integer
|
89 |
+
*/
|
90 |
+
public function errno() {
|
91 |
+
return $this->errno;
|
92 |
+
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Returns the most recent error message
|
96 |
+
*
|
97 |
+
* @return string
|
98 |
+
*/
|
99 |
+
public function error() {
|
100 |
+
return $this->error;
|
101 |
+
}
|
102 |
+
|
103 |
+
/**
|
104 |
+
* Returns the HTTP status code
|
105 |
+
*
|
106 |
+
* @return integer
|
107 |
+
*/
|
108 |
+
public function HttpStatus() {
|
109 |
+
return $this->info['http_code'];
|
110 |
+
}
|
111 |
+
|
112 |
+
} // class HttpResponse
|
sdk/OpenCloud/OpenCloud/Base/ServiceCatalogItem.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\Base;
|
4 |
+
/**
|
5 |
+
* Holds information on a single service from the Service Catalog
|
6 |
+
*/
|
7 |
+
class ServiceCatalogItem {
|
8 |
+
public function __construct($info=array()) {
|
9 |
+
foreach($info as $key => $value)
|
10 |
+
$this->$key = $value;
|
11 |
+
}
|
12 |
+
}
|
sdk/OpenCloud/{flavor.php → OpenCloud/Compute/Flavor.php}
RENAMED
@@ -13,15 +13,13 @@
|
|
13 |
|
14 |
namespace OpenCloud\Compute;
|
15 |
|
16 |
-
require_once(__DIR__.'/persistentobject.php');
|
17 |
-
|
18 |
/**
|
19 |
* The Flavor class represents a flavor defined by the Compute service
|
20 |
*
|
21 |
* At its simplest, a Flavor represents a combination of RAM, disk space,
|
22 |
* and compute CPUs, though there are other extended attributes.
|
23 |
*/
|
24 |
-
class Flavor extends \OpenCloud\PersistentObject {
|
25 |
|
26 |
public
|
27 |
$status,
|
13 |
|
14 |
namespace OpenCloud\Compute;
|
15 |
|
|
|
|
|
16 |
/**
|
17 |
* The Flavor class represents a flavor defined by the Compute service
|
18 |
*
|
19 |
* At its simplest, a Flavor represents a combination of RAM, disk space,
|
20 |
* and compute CPUs, though there are other extended attributes.
|
21 |
*/
|
22 |
+
class Flavor extends \OpenCloud\AbstractClass\PersistentObject {
|
23 |
|
24 |
public
|
25 |
$status,
|
sdk/OpenCloud/{image.php → OpenCloud/Compute/Image.php}
RENAMED
@@ -12,8 +12,6 @@
|
|
12 |
|
13 |
namespace OpenCloud\Compute;
|
14 |
|
15 |
-
require_once(__DIR__.'/persistentobject.php');
|
16 |
-
|
17 |
/**
|
18 |
* The Image class represents a stored machine image returned by the
|
19 |
* Compute service.
|
@@ -23,7 +21,7 @@ require_once(__DIR__.'/persistentobject.php');
|
|
23 |
* not available to Rackspace customers, so we're using the /images
|
24 |
* resource on the servers API endpoint.
|
25 |
*/
|
26 |
-
class Image extends \OpenCloud\PersistentObject {
|
27 |
|
28 |
public
|
29 |
$status,
|
12 |
|
13 |
namespace OpenCloud\Compute;
|
14 |
|
|
|
|
|
15 |
/**
|
16 |
* The Image class represents a stored machine image returned by the
|
17 |
* Compute service.
|
21 |
* not available to Rackspace customers, so we're using the /images
|
22 |
* resource on the servers API endpoint.
|
23 |
*/
|
24 |
+
class Image extends \OpenCloud\AbstractClass\PersistentObject {
|
25 |
|
26 |
public
|
27 |
$status,
|
sdk/OpenCloud/{network.php → OpenCloud/Compute/Network.php}
RENAMED
@@ -12,16 +12,13 @@
|
|
12 |
|
13 |
namespace OpenCloud\Compute;
|
14 |
|
15 |
-
require_once(__DIR__.'/persistentobject.php');
|
16 |
-
require_once(__DIR__.'/metadata.php');
|
17 |
-
|
18 |
/**
|
19 |
* The Network class represents a single virtual network
|
20 |
*
|
21 |
* @api
|
22 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
23 |
*/
|
24 |
-
class Network extends \OpenCloud\PersistentObject {
|
25 |
|
26 |
public
|
27 |
$id,
|
@@ -44,7 +41,7 @@ class Network extends \OpenCloud\PersistentObject {
|
|
44 |
* RAX_PUBLIC and RAX_PRIVATE
|
45 |
* @return void
|
46 |
*/
|
47 |
-
public function __construct(\OpenCloud\Compute $service, $id=NULL) {
|
48 |
$this->id = $id;
|
49 |
switch($id) {
|
50 |
case RAX_PUBLIC:
|
@@ -66,7 +63,7 @@ class Network extends \OpenCloud\PersistentObject {
|
|
66 |
* @throws NetworkUpdateError always
|
67 |
*/
|
68 |
public function Update($params=array()) {
|
69 |
-
throw new NetworkUpdateError(
|
70 |
}
|
71 |
|
72 |
/**
|
@@ -80,7 +77,7 @@ class Network extends \OpenCloud\PersistentObject {
|
|
80 |
switch($this->id) {
|
81 |
case RAX_PUBLIC:
|
82 |
case RAX_PRIVATE:
|
83 |
-
throw new \OpenCloud\DeleteError(
|
84 |
default:
|
85 |
return parent::Delete();
|
86 |
}
|
12 |
|
13 |
namespace OpenCloud\Compute;
|
14 |
|
|
|
|
|
|
|
15 |
/**
|
16 |
* The Network class represents a single virtual network
|
17 |
*
|
18 |
* @api
|
19 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
20 |
*/
|
21 |
+
class Network extends \OpenCloud\AbstractClass\PersistentObject {
|
22 |
|
23 |
public
|
24 |
$id,
|
41 |
* RAX_PUBLIC and RAX_PRIVATE
|
42 |
* @return void
|
43 |
*/
|
44 |
+
public function __construct(\OpenCloud\Compute\Service $service, $id=NULL) {
|
45 |
$this->id = $id;
|
46 |
switch($id) {
|
47 |
case RAX_PUBLIC:
|
63 |
* @throws NetworkUpdateError always
|
64 |
*/
|
65 |
public function Update($params=array()) {
|
66 |
+
throw new \OpenCloud\Base\Exceptions\NetworkUpdateError(\OpenCloud\Base\Lang::translate('Isolated networks cannot be updated'));
|
67 |
}
|
68 |
|
69 |
/**
|
77 |
switch($this->id) {
|
78 |
case RAX_PUBLIC:
|
79 |
case RAX_PRIVATE:
|
80 |
+
throw new \OpenCloud\Base\Exceptions\DeleteError(\OpenCloud\Base\Lang::translate('Network may not be deleted'));
|
81 |
default:
|
82 |
return parent::Delete();
|
83 |
}
|
sdk/OpenCloud/{server.php → OpenCloud/Compute/Server.php}
RENAMED
@@ -12,10 +12,6 @@
|
|
12 |
|
13 |
namespace OpenCloud\Compute;
|
14 |
|
15 |
-
require_once(__DIR__.'/persistentobject.php');
|
16 |
-
require_once(__DIR__.'/metadata.php');
|
17 |
-
require_once(__DIR__.'/volumeattachment.php');
|
18 |
-
|
19 |
/**
|
20 |
* The Server class represents a single server node.
|
21 |
*
|
@@ -26,7 +22,7 @@ require_once(__DIR__.'/volumeattachment.php');
|
|
26 |
* @api
|
27 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
28 |
*/
|
29 |
-
class Server extends \OpenCloud\PersistentObject {
|
30 |
|
31 |
public
|
32 |
$status, // server status
|
@@ -73,7 +69,7 @@ class Server extends \OpenCloud\PersistentObject {
|
|
73 |
* @throws ServerNotFound if a 404 is returned
|
74 |
* @throws UnknownError if another error status is reported
|
75 |
*/
|
76 |
-
public function __construct(\OpenCloud\Compute $service, $info=NULL) {
|
77 |
// make the service persistent
|
78 |
parent::__construct($service, $info);
|
79 |
|
@@ -101,8 +97,8 @@ class Server extends \OpenCloud\PersistentObject {
|
|
101 |
case 6:
|
102 |
return $this->accessIPv6;
|
103 |
default:
|
104 |
-
throw new InvalidIpTypeError(
|
105 |
-
|
106 |
}
|
107 |
}
|
108 |
|
@@ -129,7 +125,7 @@ class Server extends \OpenCloud\PersistentObject {
|
|
129 |
$this->metadata->sdk = RAXSDK_USER_AGENT;
|
130 |
$this->imageRef = $this->image->links[0]->href;
|
131 |
$this->flavorRef = $this->flavor->links[0]->href;
|
132 |
-
$this->debug(
|
133 |
$create = $this->CreateJson( $rebuild ? 'rebuild' : 'server' );
|
134 |
$response = $this->Service()->Request(
|
135 |
$this->Service()->Url(),
|
@@ -138,19 +134,19 @@ class Server extends \OpenCloud\PersistentObject {
|
|
138 |
$create
|
139 |
);
|
140 |
if (!is_object($response))
|
141 |
-
throw new \OpenCloud\HttpError(sprintf(
|
142 |
-
|
143 |
$rebuild ? 'Rebuild' : 'Create'));
|
144 |
$json = $response->HttpBody();
|
145 |
if ($response->HttpStatus() >= 300)
|
146 |
-
throw new ServerCreateError(
|
147 |
-
sprintf(
|
148 |
'status [%d] response [%s]'),
|
149 |
$create,
|
150 |
$response->HttpStatus(),
|
151 |
$response->HttpBody()));
|
152 |
else if (!$json)
|
153 |
-
throw new UnknownError(
|
154 |
else {
|
155 |
$info = json_decode($json);
|
156 |
if ($this->CheckJsonError())
|
@@ -204,8 +200,8 @@ class Server extends \OpenCloud\PersistentObject {
|
|
204 |
*/
|
205 |
public function CreateImage($name, $metadata=array()) {
|
206 |
if (!strlen($name))
|
207 |
-
throw new ImageError(
|
208 |
-
|
209 |
|
210 |
// construct a createImage object for jsonization
|
211 |
$obj = new \stdClass();
|
@@ -214,7 +210,14 @@ class Server extends \OpenCloud\PersistentObject {
|
|
214 |
$obj->createImage->metadata = new \stdClass();
|
215 |
foreach($metadata as $name => $value)
|
216 |
$obj->createImage->metadata->$name = $value;
|
217 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
218 |
}
|
219 |
|
220 |
/**
|
@@ -285,8 +288,8 @@ class Server extends \OpenCloud\PersistentObject {
|
|
285 |
public function Rescue() {
|
286 |
$this->CheckExtension('os-rescue');
|
287 |
if (!isset($this->id))
|
288 |
-
throw new \OpenCloud\ServerActionError(
|
289 |
-
|
290 |
$obj = new \stdClass();
|
291 |
$obj->rescue = "none";
|
292 |
$resp = $this->Action($obj);
|
@@ -294,8 +297,8 @@ class Server extends \OpenCloud\PersistentObject {
|
|
294 |
if ($this->CheckJsonError())
|
295 |
return FALSE;
|
296 |
elseif (!isset($newobj->adminPass))
|
297 |
-
throw new \OpenCloud\ServerActionError(sprintf(
|
298 |
-
|
299 |
'status [%s] response [%s]'),
|
300 |
$resp->HttpStatus(), $resp->HttpBody()));
|
301 |
else
|
@@ -314,8 +317,8 @@ class Server extends \OpenCloud\PersistentObject {
|
|
314 |
public function Unrescue() {
|
315 |
$this->CheckExtension('os-rescue');
|
316 |
if (!isset($this->id))
|
317 |
-
throw new \OpenCloud\ServerActionError(
|
318 |
-
|
319 |
$obj = new \stdClass();
|
320 |
$obj->unrescue = NULL;
|
321 |
return $this->Action($obj);
|
@@ -355,11 +358,11 @@ class Server extends \OpenCloud\PersistentObject {
|
|
355 |
* @throws ServerIpsError
|
356 |
*/
|
357 |
public function ips($network=NULL) {
|
358 |
-
$url = noslash($this->Url('ips/'.$network));
|
359 |
$response = $this->Service()->Request($url);
|
360 |
if ($response->HttpStatus() >= 300)
|
361 |
-
throw new ServerIpsError(
|
362 |
-
sprintf(
|
363 |
$response->HttpStatus(), $response->HttpBody()));
|
364 |
$obj = json_decode($response->HttpBody());
|
365 |
if ($this->CheckJsonError())
|
@@ -386,7 +389,7 @@ class Server extends \OpenCloud\PersistentObject {
|
|
386 |
* to `/dev/xvhdb`).
|
387 |
* @param string $device the device to which to attach it
|
388 |
*/
|
389 |
-
public function AttachVolume(\OpenCloud\
|
390 |
$device='auto') {
|
391 |
$this->CheckExtension('os-volumes');
|
392 |
$attachment = $this->VolumeAttachment();
|
@@ -405,7 +408,7 @@ class Server extends \OpenCloud\PersistentObject {
|
|
405 |
* @param OpenCloud\VolumeService\Volume $vol the volume to remove
|
406 |
* @throws VolumeError
|
407 |
*/
|
408 |
-
public function DetachVolume(\OpenCloud\
|
409 |
$this->CheckExtension('os-volumes');
|
410 |
$attachment = $this->VolumeAttachment($vol->id);
|
411 |
return $attachment->Delete();
|
@@ -472,8 +475,8 @@ class Server extends \OpenCloud\PersistentObject {
|
|
472 |
$obj->$element->networks = array();
|
473 |
foreach($this->networks as $net) {
|
474 |
if (get_class($net) != 'OpenCloud\Compute\Network')
|
475 |
-
throw new
|
476 |
-
|
477 |
'Compute\Network objects; [%s] found'),
|
478 |
get_class($net)));
|
479 |
$netobj = new \stdClass();
|
12 |
|
13 |
namespace OpenCloud\Compute;
|
14 |
|
|
|
|
|
|
|
|
|
15 |
/**
|
16 |
* The Server class represents a single server node.
|
17 |
*
|
22 |
* @api
|
23 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
24 |
*/
|
25 |
+
class Server extends \OpenCloud\AbstractClass\PersistentObject {
|
26 |
|
27 |
public
|
28 |
$status, // server status
|
69 |
* @throws ServerNotFound if a 404 is returned
|
70 |
* @throws UnknownError if another error status is reported
|
71 |
*/
|
72 |
+
public function __construct(\OpenCloud\Compute\Service $service, $info=NULL) {
|
73 |
// make the service persistent
|
74 |
parent::__construct($service, $info);
|
75 |
|
97 |
case 6:
|
98 |
return $this->accessIPv6;
|
99 |
default:
|
100 |
+
throw new \OpenCloud\Base\Exceptions\InvalidIpTypeError(
|
101 |
+
\OpenCloud\Base\Lang::translate('Invalid IP address type; must be 4 or 6'));
|
102 |
}
|
103 |
}
|
104 |
|
125 |
$this->metadata->sdk = RAXSDK_USER_AGENT;
|
126 |
$this->imageRef = $this->image->links[0]->href;
|
127 |
$this->flavorRef = $this->flavor->links[0]->href;
|
128 |
+
$this->debug(\OpenCloud\Base\Lang::translate('Server::Create() [%s]'), $this->name);
|
129 |
$create = $this->CreateJson( $rebuild ? 'rebuild' : 'server' );
|
130 |
$response = $this->Service()->Request(
|
131 |
$this->Service()->Url(),
|
134 |
$create
|
135 |
);
|
136 |
if (!is_object($response))
|
137 |
+
throw new \OpenCloud\Base\Exceptions\HttpError(sprintf(
|
138 |
+
\OpenCloud\Base\Lang::translate('Invalid response for Server::%s() request'),
|
139 |
$rebuild ? 'Rebuild' : 'Create'));
|
140 |
$json = $response->HttpBody();
|
141 |
if ($response->HttpStatus() >= 300)
|
142 |
+
throw new \OpenCloud\Base\Exceptions\ServerCreateError(
|
143 |
+
sprintf(\OpenCloud\Base\Lang::translate('Problem creating server with [%s], '.
|
144 |
'status [%d] response [%s]'),
|
145 |
$create,
|
146 |
$response->HttpStatus(),
|
147 |
$response->HttpBody()));
|
148 |
else if (!$json)
|
149 |
+
throw new \OpenCloud\Base\Exceptions\UnknownError(\OpenCloud\Base\Lang::translate('Unexpected error in Server::Create()'));
|
150 |
else {
|
151 |
$info = json_decode($json);
|
152 |
if ($this->CheckJsonError())
|
200 |
*/
|
201 |
public function CreateImage($name, $metadata=array()) {
|
202 |
if (!strlen($name))
|
203 |
+
throw new \OpenCloud\Base\Exceptions\ImageError(
|
204 |
+
\OpenCloud\Base\Lang::translate('Image name is required to create an image'));
|
205 |
|
206 |
// construct a createImage object for jsonization
|
207 |
$obj = new \stdClass();
|
210 |
$obj->createImage->metadata = new \stdClass();
|
211 |
foreach($metadata as $name => $value)
|
212 |
$obj->createImage->metadata->$name = $value;
|
213 |
+
$resp = $this->Action($obj);
|
214 |
+
if ($resp === FALSE)
|
215 |
+
return FALSE;
|
216 |
+
$location = $resp->Header('Location');
|
217 |
+
if (!$location)
|
218 |
+
return FALSE;
|
219 |
+
$imgid = basename($location);
|
220 |
+
return new Image($this->Service(), $imgid);
|
221 |
}
|
222 |
|
223 |
/**
|
288 |
public function Rescue() {
|
289 |
$this->CheckExtension('os-rescue');
|
290 |
if (!isset($this->id))
|
291 |
+
throw new \OpenCloud\Base\Exceptions\ServerActionError(
|
292 |
+
\OpenCloud\Base\Lang::translate('Server has no ID; cannot Rescue()'));
|
293 |
$obj = new \stdClass();
|
294 |
$obj->rescue = "none";
|
295 |
$resp = $this->Action($obj);
|
297 |
if ($this->CheckJsonError())
|
298 |
return FALSE;
|
299 |
elseif (!isset($newobj->adminPass))
|
300 |
+
throw new \OpenCloud\Base\Exceptions\ServerActionError(sprintf(
|
301 |
+
\OpenCloud\Base\Lang::translate('Rescue() method failed unexpectedly, '.
|
302 |
'status [%s] response [%s]'),
|
303 |
$resp->HttpStatus(), $resp->HttpBody()));
|
304 |
else
|
317 |
public function Unrescue() {
|
318 |
$this->CheckExtension('os-rescue');
|
319 |
if (!isset($this->id))
|
320 |
+
throw new \OpenCloud\Base\Exceptions\ServerActionError(
|
321 |
+
\OpenCloud\Base\Lang::translate('Server has no ID; cannot Unescue()'));
|
322 |
$obj = new \stdClass();
|
323 |
$obj->unrescue = NULL;
|
324 |
return $this->Action($obj);
|
358 |
* @throws ServerIpsError
|
359 |
*/
|
360 |
public function ips($network=NULL) {
|
361 |
+
$url = \OpenCloud\Base\Lang::noslash($this->Url('ips/'.$network));
|
362 |
$response = $this->Service()->Request($url);
|
363 |
if ($response->HttpStatus() >= 300)
|
364 |
+
throw new \OpenCloud\Base\Exceptions\ServerIpsError(
|
365 |
+
sprintf(\OpenCloud\Base\Lang::translate('Error in Server::ips(), status [%d], response [%s]'),
|
366 |
$response->HttpStatus(), $response->HttpBody()));
|
367 |
$obj = json_decode($response->HttpBody());
|
368 |
if ($this->CheckJsonError())
|
389 |
* to `/dev/xvhdb`).
|
390 |
* @param string $device the device to which to attach it
|
391 |
*/
|
392 |
+
public function AttachVolume(\OpenCloud\Volume\Volume $vol,
|
393 |
$device='auto') {
|
394 |
$this->CheckExtension('os-volumes');
|
395 |
$attachment = $this->VolumeAttachment();
|
408 |
* @param OpenCloud\VolumeService\Volume $vol the volume to remove
|
409 |
* @throws VolumeError
|
410 |
*/
|
411 |
+
public function DetachVolume(\OpenCloud\Volume\Volume $vol) {
|
412 |
$this->CheckExtension('os-volumes');
|
413 |
$attachment = $this->VolumeAttachment($vol->id);
|
414 |
return $attachment->Delete();
|
475 |
$obj->$element->networks = array();
|
476 |
foreach($this->networks as $net) {
|
477 |
if (get_class($net) != 'OpenCloud\Compute\Network')
|
478 |
+
throw new OpenCloud\Base\Exceptions\InvalidParameterError(sprintf(
|
479 |
+
\OpenCloud\Base\Lang::translate('"networks" parameter must be an array of '.
|
480 |
'Compute\Network objects; [%s] found'),
|
481 |
get_class($net)));
|
482 |
$netobj = new \stdClass();
|
sdk/OpenCloud/{servermetadata.php → OpenCloud/Compute/ServerMetadata.php}
RENAMED
@@ -13,7 +13,7 @@
|
|
13 |
|
14 |
namespace OpenCloud\Compute;
|
15 |
|
16 |
-
|
17 |
|
18 |
/**
|
19 |
* This class handles server metadata
|
@@ -24,7 +24,8 @@ require_once(__DIR__.'/metadata.php');
|
|
24 |
*
|
25 |
* @author Glen Campbell <glen.campbell@rackspace.com>s
|
26 |
*/
|
27 |
-
class ServerMetadata extends \OpenCloud\Metadata {
|
|
|
28 |
private
|
29 |
$_parent, // the parent object
|
30 |
$_key, // the metadata item (if supplied)
|
@@ -51,12 +52,12 @@ class ServerMetadata extends \OpenCloud\Metadata {
|
|
51 |
|
52 |
// check the response
|
53 |
if ($response->HttpStatus() >= 300)
|
54 |
-
throw new MetadataError(
|
55 |
sprintf(
|
56 |
-
|
57 |
$this->Url(), $response->HttpBody()));
|
58 |
|
59 |
-
$this->debug(
|
60 |
$this->Url(), $response->HttpBody());
|
61 |
|
62 |
// parse and assign the server metadata
|
@@ -76,7 +77,7 @@ class ServerMetadata extends \OpenCloud\Metadata {
|
|
76 |
*/
|
77 |
public function Url() {
|
78 |
if (!isset($this->_url))
|
79 |
-
throw new ServerUrlError(
|
80 |
if ($this->_key)
|
81 |
return $this->_url . '/' . $this->_key;
|
82 |
else
|
@@ -104,8 +105,8 @@ class ServerMetadata extends \OpenCloud\Metadata {
|
|
104 |
|
105 |
// check the response
|
106 |
if ($response->HttpStatus() >= 300)
|
107 |
-
throw new MetadataCreateError(
|
108 |
-
sprintf(
|
109 |
$this->Url(), $response->HttpBody()));
|
110 |
}
|
111 |
|
@@ -127,8 +128,8 @@ class ServerMetadata extends \OpenCloud\Metadata {
|
|
127 |
|
128 |
// check the response
|
129 |
if ($response->HttpStatus() >= 300)
|
130 |
-
throw new MetadataUpdateError(
|
131 |
-
sprintf(
|
132 |
$this->Url(), $response->HttpBody()));
|
133 |
}
|
134 |
|
@@ -149,8 +150,8 @@ class ServerMetadata extends \OpenCloud\Metadata {
|
|
149 |
|
150 |
// check the response
|
151 |
if ($response->HttpStatus() >= 300)
|
152 |
-
throw new MetadataDeleteError(
|
153 |
-
sprintf(
|
154 |
$this->Url(), $response->HttpBody()));
|
155 |
}
|
156 |
|
@@ -176,8 +177,8 @@ class ServerMetadata extends \OpenCloud\Metadata {
|
|
176 |
// if a key was supplied when creating the object, then we can't set
|
177 |
// any other values
|
178 |
if ($this->_key and ($key != $this->_key))
|
179 |
-
throw new MetadataKeyError(
|
180 |
-
sprintf(
|
181 |
$this->Url()));
|
182 |
|
183 |
// otherwise, just set it;
|
@@ -207,8 +208,8 @@ class ServerMetadata extends \OpenCloud\Metadata {
|
|
207 |
}
|
208 |
$json = json_encode($obj);
|
209 |
if ($this->CheckJsonError())
|
210 |
-
throw new MetadataJsonError(
|
211 |
-
|
212 |
else
|
213 |
return $json;
|
214 |
}
|
13 |
|
14 |
namespace OpenCloud\Compute;
|
15 |
|
16 |
+
use OpenCloud\Base\Lang;
|
17 |
|
18 |
/**
|
19 |
* This class handles server metadata
|
24 |
*
|
25 |
* @author Glen Campbell <glen.campbell@rackspace.com>s
|
26 |
*/
|
27 |
+
class ServerMetadata extends \OpenCloud\Base\Metadata {
|
28 |
+
|
29 |
private
|
30 |
$_parent, // the parent object
|
31 |
$_key, // the metadata item (if supplied)
|
52 |
|
53 |
// check the response
|
54 |
if ($response->HttpStatus() >= 300)
|
55 |
+
throw new \OpenCloud\Base\Exceptions\MetadataError(
|
56 |
sprintf(
|
57 |
+
Lang::translate('Unable to retrieve metadata [%s], response [%s]'),
|
58 |
$this->Url(), $response->HttpBody()));
|
59 |
|
60 |
+
$this->debug(Lang::translate('Metadata for [%s] is [%s]'),
|
61 |
$this->Url(), $response->HttpBody());
|
62 |
|
63 |
// parse and assign the server metadata
|
77 |
*/
|
78 |
public function Url() {
|
79 |
if (!isset($this->_url))
|
80 |
+
throw new \OpenCloud\Base\Exceptions\ServerUrlError(Lang::translate('Metadata has no URL (new object)'));
|
81 |
if ($this->_key)
|
82 |
return $this->_url . '/' . $this->_key;
|
83 |
else
|
105 |
|
106 |
// check the response
|
107 |
if ($response->HttpStatus() >= 300)
|
108 |
+
throw new \OpenCloud\Base\Exceptions\MetadataCreateError(
|
109 |
+
sprintf(Lang::translate('Error setting metadata on [%s], response [%s]'),
|
110 |
$this->Url(), $response->HttpBody()));
|
111 |
}
|
112 |
|
128 |
|
129 |
// check the response
|
130 |
if ($response->HttpStatus() >= 300)
|
131 |
+
throw new \OpenCloud\Base\Exceptions\MetadataUpdateError(
|
132 |
+
sprintf(Lang::translate('Error updating metadata on [%s], response [%s]'),
|
133 |
$this->Url(), $response->HttpBody()));
|
134 |
}
|
135 |
|
150 |
|
151 |
// check the response
|
152 |
if ($response->HttpStatus() >= 300)
|
153 |
+
throw new \OpenCloud\Base\Exceptions\MetadataDeleteError(
|
154 |
+
sprintf(Lang::translate('Error deleting metadata on [%s], response [%s]'),
|
155 |
$this->Url(), $response->HttpBody()));
|
156 |
}
|
157 |
|
177 |
// if a key was supplied when creating the object, then we can't set
|
178 |
// any other values
|
179 |
if ($this->_key and ($key != $this->_key))
|
180 |
+
throw new \OpenCloud\Base\Exceptions\MetadataKeyError(
|
181 |
+
sprintf(Lang::translate('You cannot set extra values on [%s]'),
|
182 |
$this->Url()));
|
183 |
|
184 |
// otherwise, just set it;
|
208 |
}
|
209 |
$json = json_encode($obj);
|
210 |
if ($this->CheckJsonError())
|
211 |
+
throw new \OpenCloud\Base\Exceptions\MetadataJsonError(
|
212 |
+
Lang::translate('Unable to encode JSON for metadata'));
|
213 |
else
|
214 |
return $json;
|
215 |
}
|
sdk/OpenCloud/{compute.php → OpenCloud/Compute/Service.php}
RENAMED
@@ -10,13 +10,9 @@
|
|
10 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
11 |
*/
|
12 |
|
13 |
-
namespace OpenCloud;
|
14 |
|
15 |
-
|
16 |
-
require_once(__DIR__.'/server.php');
|
17 |
-
require_once(__DIR__.'/image.php');
|
18 |
-
require_once(__DIR__.'/network.php');
|
19 |
-
require_once(__DIR__.'/servermetadata.php');
|
20 |
|
21 |
/**
|
22 |
* The Compute class represents the OpenStack Nova service.
|
@@ -47,7 +43,7 @@ require_once(__DIR__.'/servermetadata.php');
|
|
47 |
* </code>
|
48 |
*
|
49 |
*/
|
50 |
-
class
|
51 |
|
52 |
/**
|
53 |
* Called when creating a new Compute service object
|
@@ -65,9 +61,9 @@ class Compute extends Nova {
|
|
65 |
* @param string $serviceName - identifies the name of the service in the
|
66 |
* catalog
|
67 |
*/
|
68 |
-
public function __construct(OpenStack $conn,
|
69 |
$serviceName, $serviceRegion, $urltype) {
|
70 |
-
$this->debug(
|
71 |
parent::__construct(
|
72 |
$conn,
|
73 |
'compute',
|
@@ -79,8 +75,8 @@ class Compute extends Nova {
|
|
79 |
// check the URL version
|
80 |
$path = parse_url($this->Url(), PHP_URL_PATH);
|
81 |
if (substr($path, 0, 3) == '/v1')
|
82 |
-
throw new
|
83 |
-
|
84 |
$this->Url()));
|
85 |
|
86 |
// load extension namespaces
|
@@ -97,7 +93,7 @@ class Compute extends Nova {
|
|
97 |
* strings to append to the URL
|
98 |
* @returns string - the requested URL
|
99 |
*/
|
100 |
-
public function Url($resource='servers', $args=array()) {
|
101 |
return parent::Url($resource, $args);
|
102 |
}
|
103 |
|
@@ -113,7 +109,7 @@ class Compute extends Nova {
|
|
113 |
* @returns Compute\Server object
|
114 |
*/
|
115 |
public function Server($id=NULL) {
|
116 |
-
return new
|
117 |
}
|
118 |
|
119 |
/**
|
@@ -134,16 +130,16 @@ class Compute extends Nova {
|
|
134 |
*/
|
135 |
public function ServerList($details=TRUE, $filter=array()) {
|
136 |
if (!is_bool($details))
|
137 |
-
throw new InvalidArgumentException(
|
138 |
-
|
139 |
if (!is_array($filter))
|
140 |
-
throw new InvalidArgumentException(
|
141 |
-
|
142 |
if ($details)
|
143 |
-
$url = $this->Url(
|
144 |
$filter);
|
145 |
else
|
146 |
-
$url = $this->Url(
|
147 |
|
148 |
return $this->Collection('\OpenCloud\Compute\Server', $url);
|
149 |
}
|
@@ -156,7 +152,7 @@ class Compute extends Nova {
|
|
156 |
* @return Compute\Network
|
157 |
*/
|
158 |
public function Network($id=NULL) {
|
159 |
-
return new
|
160 |
}
|
161 |
|
162 |
/**
|
@@ -181,7 +177,7 @@ class Compute extends Nova {
|
|
181 |
* @return Compute\Image object
|
182 |
*/
|
183 |
public function Image($id=NULL) {
|
184 |
-
return new
|
185 |
}
|
186 |
|
187 |
/**
|
@@ -204,8 +200,8 @@ class Compute extends Nova {
|
|
204 |
public function ImageList($details=TRUE, $filter=array()) {
|
205 |
// validate arguments
|
206 |
if (gettype($details)!='boolean')
|
207 |
-
throw new
|
208 |
-
|
209 |
'boolean required'));
|
210 |
if ($details)
|
211 |
$url = $this->Url('images/detail', $filter);
|
10 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
11 |
*/
|
12 |
|
13 |
+
namespace OpenCloud\Compute;
|
14 |
|
15 |
+
use OpenCloud\Base\Lang;
|
|
|
|
|
|
|
|
|
16 |
|
17 |
/**
|
18 |
* The Compute class represents the OpenStack Nova service.
|
43 |
* </code>
|
44 |
*
|
45 |
*/
|
46 |
+
class Service extends \OpenCloud\AbstractClass\Nova {
|
47 |
|
48 |
/**
|
49 |
* Called when creating a new Compute service object
|
61 |
* @param string $serviceName - identifies the name of the service in the
|
62 |
* catalog
|
63 |
*/
|
64 |
+
public function __construct(\OpenCloud\OpenStack $conn,
|
65 |
$serviceName, $serviceRegion, $urltype) {
|
66 |
+
$this->debug(Lang::translate('initializing Compute...'));
|
67 |
parent::__construct(
|
68 |
$conn,
|
69 |
'compute',
|
75 |
// check the URL version
|
76 |
$path = parse_url($this->Url(), PHP_URL_PATH);
|
77 |
if (substr($path, 0, 3) == '/v1')
|
78 |
+
throw new \OpenCloud\Base\Exceptions\UnsupportedVersionError(sprintf(
|
79 |
+
\OpenCloud\Base\Lang::translate('Sorry; API version /v1 is not supported [%s]'),
|
80 |
$this->Url()));
|
81 |
|
82 |
// load extension namespaces
|
93 |
* strings to append to the URL
|
94 |
* @returns string - the requested URL
|
95 |
*/
|
96 |
+
public function Url($resource='servers', array $args=array()) {
|
97 |
return parent::Url($resource, $args);
|
98 |
}
|
99 |
|
109 |
* @returns Compute\Server object
|
110 |
*/
|
111 |
public function Server($id=NULL) {
|
112 |
+
return new Server($this, $id);
|
113 |
}
|
114 |
|
115 |
/**
|
130 |
*/
|
131 |
public function ServerList($details=TRUE, $filter=array()) {
|
132 |
if (!is_bool($details))
|
133 |
+
throw new \OpenCloud\Base\Exceptions\InvalidArgumentException(
|
134 |
+
\OpenCloud\Base\Lang::translate('First argument for Compute::ServerList() must be boolean'));
|
135 |
if (!is_array($filter))
|
136 |
+
throw new \OpenCloud\Base\Exceptions\InvalidArgumentException(
|
137 |
+
\OpenCloud\Base\Lang::translate('Second argument for Compute::ServerList() must be array'));
|
138 |
if ($details)
|
139 |
+
$url = $this->Url(Server::ResourceName().'/detail',
|
140 |
$filter);
|
141 |
else
|
142 |
+
$url = $this->Url(Server::ResourceName(), $filter);
|
143 |
|
144 |
return $this->Collection('\OpenCloud\Compute\Server', $url);
|
145 |
}
|
152 |
* @return Compute\Network
|
153 |
*/
|
154 |
public function Network($id=NULL) {
|
155 |
+
return new Network($this, $id);
|
156 |
}
|
157 |
|
158 |
/**
|
177 |
* @return Compute\Image object
|
178 |
*/
|
179 |
public function Image($id=NULL) {
|
180 |
+
return new Image($this, $id);
|
181 |
}
|
182 |
|
183 |
/**
|
200 |
public function ImageList($details=TRUE, $filter=array()) {
|
201 |
// validate arguments
|
202 |
if (gettype($details)!='boolean')
|
203 |
+
throw new \OpenCloud\Base\Exceptions\InvalidParameterError(
|
204 |
+
\OpenCloud\Base\Lang::translate('Invalid argument for Compute::ImageList(); '.
|
205 |
'boolean required'));
|
206 |
if ($details)
|
207 |
$url = $this->Url('images/detail', $filter);
|
sdk/OpenCloud/{volumeattachment.php → OpenCloud/Compute/VolumeAttachment.php}
RENAMED
@@ -12,24 +12,23 @@
|
|
12 |
|
13 |
namespace OpenCloud\Compute;
|
14 |
|
15 |
-
|
16 |
-
require_once(__DIR__.'/metadata.php');
|
17 |
|
18 |
/**
|
19 |
* The VolumeAttachment class represents a volume that is attached
|
20 |
-
* to a server.
|
21 |
*
|
22 |
* @api
|
23 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
24 |
*/
|
25 |
-
class VolumeAttachment extends \OpenCloud\PersistentObject {
|
26 |
|
27 |
public
|
28 |
$id,
|
29 |
$device,
|
30 |
$serverId,
|
31 |
$volumeId;
|
32 |
-
|
33 |
public static
|
34 |
$json_name = 'volumeAttachment',
|
35 |
$url_resource = 'os-volume_attachments';
|
@@ -58,9 +57,9 @@ class VolumeAttachment extends \OpenCloud\PersistentObject {
|
|
58 |
* @throws OpenCloud\UpdateError always
|
59 |
*/
|
60 |
public function Update($params=array()) {
|
61 |
-
throw new \OpenCloud\UpdateError(
|
62 |
}
|
63 |
-
|
64 |
/**
|
65 |
* returns the Parent (server) of the volume attachment
|
66 |
*
|
@@ -68,8 +67,8 @@ class VolumeAttachment extends \OpenCloud\PersistentObject {
|
|
68 |
*
|
69 |
* @return Server
|
70 |
*/
|
71 |
-
public function Parent() {
|
72 |
-
return $this->_server;
|
73 |
}
|
74 |
|
75 |
/**
|
12 |
|
13 |
namespace OpenCloud\Compute;
|
14 |
|
15 |
+
use OpenCloud\Base\Lang;
|
|
|
16 |
|
17 |
/**
|
18 |
* The VolumeAttachment class represents a volume that is attached
|
19 |
+
* to a server.
|
20 |
*
|
21 |
* @api
|
22 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
23 |
*/
|
24 |
+
class VolumeAttachment extends \OpenCloud\AbstractClass\PersistentObject {
|
25 |
|
26 |
public
|
27 |
$id,
|
28 |
$device,
|
29 |
$serverId,
|
30 |
$volumeId;
|
31 |
+
|
32 |
public static
|
33 |
$json_name = 'volumeAttachment',
|
34 |
$url_resource = 'os-volume_attachments';
|
57 |
* @throws OpenCloud\UpdateError always
|
58 |
*/
|
59 |
public function Update($params=array()) {
|
60 |
+
throw new \OpenCloud\Base\Exceptions\UpdateError(Lang::translate('Updates are not permitted'));
|
61 |
}
|
62 |
+
|
63 |
/**
|
64 |
* returns the Parent (server) of the volume attachment
|
65 |
*
|
67 |
*
|
68 |
* @return Server
|
69 |
*/
|
70 |
+
public function Parent() {
|
71 |
+
return $this->_server;
|
72 |
}
|
73 |
|
74 |
/**
|
sdk/OpenCloud/{asyncresponse.php → OpenCloud/DNS/AsyncResponse.php}
RENAMED
@@ -12,13 +12,11 @@
|
|
12 |
|
13 |
namespace OpenCloud\DNS;
|
14 |
|
15 |
-
require_once(__DIR__.'/persistentobject.php');
|
16 |
-
|
17 |
/**
|
18 |
* The AsyncResponse class encapsulates the data returned by a Cloud DNS
|
19 |
* asynchronous response.
|
20 |
*/
|
21 |
-
class AsyncResponse extends \OpenCloud\PersistentObject {
|
22 |
|
23 |
public
|
24 |
$jobId,
|
@@ -40,7 +38,7 @@ class AsyncResponse extends \OpenCloud\PersistentObject {
|
|
40 |
* @param \OpenCloud\Service $service the calling service
|
41 |
* @param string $json the json response from the initial request
|
42 |
*/
|
43 |
-
public function __construct(\OpenCloud\Service $service, $json=NULL) {
|
44 |
if (!$json)
|
45 |
return;
|
46 |
$obj = json_decode($json);
|
12 |
|
13 |
namespace OpenCloud\DNS;
|
14 |
|
|
|
|
|
15 |
/**
|
16 |
* The AsyncResponse class encapsulates the data returned by a Cloud DNS
|
17 |
* asynchronous response.
|
18 |
*/
|
19 |
+
class AsyncResponse extends \OpenCloud\AbstractClass\PersistentObject {
|
20 |
|
21 |
public
|
22 |
$jobId,
|
38 |
* @param \OpenCloud\Service $service the calling service
|
39 |
* @param string $json the json response from the initial request
|
40 |
*/
|
41 |
+
public function __construct(\OpenCloud\AbstractClass\Service $service, $json=NULL) {
|
42 |
if (!$json)
|
43 |
return;
|
44 |
$obj = json_decode($json);
|
sdk/OpenCloud/{domain.php → OpenCloud/DNS/Domain.php}
RENAMED
@@ -12,9 +12,6 @@
|
|
12 |
|
13 |
namespace OpenCloud\DNS;
|
14 |
|
15 |
-
require_once(__DIR__.'/dnsobject.php');
|
16 |
-
require_once(__DIR__.'/record.php');
|
17 |
-
|
18 |
/**
|
19 |
* The Domain class represents a single domain
|
20 |
*
|
@@ -24,7 +21,7 @@ require_once(__DIR__.'/record.php');
|
|
24 |
* @api
|
25 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
26 |
*/
|
27 |
-
class Domain extends
|
28 |
|
29 |
public
|
30 |
$id,
|
@@ -188,36 +185,4 @@ class Domain extends DnsObject {
|
|
188 |
return $obj;
|
189 |
}
|
190 |
|
191 |
-
} // class Domain
|
192 |
-
|
193 |
-
/**
|
194 |
-
* The Subdomain is basically another domain, albeit one that is a child of
|
195 |
-
* a parent domain. In terms of the code involved, the JSON is slightly
|
196 |
-
* different than a top-level domain, and the parent is a domain instead of
|
197 |
-
* the DNS service itself.
|
198 |
-
*/
|
199 |
-
class Subdomain extends Domain {
|
200 |
-
|
201 |
-
protected static
|
202 |
-
$json_name = FALSE,
|
203 |
-
$json_collection_name = 'domains',
|
204 |
-
$url_resource = 'subdomains';
|
205 |
-
|
206 |
-
private
|
207 |
-
$_parent;
|
208 |
-
|
209 |
-
/**
|
210 |
-
*/
|
211 |
-
public function __construct(Domain $parent, $info=array()) {
|
212 |
-
$this->_parent = $parent;
|
213 |
-
return parent::__construct($parent->Service(), $info);
|
214 |
-
}
|
215 |
-
|
216 |
-
/**
|
217 |
-
* returns the parent domain object
|
218 |
-
*/
|
219 |
-
public function Parent() {
|
220 |
-
return $this->_parent;
|
221 |
-
}
|
222 |
-
|
223 |
-
} // class Subdomain
|
12 |
|
13 |
namespace OpenCloud\DNS;
|
14 |
|
|
|
|
|
|
|
15 |
/**
|
16 |
* The Domain class represents a single domain
|
17 |
*
|
21 |
* @api
|
22 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
23 |
*/
|
24 |
+
class Domain extends Object {
|
25 |
|
26 |
public
|
27 |
$id,
|
185 |
return $obj;
|
186 |
}
|
187 |
|
188 |
+
} // class Domain
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sdk/OpenCloud/{dnsobject.php → OpenCloud/DNS/Object.php}
RENAMED
@@ -12,15 +12,12 @@
|
|
12 |
|
13 |
namespace OpenCloud\DNS;
|
14 |
|
15 |
-
require_once(__DIR__.'/persistentobject.php');
|
16 |
-
require_once(__DIR__.'/asyncresponse.php');
|
17 |
-
|
18 |
/**
|
19 |
* The DnsObject class is an extension of the PersistentObject class that
|
20 |
* permits the asynchronous responses used by Cloud DNS
|
21 |
*
|
22 |
*/
|
23 |
-
abstract class
|
24 |
|
25 |
/**
|
26 |
* Create() returns an asynchronous response
|
@@ -72,7 +69,7 @@ abstract class DnsObject extends \OpenCloud\PersistentObject {
|
|
72 |
protected function CreateJson() {
|
73 |
$obj = new \stdClass;
|
74 |
if (!isset($this->_create_keys))
|
75 |
-
throw new \OpenCloud\CreateError(
|
76 |
$top = self::JsonCollectionName();
|
77 |
$obj->{$top} = array();
|
78 |
$obj->{$top}[] = $this->GetJson($this->_create_keys);
|
@@ -86,7 +83,7 @@ abstract class DnsObject extends \OpenCloud\PersistentObject {
|
|
86 |
*/
|
87 |
protected function UpdateJson($params=array()) {
|
88 |
if (!isset($this->_update_keys))
|
89 |
-
throw new \OpenCloud\UpdateError(
|
90 |
return $this->GetJson($this->_update_keys);
|
91 |
}
|
92 |
|
12 |
|
13 |
namespace OpenCloud\DNS;
|
14 |
|
|
|
|
|
|
|
15 |
/**
|
16 |
* The DnsObject class is an extension of the PersistentObject class that
|
17 |
* permits the asynchronous responses used by Cloud DNS
|
18 |
*
|
19 |
*/
|
20 |
+
abstract class Object extends \OpenCloud\AbstractClass\PersistentObject {
|
21 |
|
22 |
/**
|
23 |
* Create() returns an asynchronous response
|
69 |
protected function CreateJson() {
|
70 |
$obj = new \stdClass;
|
71 |
if (!isset($this->_create_keys))
|
72 |
+
throw new \OpenCloud\Base\Exceptions\CreateError(\OpenCloud\Base\Lang::translate('Missing [_create_keys]'));
|
73 |
$top = self::JsonCollectionName();
|
74 |
$obj->{$top} = array();
|
75 |
$obj->{$top}[] = $this->GetJson($this->_create_keys);
|
83 |
*/
|
84 |
protected function UpdateJson($params=array()) {
|
85 |
if (!isset($this->_update_keys))
|
86 |
+
throw new \OpenCloud\Base\Exceptions\UpdateError(\OpenCloud\Base\Lang::translate('Missing [_update_keys]'));
|
87 |
return $this->GetJson($this->_update_keys);
|
88 |
}
|
89 |
|
sdk/OpenCloud/{ptrrecord.php → OpenCloud/DNS/PtrRecord.php}
RENAMED
@@ -12,7 +12,7 @@
|
|
12 |
|
13 |
namespace OpenCloud\DNS;
|
14 |
|
15 |
-
|
16 |
|
17 |
/**
|
18 |
* PTR records are used for reverse DNS
|
@@ -23,6 +23,9 @@ require_once(__DIR__.'/record.php');
|
|
23 |
*/
|
24 |
class PtrRecord extends Record {
|
25 |
|
|
|
|
|
|
|
26 |
protected static
|
27 |
$json_name = FALSE,
|
28 |
$json_collection_name = 'records',
|
@@ -39,8 +42,8 @@ class PtrRecord extends Record {
|
|
39 |
$this->type = 'PTR';
|
40 |
parent::__construct($parent, $info);
|
41 |
if ($this->type != 'PTR')
|
42 |
-
throw new RecordTypeError(sprintf(
|
43 |
-
|
44 |
}
|
45 |
|
46 |
/**
|
@@ -56,19 +59,27 @@ class PtrRecord extends Record {
|
|
56 |
|
57 |
/**
|
58 |
* DNS PTR Create() method requires a server
|
|
|
|
|
59 |
*/
|
60 |
-
public function Create(
|
61 |
-
$
|
62 |
-
|
|
|
|
|
|
|
63 |
return parent::Create($param);
|
64 |
}
|
65 |
|
66 |
/**
|
67 |
* DNS PTR Update() method requires a server
|
68 |
*/
|
69 |
-
public function Update(
|
70 |
-
$
|
71 |
-
|
|
|
|
|
|
|
72 |
return parent::Update($param);
|
73 |
}
|
74 |
|
@@ -79,9 +90,9 @@ class PtrRecord extends Record {
|
|
79 |
* unless you pass in the parameter ip={ip address}
|
80 |
*
|
81 |
*/
|
82 |
-
public function Delete(
|
83 |
-
$this->link_rel = $
|
84 |
-
$this->link_href = $
|
85 |
$url = $this->Url('rdns/'.$this->link_rel,
|
86 |
array('href'=>$this->link_href));
|
87 |
if (isset($this->data))
|
@@ -113,7 +124,9 @@ class PtrRecord extends Record {
|
|
113 |
/**
|
114 |
* The Update() JSON requires a record ID
|
115 |
*/
|
116 |
-
protected function UpdateJson() {
|
|
|
|
|
117 |
$obj = $this->CreateJson();
|
118 |
$obj->recordsList->records[0]->id = $this->id;
|
119 |
return $obj;
|
12 |
|
13 |
namespace OpenCloud\DNS;
|
14 |
|
15 |
+
use OpenCloud\Base\Lang;
|
16 |
|
17 |
/**
|
18 |
* PTR records are used for reverse DNS
|
23 |
*/
|
24 |
class PtrRecord extends Record {
|
25 |
|
26 |
+
public
|
27 |
+
$server;
|
28 |
+
|
29 |
protected static
|
30 |
$json_name = FALSE,
|
31 |
$json_collection_name = 'records',
|
42 |
$this->type = 'PTR';
|
43 |
parent::__construct($parent, $info);
|
44 |
if ($this->type != 'PTR')
|
45 |
+
throw new \OpenCloud\Base\Exceptions\RecordTypeError(sprintf(
|
46 |
+
Lang::translate('Invalid record type [%s], must be PTR'), $this->type));
|
47 |
}
|
48 |
|
49 |
/**
|
59 |
|
60 |
/**
|
61 |
* DNS PTR Create() method requires a server
|
62 |
+
*
|
63 |
+
* Generally called as `Create(array('server'=>$server))`
|
64 |
*/
|
65 |
+
public function Create($param=array()) {
|
66 |
+
foreach($param as $key => $value) {
|
67 |
+
$this->$key = $value;
|
68 |
+
}
|
69 |
+
$this->link_rel = $this->server->Service()->Name();
|
70 |
+
$this->link_href = $this->server->Url();
|
71 |
return parent::Create($param);
|
72 |
}
|
73 |
|
74 |
/**
|
75 |
* DNS PTR Update() method requires a server
|
76 |
*/
|
77 |
+
public function Update($param=array()) {
|
78 |
+
foreach($param as $key => $value) {
|
79 |
+
$this->$key = $value;
|
80 |
+
}
|
81 |
+
$this->link_rel = $this->server->Service()->Name();
|
82 |
+
$this->link_href = $this->server->Url();
|
83 |
return parent::Update($param);
|
84 |
}
|
85 |
|
90 |
* unless you pass in the parameter ip={ip address}
|
91 |
*
|
92 |
*/
|
93 |
+
public function Delete() {
|
94 |
+
$this->link_rel = $this->server->Service()->Name();
|
95 |
+
$this->link_href = $this->server->Url();
|
96 |
$url = $this->Url('rdns/'.$this->link_rel,
|
97 |
array('href'=>$this->link_href));
|
98 |
if (isset($this->data))
|
124 |
/**
|
125 |
* The Update() JSON requires a record ID
|
126 |
*/
|
127 |
+
protected function UpdateJson($params=array()) {
|
128 |
+
foreach($params as $key => $value)
|
129 |
+
$this->$key = $value;
|
130 |
$obj = $this->CreateJson();
|
131 |
$obj->recordsList->records[0]->id = $this->id;
|
132 |
return $obj;
|
sdk/OpenCloud/{record.php → OpenCloud/DNS/Record.php}
RENAMED
@@ -12,8 +12,6 @@
|
|
12 |
|
13 |
namespace OpenCloud\DNS;
|
14 |
|
15 |
-
require_once(__DIR__.'/dnsobject.php');
|
16 |
-
|
17 |
/**
|
18 |
* The Record class represents a single domain record
|
19 |
*
|
@@ -22,7 +20,7 @@ require_once(__DIR__.'/dnsobject.php');
|
|
22 |
* @api
|
23 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
24 |
*/
|
25 |
-
class Record extends
|
26 |
|
27 |
public
|
28 |
$ttl,
|
@@ -54,7 +52,7 @@ class Record extends DnsObject {
|
|
54 |
*/
|
55 |
public function __construct($parent, $info=NULL) {
|
56 |
$this->_parent = $parent;
|
57 |
-
if (get_class($parent) == 'OpenCloud\DNS')
|
58 |
parent::__construct($parent, $info);
|
59 |
else
|
60 |
parent::__construct($parent->Service(), $info);
|
12 |
|
13 |
namespace OpenCloud\DNS;
|
14 |
|
|
|
|
|
15 |
/**
|
16 |
* The Record class represents a single domain record
|
17 |
*
|
20 |
* @api
|
21 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
22 |
*/
|
23 |
+
class Record extends Object {
|
24 |
|
25 |
public
|
26 |
$ttl,
|
52 |
*/
|
53 |
public function __construct($parent, $info=NULL) {
|
54 |
$this->_parent = $parent;
|
55 |
+
if (get_class($parent) == 'OpenCloud\DNS\Service')
|
56 |
parent::__construct($parent, $info);
|
57 |
else
|
58 |
parent::__construct($parent->Service(), $info);
|
sdk/OpenCloud/{dns.php → OpenCloud/DNS/Service.php}
RENAMED
@@ -10,15 +10,11 @@
|
|
10 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
11 |
*/
|
12 |
|
13 |
-
namespace OpenCloud;
|
14 |
|
15 |
-
|
16 |
-
require_once(__DIR__.'/domain.php');
|
17 |
-
require_once(__DIR__.'/record.php');
|
18 |
-
require_once(__DIR__.'/ptrrecord.php');
|
19 |
-
require_once(__DIR__.'/service.php');
|
20 |
|
21 |
-
class
|
22 |
|
23 |
/**
|
24 |
* creates a new DNS object
|
@@ -28,9 +24,9 @@ class DNS extends Service {
|
|
28 |
* @param string $serviceRegion (not currently used; DNS is regionless)
|
29 |
* @param string $urltype the type of URL
|
30 |
*/
|
31 |
-
public function __construct(OpenStack $conn,
|
32 |
$serviceName, $serviceRegion, $urltype) {
|
33 |
-
$this->debug(
|
34 |
parent::__construct(
|
35 |
$conn,
|
36 |
'rax:dns',
|
@@ -40,25 +36,6 @@ class DNS extends Service {
|
|
40 |
);
|
41 |
} // function __construct()
|
42 |
|
43 |
-
/**
|
44 |
-
* Returns the selected endpoint URL of this Service
|
45 |
-
*
|
46 |
-
* @param string $resource - a child resource. For example,
|
47 |
-
* passing 'servers' would return .../servers. Should *not* be
|
48 |
-
* prefixed with a slash (/).
|
49 |
-
* @param array $args (optional) an array of key-value pairs for query
|
50 |
-
* strings to append to the URL
|
51 |
-
* @returns string - the requested URL
|
52 |
-
*/
|
53 |
-
public function Url($resource='', $args=array()) {
|
54 |
-
$baseurl = parent::Url();
|
55 |
-
if ($resource != '')
|
56 |
-
$baseurl = noslash($baseurl).'/'.$resource;
|
57 |
-
if (!empty($args))
|
58 |
-
$baseurl .= '?'.$this->MakeQueryString($args);
|
59 |
-
return $baseurl;
|
60 |
-
}
|
61 |
-
|
62 |
/**
|
63 |
* returns a DNS::Domain object
|
64 |
*
|
@@ -67,7 +44,7 @@ class DNS extends Service {
|
|
67 |
* @return DNS\Domain
|
68 |
*/
|
69 |
public function Domain($info=NULL) {
|
70 |
-
return new
|
71 |
}
|
72 |
|
73 |
/**
|
@@ -78,7 +55,7 @@ class DNS extends Service {
|
|
78 |
* @return \OpenCloud\Collection
|
79 |
*/
|
80 |
public function DomainList($filter=array()) {
|
81 |
-
$url = $this->Url(
|
82 |
return $this->Collection('\OpenCloud\DNS\Domain', $url);
|
83 |
}
|
84 |
|
@@ -89,7 +66,7 @@ class DNS extends Service {
|
|
89 |
* @return Record
|
90 |
*/
|
91 |
public function PtrRecord($info=NULL) {
|
92 |
-
return new
|
93 |
}
|
94 |
|
95 |
/**
|
@@ -145,8 +122,8 @@ class DNS extends Service {
|
|
145 |
|
146 |
// check response status
|
147 |
if ($resp->HttpStatus() > 204)
|
148 |
-
throw new
|
149 |
-
|
150 |
'URL [%s] method [%s] status [%s] response [%s]'),
|
151 |
$url, $method, $resp->HttpStatus(), $resp->HttpBody()));
|
152 |
|
@@ -154,7 +131,7 @@ class DNS extends Service {
|
|
154 |
$this->debug('AsyncResponse [%s]', $resp->HttpBody());
|
155 |
|
156 |
// return an AsyncResponse object
|
157 |
-
return new
|
158 |
}
|
159 |
|
160 |
/**
|
@@ -231,15 +208,15 @@ class DNS extends Service {
|
|
231 |
|
232 |
// check for errors
|
233 |
if ($resp->HttpStatus() > 202)
|
234 |
-
throw new \OpenCloud\HttpError(sprintf(
|
235 |
-
|
236 |
$resp->HttpStatus(),
|
237 |
$url,
|
238 |
$resp->HttpBody()));
|
239 |
|
240 |
// decode the JSON
|
241 |
$json = $resp->HttpBody();
|
242 |
-
$this->debug(
|
243 |
$obj = json_decode($json);
|
244 |
if ($this->CheckJsonError())
|
245 |
return FALSE;
|
10 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
11 |
*/
|
12 |
|
13 |
+
namespace OpenCloud\DNS;
|
14 |
|
15 |
+
use OpenCloud\Base\Lang;
|
|
|
|
|
|
|
|
|
16 |
|
17 |
+
class Service extends \OpenCloud\AbstractClass\Service {
|
18 |
|
19 |
/**
|
20 |
* creates a new DNS object
|
24 |
* @param string $serviceRegion (not currently used; DNS is regionless)
|
25 |
* @param string $urltype the type of URL
|
26 |
*/
|
27 |
+
public function __construct(\OpenCloud\OpenStack $conn,
|
28 |
$serviceName, $serviceRegion, $urltype) {
|
29 |
+
$this->debug(Lang::translate('initializing DNS...'));
|
30 |
parent::__construct(
|
31 |
$conn,
|
32 |
'rax:dns',
|
36 |
);
|
37 |
} // function __construct()
|
38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
/**
|
40 |
* returns a DNS::Domain object
|
41 |
*
|
44 |
* @return DNS\Domain
|
45 |
*/
|
46 |
public function Domain($info=NULL) {
|
47 |
+
return new Domain($this, $info);
|
48 |
}
|
49 |
|
50 |
/**
|
55 |
* @return \OpenCloud\Collection
|
56 |
*/
|
57 |
public function DomainList($filter=array()) {
|
58 |
+
$url = $this->Url(Domain::ResourceName(), $filter);
|
59 |
return $this->Collection('\OpenCloud\DNS\Domain', $url);
|
60 |
}
|
61 |
|
66 |
* @return Record
|
67 |
*/
|
68 |
public function PtrRecord($info=NULL) {
|
69 |
+
return new PtrRecord($this, $info);
|
70 |
}
|
71 |
|
72 |
/**
|
122 |
|
123 |
// check response status
|
124 |
if ($resp->HttpStatus() > 204)
|
125 |
+
throw new \OpenCloud\Base\Exceptions\AsyncHttpError(sprintf(
|
126 |
+
Lang::translate('Unexpected HTTP status for async request: '.
|
127 |
'URL [%s] method [%s] status [%s] response [%s]'),
|
128 |
$url, $method, $resp->HttpStatus(), $resp->HttpBody()));
|
129 |
|
131 |
$this->debug('AsyncResponse [%s]', $resp->HttpBody());
|
132 |
|
133 |
// return an AsyncResponse object
|
134 |
+
return new AsyncResponse($this, $resp->HttpBody());
|
135 |
}
|
136 |
|
137 |
/**
|
208 |
|
209 |
// check for errors
|
210 |
if ($resp->HttpStatus() > 202)
|
211 |
+
throw new \OpenCloud\Base\Exceptions\HttpError(sprintf(
|
212 |
+
Lang::translate('Unexpected status [%s] for URL [%s], body [%s]'),
|
213 |
$resp->HttpStatus(),
|
214 |
$url,
|
215 |
$resp->HttpBody()));
|
216 |
|
217 |
// decode the JSON
|
218 |
$json = $resp->HttpBody();
|
219 |
+
$this->debug(Lang::translate('Limit Types JSON [%s]'), $json);
|
220 |
$obj = json_decode($json);
|
221 |
if ($this->CheckJsonError())
|
222 |
return FALSE;
|
sdk/OpenCloud/OpenCloud/DNS/Subdomain.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\DNS;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* The Subdomain is basically another domain, albeit one that is a child of
|
7 |
+
* a parent domain. In terms of the code involved, the JSON is slightly
|
8 |
+
* different than a top-level domain, and the parent is a domain instead of
|
9 |
+
* the DNS service itself.
|
10 |
+
*/
|
11 |
+
class Subdomain extends Domain {
|
12 |
+
|
13 |
+
protected static
|
14 |
+
$json_name = FALSE,
|
15 |
+
$json_collection_name = 'domains',
|
16 |
+
$url_resource = 'subdomains';
|
17 |
+
|
18 |
+
private
|
19 |
+
$_parent;
|
20 |
+
|
21 |
+
/**
|
22 |
+
*/
|
23 |
+
public function __construct(Domain $parent, $info=array()) {
|
24 |
+
$this->_parent = $parent;
|
25 |
+
return parent::__construct($parent->Service(), $info);
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* returns the parent domain object
|
30 |
+
*/
|
31 |
+
public function Parent() {
|
32 |
+
return $this->_parent;
|
33 |
+
}
|
34 |
+
|
35 |
+
} // class Subdomain
|
sdk/OpenCloud/{database.php → OpenCloud/Database/Database.php}
RENAMED
@@ -10,7 +10,7 @@
|
|
10 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
11 |
*/
|
12 |
|
13 |
-
namespace OpenCloud\
|
14 |
|
15 |
/**
|
16 |
* This class represents a Database in the Rackspace "Red Dwarf"
|
@@ -18,7 +18,7 @@ namespace OpenCloud\DbService;
|
|
18 |
*
|
19 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
20 |
*/
|
21 |
-
class Database extends \OpenCloud\Base {
|
22 |
|
23 |
public
|
24 |
$name;
|
@@ -53,8 +53,8 @@ class Database extends \OpenCloud\Base {
|
|
53 |
elseif (is_string($info))
|
54 |
$this->name = $info;
|
55 |
elseif (isset($info))
|
56 |
-
throw new DatabaseNameError(
|
57 |
-
|
58 |
}
|
59 |
|
60 |
/**
|
@@ -65,8 +65,8 @@ class Database extends \OpenCloud\Base {
|
|
65 |
*/
|
66 |
public function Url() {
|
67 |
if (!isset($this->name))
|
68 |
-
throw new DatabaseNameError(
|
69 |
-
|
70 |
return stripslashes($this->Instance()->Url('databases'))
|
71 |
. '/' .$this->name;
|
72 |
}
|
@@ -115,8 +115,8 @@ class Database extends \OpenCloud\Base {
|
|
115 |
|
116 |
// check the response code
|
117 |
if ($response->HttpStatus() != 202)
|
118 |
-
throw new DatabaseCreateError(sprintf(
|
119 |
-
|
120 |
$this->name, $response->HttpStatus(), $response->HttpBody()));
|
121 |
|
122 |
// refresh and return
|
@@ -131,8 +131,8 @@ class Database extends \OpenCloud\Base {
|
|
131 |
* @return void
|
132 |
*/
|
133 |
public function Update($params=array()) {
|
134 |
-
throw new DatabaseUpdateError(
|
135 |
-
|
136 |
}
|
137 |
|
138 |
/**
|
@@ -144,8 +144,8 @@ class Database extends \OpenCloud\Base {
|
|
144 |
public function Delete() {
|
145 |
$resp = $this->Service()->Request($this->Url(), 'DELETE');
|
146 |
if ($resp->HttpStatus() != 202)
|
147 |
-
throw new DatabaseDeleteError(sprintf(
|
148 |
-
|
149 |
$this->name,
|
150 |
$resp->HttpStatus(),
|
151 |
$resp->HttpBody()));
|
@@ -164,8 +164,8 @@ class Database extends \OpenCloud\Base {
|
|
164 |
|
165 |
// set the name
|
166 |
if (!isset($this->name))
|
167 |
-
throw new DatabaseNameError(
|
168 |
-
|
169 |
$obj->databases[0]->name = $this->name;
|
170 |
foreach($params as $key => $value)
|
171 |
$obj->databases[0]->$key = $value;
|
@@ -173,4 +173,4 @@ class Database extends \OpenCloud\Base {
|
|
173 |
return $obj;
|
174 |
}
|
175 |
|
176 |
-
} // class Database
|
10 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
11 |
*/
|
12 |
|
13 |
+
namespace OpenCloud\Database;
|
14 |
|
15 |
/**
|
16 |
* This class represents a Database in the Rackspace "Red Dwarf"
|
18 |
*
|
19 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
20 |
*/
|
21 |
+
class Database extends \OpenCloud\Base\Base {
|
22 |
|
23 |
public
|
24 |
$name;
|
53 |
elseif (is_string($info))
|
54 |
$this->name = $info;
|
55 |
elseif (isset($info))
|
56 |
+
throw new \OpenCloud\Base\Exceptions\DatabaseNameError(
|
57 |
+
\OpenCloud\Base\Lang::translate('Database parameter must be an object, array, or string'));
|
58 |
}
|
59 |
|
60 |
/**
|
65 |
*/
|
66 |
public function Url() {
|
67 |
if (!isset($this->name))
|
68 |
+
throw new \OpenCloud\Base\Exceptions\DatabaseNameError(
|
69 |
+
\OpenCloud\Base\Lang::translate('The database does not have a Url yet'));
|
70 |
return stripslashes($this->Instance()->Url('databases'))
|
71 |
. '/' .$this->name;
|
72 |
}
|
115 |
|
116 |
// check the response code
|
117 |
if ($response->HttpStatus() != 202)
|
118 |
+
throw new \OpenCloud\Base\Exceptions\DatabaseCreateError(sprintf(
|
119 |
+
\OpenCloud\Base\Lang::translate('Error creating database [%s], status [%d] response [%s]'),
|
120 |
$this->name, $response->HttpStatus(), $response->HttpBody()));
|
121 |
|
122 |
// refresh and return
|
131 |
* @return void
|
132 |
*/
|
133 |
public function Update($params=array()) {
|
134 |
+
throw new \OpenCloud\Base\Exceptions\DatabaseUpdateError(
|
135 |
+
\OpenCloud\Base\Lang::translate('Updates are not currently permitted on Database objects'));
|
136 |
}
|
137 |
|
138 |
/**
|
144 |
public function Delete() {
|
145 |
$resp = $this->Service()->Request($this->Url(), 'DELETE');
|
146 |
if ($resp->HttpStatus() != 202)
|
147 |
+
throw new \OpenCloud\Base\Exceptions\DatabaseDeleteError(sprintf(
|
148 |
+
\OpenCloud\Base\Lang::translate('Error deleting database [%s], status [%d] response [%s]'),
|
149 |
$this->name,
|
150 |
$resp->HttpStatus(),
|
151 |
$resp->HttpBody()));
|
164 |
|
165 |
// set the name
|
166 |
if (!isset($this->name))
|
167 |
+
throw new \OpenCloud\Base\Exceptions\DatabaseNameError(
|
168 |
+
\OpenCloud\Base\Lang::translate('Database name is required'));
|
169 |
$obj->databases[0]->name = $this->name;
|
170 |
foreach($params as $key => $value)
|
171 |
$obj->databases[0]->$key = $value;
|
173 |
return $obj;
|
174 |
}
|
175 |
|
176 |
+
} // class Database
|
sdk/OpenCloud/{instance.php → OpenCloud/Database/Instance.php}
RENAMED
@@ -10,11 +10,9 @@
|
|
10 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
11 |
*/
|
12 |
|
13 |
-
namespace OpenCloud\
|
14 |
|
15 |
-
|
16 |
-
require_once(__DIR__.'/database.php');
|
17 |
-
require_once(__DIR__.'/user.php');
|
18 |
|
19 |
/**
|
20 |
* Instance represents an instance of DbService, similar to a Server in a
|
@@ -22,7 +20,7 @@ require_once(__DIR__.'/user.php');
|
|
22 |
*
|
23 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
24 |
*/
|
25 |
-
class Instance extends \OpenCloud\PersistentObject {
|
26 |
|
27 |
public
|
28 |
$id,
|
@@ -53,8 +51,8 @@ class Instance extends \OpenCloud\PersistentObject {
|
|
53 |
* with this
|
54 |
* @param mixed $info the ID or array of info for the object
|
55 |
*/
|
56 |
-
public function __construct(
|
57 |
-
$this->volume = new \stdClass
|
58 |
return parent::__construct($service, $info);
|
59 |
}
|
60 |
|
@@ -67,8 +65,8 @@ class Instance extends \OpenCloud\PersistentObject {
|
|
67 |
* @throws InstanceUpdateError always
|
68 |
*/
|
69 |
public function Update($params=array()) {
|
70 |
-
throw new InstanceUpdateError(
|
71 |
-
|
72 |
}
|
73 |
|
74 |
/**
|
@@ -115,8 +113,8 @@ class Instance extends \OpenCloud\PersistentObject {
|
|
115 |
|
116 |
// check response
|
117 |
if ($response->HttpStatus() > 202)
|
118 |
-
throw
|
119 |
-
|
120 |
'status [%d] response [%s]'),
|
121 |
$this->name, $response->HttpStatus(), $response->HttpBody()));
|
122 |
|
@@ -141,8 +139,8 @@ class Instance extends \OpenCloud\PersistentObject {
|
|
141 |
|
142 |
// check response
|
143 |
if ($response->HttpStatus() > 202)
|
144 |
-
throw
|
145 |
-
|
146 |
'status [%d] response [%s]'),
|
147 |
$this->name, $response->HttpStatus(), $response->HttpBody()));
|
148 |
|
@@ -189,8 +187,8 @@ class Instance extends \OpenCloud\PersistentObject {
|
|
189 |
|
190 |
// check response status
|
191 |
if ($response->HttpStatus() > 200)
|
192 |
-
throw new DatabaseListError(sprintf(
|
193 |
-
|
194 |
'status [%d] response [%s]'),
|
195 |
$this->name, $response->HttpStatus(), $response->HttpBody()));
|
196 |
|
@@ -198,9 +196,9 @@ class Instance extends \OpenCloud\PersistentObject {
|
|
198 |
$obj = json_decode($response->HttpBody());
|
199 |
if (!$this->CheckJsonError()) {
|
200 |
if (!isset($obj->databases))
|
201 |
-
return new \OpenCloud\Collection(
|
202 |
$this, '\OpenCloud\DbService\Database', array());
|
203 |
-
return new \OpenCloud\Collection(
|
204 |
$this, '\OpenCloud\DbService\Database', $obj->databases);
|
205 |
}
|
206 |
return FALSE;
|
@@ -217,8 +215,8 @@ class Instance extends \OpenCloud\PersistentObject {
|
|
217 |
|
218 |
// check response status
|
219 |
if ($response->HttpStatus() > 200)
|
220 |
-
throw new UserListError(sprintf(
|
221 |
-
|
222 |
'status [%d] response [%s]'),
|
223 |
$this->name, $response->HttpStatus(), $response->HttpBody()));
|
224 |
|
@@ -226,9 +224,9 @@ class Instance extends \OpenCloud\PersistentObject {
|
|
226 |
$obj = json_decode($response->HttpBody());
|
227 |
if (!$this->CheckJsonError()) {
|
228 |
if (!isset($obj->users))
|
229 |
-
return new \OpenCloud\Collection(
|
230 |
$this, '\OpenCloud\DbService\User', array());
|
231 |
-
return new \OpenCloud\Collection(
|
232 |
$this, '\OpenCloud\DbService\User', $obj->users);
|
233 |
}
|
234 |
return FALSE;
|
@@ -247,17 +245,17 @@ class Instance extends \OpenCloud\PersistentObject {
|
|
247 |
|
248 |
// flavor
|
249 |
if (!isset($this->flavor))
|
250 |
-
throw new InstanceFlavorError(
|
251 |
-
|
252 |
if (!is_object($this->flavor))
|
253 |
-
throw new InstanceFlavorError(
|
254 |
-
|
255 |
$obj->instance->flavorRef = $this->flavor->links[0]->href;
|
256 |
|
257 |
// name
|
258 |
if (!isset($this->name))
|
259 |
-
throw new InstanceError(
|
260 |
-
|
261 |
$obj->instance->name = $this->name;
|
262 |
|
263 |
// volume
|
10 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
11 |
*/
|
12 |
|
13 |
+
namespace OpenCloud\Database;
|
14 |
|
15 |
+
use OpenCloud\Base\Lang;
|
|
|
|
|
16 |
|
17 |
/**
|
18 |
* Instance represents an instance of DbService, similar to a Server in a
|
20 |
*
|
21 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
22 |
*/
|
23 |
+
class Instance extends \OpenCloud\AbstractClass\PersistentObject {
|
24 |
|
25 |
public
|
26 |
$id,
|
51 |
* with this
|
52 |
* @param mixed $info the ID or array of info for the object
|
53 |
*/
|
54 |
+
public function __construct(Service $service, $info=NULL) {
|
55 |
+
$this->volume = new \stdClass;
|
56 |
return parent::__construct($service, $info);
|
57 |
}
|
58 |
|
65 |
* @throws InstanceUpdateError always
|
66 |
*/
|
67 |
public function Update($params=array()) {
|
68 |
+
throw new \OpenCloud\Base\Exceptions\InstanceUpdateError(
|
69 |
+
Lang::translate('Updates are not currently supported by Cloud Databases'));
|
70 |
}
|
71 |
|
72 |
/**
|
113 |
|
114 |
// check response
|
115 |
if ($response->HttpStatus() > 202)
|
116 |
+
throw new \OpenCloud\Base\Exceptions\InstanceError(sprintf(
|
117 |
+
Lang::translate('Error enabling root user for instance [%s], '.
|
118 |
'status [%d] response [%s]'),
|
119 |
$this->name, $response->HttpStatus(), $response->HttpBody()));
|
120 |
|
139 |
|
140 |
// check response
|
141 |
if ($response->HttpStatus() > 202)
|
142 |
+
throw new \OpenCloud\Base\Exceptions\InstanceError(sprintf(
|
143 |
+
Lang::translate('Error enabling root user for instance [%s], '.
|
144 |
'status [%d] response [%s]'),
|
145 |
$this->name, $response->HttpStatus(), $response->HttpBody()));
|
146 |
|
187 |
|
188 |
// check response status
|
189 |
if ($response->HttpStatus() > 200)
|
190 |
+
throw new \OpenCloud\Base\Exceptions\DatabaseListError(sprintf(
|
191 |
+
Lang::translate('Error listing databases for instance [%s], '.
|
192 |
'status [%d] response [%s]'),
|
193 |
$this->name, $response->HttpStatus(), $response->HttpBody()));
|
194 |
|
196 |
$obj = json_decode($response->HttpBody());
|
197 |
if (!$this->CheckJsonError()) {
|
198 |
if (!isset($obj->databases))
|
199 |
+
return new \OpenCloud\AbstractClass\Collection(
|
200 |
$this, '\OpenCloud\DbService\Database', array());
|
201 |
+
return new \OpenCloud\AbstractClass\Collection(
|
202 |
$this, '\OpenCloud\DbService\Database', $obj->databases);
|
203 |
}
|
204 |
return FALSE;
|
215 |
|
216 |
// check response status
|
217 |
if ($response->HttpStatus() > 200)
|
218 |
+
throw new \OpenCloud\Base\Exceptions\UserListError(sprintf(
|
219 |
+
Lang::translate('Error listing users for instance [%s], '.
|
220 |
'status [%d] response [%s]'),
|
221 |
$this->name, $response->HttpStatus(), $response->HttpBody()));
|
222 |
|
224 |
$obj = json_decode($response->HttpBody());
|
225 |
if (!$this->CheckJsonError()) {
|
226 |
if (!isset($obj->users))
|
227 |
+
return new \OpenCloud\AbstractClass\Collection(
|
228 |
$this, '\OpenCloud\DbService\User', array());
|
229 |
+
return new \OpenCloud\AbstractClass\Collection(
|
230 |
$this, '\OpenCloud\DbService\User', $obj->users);
|
231 |
}
|
232 |
return FALSE;
|
245 |
|
246 |
// flavor
|
247 |
if (!isset($this->flavor))
|
248 |
+
throw new \OpenCloud\Base\Exceptions\InstanceFlavorError(
|
249 |
+
Lang::translate('a flavor must be specified'));
|
250 |
if (!is_object($this->flavor))
|
251 |
+
throw new \OpenCloud\Base\Exceptions\InstanceFlavorError(
|
252 |
+
Lang::translate('the [flavor] attribute must be a Flavor object'));
|
253 |
$obj->instance->flavorRef = $this->flavor->links[0]->href;
|
254 |
|
255 |
// name
|
256 |
if (!isset($this->name))
|
257 |
+
throw new \OpenCloud\Base\Exceptions\InstanceError(
|
258 |
+
Lang::translate('Instance name is required'));
|
259 |
$obj->instance->name = $this->name;
|
260 |
|
261 |
// volume
|
sdk/OpenCloud/{dbservice.php → OpenCloud/Database/Service.php}
RENAMED
@@ -10,17 +10,14 @@
|
|
10 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
11 |
*/
|
12 |
|
13 |
-
namespace OpenCloud;
|
14 |
-
|
15 |
-
require_once(__DIR__.'/nova.php');
|
16 |
-
require_once(__DIR__.'/instance.php');
|
17 |
|
18 |
/**
|
19 |
* The Rackspace Database As A Service (aka "Red Dwarf")
|
20 |
*
|
21 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
22 |
*/
|
23 |
-
class
|
24 |
|
25 |
/**
|
26 |
* Creates a new DbService service connection
|
@@ -33,7 +30,7 @@ class DbService extends Nova {
|
|
33 |
* @param string $region the region of the service (e.g., "DFW" or "LON")
|
34 |
* @param string $urltype the type of URL (normally "publicURL")
|
35 |
*/
|
36 |
-
public function __construct(OpenStack $conn, $name, $region, $urltype) {
|
37 |
parent::__construct($conn, 'rax:database', $name, $region, $urltype);
|
38 |
}
|
39 |
|
@@ -44,7 +41,7 @@ class DbService extends Nova {
|
|
44 |
* @param string $resource the resource required
|
45 |
* @param array $args extra arguments to pass to the URL as query strings
|
46 |
*/
|
47 |
-
public function Url($resource='instances', $args=array()) {
|
48 |
return parent::Url($resource, $args);
|
49 |
}
|
50 |
|
@@ -69,7 +66,7 @@ class DbService extends Nova {
|
|
69 |
* @return DbService\Instance
|
70 |
*/
|
71 |
public function Instance($id=NULL) {
|
72 |
-
return new
|
73 |
}
|
74 |
|
75 |
/**
|
@@ -82,6 +79,6 @@ class DbService extends Nova {
|
|
82 |
*/
|
83 |
public function InstanceList($params=array()) {
|
84 |
return $this->Collection(
|
85 |
-
'\OpenCloud\
|
86 |
}
|
87 |
}
|
10 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
11 |
*/
|
12 |
|
13 |
+
namespace OpenCloud\Database;
|
|
|
|
|
|
|
14 |
|
15 |
/**
|
16 |
* The Rackspace Database As A Service (aka "Red Dwarf")
|
17 |
*
|
18 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
19 |
*/
|
20 |
+
class Service extends \OpenCloud\AbstractClass\Nova {
|
21 |
|
22 |
/**
|
23 |
* Creates a new DbService service connection
|
30 |
* @param string $region the region of the service (e.g., "DFW" or "LON")
|
31 |
* @param string $urltype the type of URL (normally "publicURL")
|
32 |
*/
|
33 |
+
public function __construct(\OpenCloud\OpenStack $conn, $name, $region, $urltype) {
|
34 |
parent::__construct($conn, 'rax:database', $name, $region, $urltype);
|
35 |
}
|
36 |
|
41 |
* @param string $resource the resource required
|
42 |
* @param array $args extra arguments to pass to the URL as query strings
|
43 |
*/
|
44 |
+
public function Url($resource='instances', array $args=array()) {
|
45 |
return parent::Url($resource, $args);
|
46 |
}
|
47 |
|
66 |
* @return DbService\Instance
|
67 |
*/
|
68 |
public function Instance($id=NULL) {
|
69 |
+
return new Instance($this, $id);
|
70 |
}
|
71 |
|
72 |
/**
|
79 |
*/
|
80 |
public function InstanceList($params=array()) {
|
81 |
return $this->Collection(
|
82 |
+
'\OpenCloud\Database\Instance', NULL, NULL, $params);
|
83 |
}
|
84 |
}
|
sdk/OpenCloud/{user.php → OpenCloud/Database/User.php}
RENAMED
@@ -10,7 +10,7 @@
|
|
10 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
11 |
*/
|
12 |
|
13 |
-
namespace OpenCloud\
|
14 |
|
15 |
/**
|
16 |
* This class represents a User in the Rackspace "Red Dwarf"
|
@@ -18,7 +18,7 @@ namespace OpenCloud\DbService;
|
|
18 |
*
|
19 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
20 |
*/
|
21 |
-
class User extends \OpenCloud\Base {
|
22 |
|
23 |
/**
|
24 |
* @var string $name the user name
|
@@ -63,8 +63,8 @@ class User extends \OpenCloud\Base {
|
|
63 |
elseif (is_string($info))
|
64 |
$this->name = $info;
|
65 |
elseif (isset($info))
|
66 |
-
throw new UserNameError(
|
67 |
-
|
68 |
}
|
69 |
|
70 |
/**
|
@@ -75,8 +75,8 @@ class User extends \OpenCloud\Base {
|
|
75 |
*/
|
76 |
public function Url() {
|
77 |
if (!isset($this->name))
|
78 |
-
throw new UserNameError(
|
79 |
-
|
80 |
return stripslashes($this->Instance()->Url('users'))
|
81 |
.'/'.$this->name;
|
82 |
}
|
@@ -123,8 +123,8 @@ class User extends \OpenCloud\Base {
|
|
123 |
foreach($params as $name => $value)
|
124 |
$this->$name = $value;
|
125 |
if (!isset($this->name))
|
126 |
-
throw new UserNameError(
|
127 |
-
|
128 |
$json = json_encode($this->CreateJson());
|
129 |
$this->debug('Create() JSON[%s]', $json);
|
130 |
if ($this->CheckJsonError())
|
@@ -137,8 +137,8 @@ class User extends \OpenCloud\Base {
|
|
137 |
|
138 |
// check the response
|
139 |
if ($response->HttpStatus() > 202)
|
140 |
-
throw new UserCreateError(sprintf(
|
141 |
-
|
142 |
$this->name, $response->HttpStatus(), $response->HttpBody()));
|
143 |
|
144 |
return $response;
|
@@ -152,8 +152,8 @@ class User extends \OpenCloud\Base {
|
|
152 |
* this service.
|
153 |
*/
|
154 |
public function Update($params=array()) {
|
155 |
-
throw new UserUpdateError(
|
156 |
-
|
157 |
}
|
158 |
|
159 |
/**
|
@@ -171,8 +171,8 @@ class User extends \OpenCloud\Base {
|
|
171 |
|
172 |
// check status code
|
173 |
if ($response->HttpStatus() > 202)
|
174 |
-
throw new UserDeleteError(sprintf(
|
175 |
-
|
176 |
$this->name, $response->HttpStatus(), $response->HttpBody())));
|
177 |
|
178 |
return $response;
|
10 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
11 |
*/
|
12 |
|
13 |
+
namespace OpenCloud\Database;
|
14 |
|
15 |
/**
|
16 |
* This class represents a User in the Rackspace "Red Dwarf"
|
18 |
*
|
19 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
20 |
*/
|
21 |
+
class User extends \OpenCloud\Base\Base {
|
22 |
|
23 |
/**
|
24 |
* @var string $name the user name
|
63 |
elseif (is_string($info))
|
64 |
$this->name = $info;
|
65 |
elseif (isset($info))
|
66 |
+
throw new \OpenCloud\Base\Exceptions\UserNameError(
|
67 |
+
\OpenCloud\Base\Lang::translate('User parameter must be an object, array, or string'));
|
68 |
}
|
69 |
|
70 |
/**
|
75 |
*/
|
76 |
public function Url() {
|
77 |
if (!isset($this->name))
|
78 |
+
throw new \OpenCloud\Base\Exceptions\UserNameError(
|
79 |
+
\OpenCloud\Base\Lang::translate('The user does not have a Url yet'));
|
80 |
return stripslashes($this->Instance()->Url('users'))
|
81 |
.'/'.$this->name;
|
82 |
}
|
123 |
foreach($params as $name => $value)
|
124 |
$this->$name = $value;
|
125 |
if (!isset($this->name))
|
126 |
+
throw new \OpenCloud\Base\Exceptions\UserNameError(
|
127 |
+
\OpenCloud\Base\Lang::translate('Cannot create a database user without a name'));
|
128 |
$json = json_encode($this->CreateJson());
|
129 |
$this->debug('Create() JSON[%s]', $json);
|
130 |
if ($this->CheckJsonError())
|
137 |
|
138 |
// check the response
|
139 |
if ($response->HttpStatus() > 202)
|
140 |
+
throw new \OpenCloud\Base\Exceptions\UserCreateError(sprintf(
|
141 |
+
\OpenCloud\Base\Lang::translate('Error creating user [%s], status [%d] response [%s]'),
|
142 |
$this->name, $response->HttpStatus(), $response->HttpBody()));
|
143 |
|
144 |
return $response;
|
152 |
* this service.
|
153 |
*/
|
154 |
public function Update($params=array()) {
|
155 |
+
throw new \OpenCloud\Base\Exceptions\UserUpdateError(
|
156 |
+
\OpenCloud\Base\Lang::translate('You cannot update a database user at this time'));
|
157 |
}
|
158 |
|
159 |
/**
|
171 |
|
172 |
// check status code
|
173 |
if ($response->HttpStatus() > 202)
|
174 |
+
throw new \OpenCloud\Base\Exceptions\UserDeleteError(sprintf(
|
175 |
+
\OpenCloud\Base\Lang::translate('Error deleting user [%s], status [%d] response [%s]',
|
176 |
$this->name, $response->HttpStatus(), $response->HttpBody())));
|
177 |
|
178 |
return $response;
|
sdk/OpenCloud/{globals.php → OpenCloud/Globals.php}
RENAMED
@@ -10,6 +10,8 @@
|
|
10 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
11 |
*/
|
12 |
|
|
|
|
|
13 |
/**
|
14 |
* This file contains only configuration data such as constants.
|
15 |
* You can override these constants by defining them BEFORE you including
|
@@ -128,7 +130,7 @@ if (!defined('RAXSDK_SSL_VERIFYPEER'))
|
|
128 |
date_default_timezone_set(RAXSDK_TIMEZONE);
|
129 |
|
130 |
/* these should not be overridden */
|
131 |
-
define('RAXSDK_VERSION', '1.4');
|
132 |
define('RAXSDK_USER_AGENT', 'php-opencloud/'.RAXSDK_VERSION.' (Rackspace)');
|
133 |
define('RAXSDK_ERROR', 'Error:');
|
134 |
define('RAXSDK_FATAL', 'FATAL ERROR:');
|
@@ -138,13 +140,21 @@ define('RAXSDK_URL_PUBLIC', 'publicURL');
|
|
138 |
define('RAXSDK_URL_INTERNAL', 'internalURL');
|
139 |
define('RAXSDK_URL_VERSION_INFO', 'versionInfo');
|
140 |
define('RAXSDK_URL_VERSION_LIST', 'versionList');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
141 |
/**
|
142 |
* We can re-authenticate this many seconds before the token expires
|
143 |
*
|
144 |
-
* Set this to a higher value if your service does not cache tokens; if
|
145 |
-
* them, then this value is not required.
|
146 |
*/
|
147 |
define('RAXSDK_FUDGE', 0);
|
|
|
148 |
/**
|
149 |
* Readable constants
|
150 |
*/
|
@@ -152,6 +162,7 @@ define('RAXSDK_SOFT_REBOOT', 'soft');
|
|
152 |
define('RAXSDK_HARD_REBOOT', 'hard');
|
153 |
define('RAXSDK_DETAILS', TRUE);
|
154 |
define('RAXSDK_MAX_CONTAINER_NAME_LEN', 256);
|
|
|
155 |
/**
|
156 |
* UUID of the Rackspace 'public' network
|
157 |
*/
|
@@ -164,35 +175,37 @@ define('RAX_PRIVATE','11111111-1111-1111-1111-111111111111');
|
|
164 |
|
165 |
/********** SOME GLOBAL FUNCTIONS **********/
|
166 |
|
167 |
-
/**
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
function define_gettext() {
|
173 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
174 |
return $str;
|
175 |
}
|
176 |
-
}
|
177 |
-
if (!function_exists('_'))
|
178 |
-
define_gettext();
|
179 |
|
180 |
-
/**
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
while ($str && (substr($str, -1) == '/'))
|
188 |
-
$str = substr($str, 0, strlen($str)-1);
|
189 |
-
return $str;
|
190 |
-
}
|
191 |
|
192 |
-
/**
|
193 |
-
* Turns debugging on or off
|
194 |
-
*/
|
195 |
-
function setDebug($state=TRUE) {
|
196 |
-
global $RAXSDK_DEBUG;
|
197 |
-
$RAXSDK_DEBUG=$state;
|
198 |
-
}
|
10 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
11 |
*/
|
12 |
|
13 |
+
namespace OpenCloud;
|
14 |
+
|
15 |
/**
|
16 |
* This file contains only configuration data such as constants.
|
17 |
* You can override these constants by defining them BEFORE you including
|
130 |
date_default_timezone_set(RAXSDK_TIMEZONE);
|
131 |
|
132 |
/* these should not be overridden */
|
133 |
+
define('RAXSDK_VERSION', '1.5.4');
|
134 |
define('RAXSDK_USER_AGENT', 'php-opencloud/'.RAXSDK_VERSION.' (Rackspace)');
|
135 |
define('RAXSDK_ERROR', 'Error:');
|
136 |
define('RAXSDK_FATAL', 'FATAL ERROR:');
|
140 |
define('RAXSDK_URL_INTERNAL', 'internalURL');
|
141 |
define('RAXSDK_URL_VERSION_INFO', 'versionInfo');
|
142 |
define('RAXSDK_URL_VERSION_LIST', 'versionList');
|
143 |
+
|
144 |
+
/**
|
145 |
+
* definitions for Rackspace authentication endpoints
|
146 |
+
*/
|
147 |
+
define('RACKSPACE_US', 'https://identity.api.rackspacecloud.com/v2.0/');
|
148 |
+
define('RACKSPACE_UK', 'https://lon.identity.api.rackspacecloud.com/v2.0/');
|
149 |
+
|
150 |
/**
|
151 |
* We can re-authenticate this many seconds before the token expires
|
152 |
*
|
153 |
+
* Set this to a higher value if your service does not cache tokens; if
|
154 |
+
* it *does* cache them, then this value is not required.
|
155 |
*/
|
156 |
define('RAXSDK_FUDGE', 0);
|
157 |
+
|
158 |
/**
|
159 |
* Readable constants
|
160 |
*/
|
162 |
define('RAXSDK_HARD_REBOOT', 'hard');
|
163 |
define('RAXSDK_DETAILS', TRUE);
|
164 |
define('RAXSDK_MAX_CONTAINER_NAME_LEN', 256);
|
165 |
+
|
166 |
/**
|
167 |
* UUID of the Rackspace 'public' network
|
168 |
*/
|
175 |
|
176 |
/********** SOME GLOBAL FUNCTIONS **********/
|
177 |
|
178 |
+
/**
|
179 |
+
* \OpenCloud\Base\Lang::translate() - this function should be used to wrap all static strings. In the future,
|
180 |
+
* this may provide us with a hook for providing different language
|
181 |
+
* translations.
|
182 |
+
*/
|
183 |
+
function define_gettext() {
|
184 |
+
function translate($str) {
|
185 |
+
return $str;
|
186 |
+
}
|
187 |
+
}
|
188 |
+
|
189 |
+
if (!function_exists('_'))
|
190 |
+
define_gettext();
|
191 |
+
|
192 |
+
/**
|
193 |
+
* removes trailing slash(es) from a URL string
|
194 |
+
*
|
195 |
+
* Mainly, this is just for appearance's sake. I really hate to see
|
196 |
+
* URLs like .../servers//address, for some reason.
|
197 |
+
*/
|
198 |
+
function noslash($str) {
|
199 |
+
while ($str && (substr($str, -1) == '/'))
|
200 |
+
$str = substr($str, 0, strlen($str)-1);
|
201 |
return $str;
|
202 |
}
|
|
|
|
|
|
|
203 |
|
204 |
+
/**
|
205 |
+
* Turns debugging on or off
|
206 |
+
*/
|
207 |
+
function setDebug($state=TRUE) {
|
208 |
+
global $RAXSDK_DEBUG;
|
209 |
+
$RAXSDK_DEBUG=$state;
|
210 |
+
}
|
|
|
|
|
|
|
|
|
211 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sdk/OpenCloud/OpenCloud/LoadBalancer/Algorithm.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\LoadBalancer;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* sub-resource to manage algorithms (read-only)
|
7 |
+
*/
|
8 |
+
class Algorithm extends \OpenCloud\AbstractClass\PersistentObject {
|
9 |
+
public
|
10 |
+
$name;
|
11 |
+
protected static
|
12 |
+
$json_name = 'algorithm',
|
13 |
+
$url_resource = 'loadbalancers/algorithms';
|
14 |
+
public function Create($params=array()) { $this->NoCreate(); }
|
15 |
+
public function Update($params=array()) { $this->NoUpdate(); }
|
16 |
+
public function Delete() { $this->NoDelete(); }
|
17 |
+
}
|
sdk/OpenCloud/OpenCloud/LoadBalancer/AllowedDomain.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\LoadBalancer;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* sub-resource to manage allowed domains
|
7 |
+
*
|
8 |
+
* Note that this is actually a sub-resource of the load balancers service,
|
9 |
+
* and not of the load balancer object. It's included here for convenience,
|
10 |
+
* since it matches the pattern of the other LB subresources.
|
11 |
+
*
|
12 |
+
* @api
|
13 |
+
*/
|
14 |
+
class AllowedDomain extends \OpenCloud\AbstractClass\PersistentObject {
|
15 |
+
public
|
16 |
+
$name;
|
17 |
+
protected static
|
18 |
+
$json_name = 'allowedDomain',
|
19 |
+
$json_collection_name = 'allowedDomains',
|
20 |
+
$json_collection_element = 'allowedDomain',
|
21 |
+
$url_resource = 'loadbalancers/alloweddomains';
|
22 |
+
public function Create($params=array()) { $this->NoCreate(); }
|
23 |
+
public function Update($params=array()) { $this->NoUpdate(); }
|
24 |
+
public function Delete() { $this->NoDelete(); }
|
25 |
+
}
|
sdk/OpenCloud/OpenCloud/LoadBalancer/BillableLoadBalancer.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\LoadBalancer;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* used to get a list of billable load balancers for a specific date range
|
7 |
+
*/
|
8 |
+
class BillableLoadBalancer extends LoadBalancer {
|
9 |
+
protected static
|
10 |
+
$url_resource = 'loadbalancers/billable';
|
11 |
+
public function Create($params=array()) { $this->NoCreate(); }
|
12 |
+
public function Update($params=array()) { $this->NoUpdate(); }
|
13 |
+
public function Delete() { $this->NoDelete(); }
|
14 |
+
} // end BillableLoadBalancer
|
sdk/OpenCloud/{loadbalancer.php → OpenCloud/LoadBalancer/LoadBalancer.php}
RENAMED
@@ -10,11 +10,7 @@
|
|
10 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
11 |
*/
|
12 |
|
13 |
-
namespace OpenCloud\
|
14 |
-
|
15 |
-
require_once(__DIR__.'/persistentobject.php'); // handles persistence
|
16 |
-
require_once(__DIR__.'/metadata.php'); // metadata common
|
17 |
-
require_once(__DIR__.'/lbresources.php'); // child resources
|
18 |
|
19 |
/**
|
20 |
* The LoadBalancer class represents a single load balancer
|
@@ -24,7 +20,7 @@ require_once(__DIR__.'/lbresources.php'); // child resources
|
|
24 |
* @api
|
25 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
26 |
*/
|
27 |
-
class LoadBalancer extends \OpenCloud\PersistentObject {
|
28 |
|
29 |
public
|
30 |
$id,
|
@@ -43,6 +39,9 @@ class LoadBalancer extends \OpenCloud\PersistentObject {
|
|
43 |
/* returned in response */
|
44 |
$created,
|
45 |
$updated,
|
|
|
|
|
|
|
46 |
$sourceAddresses;
|
47 |
|
48 |
protected static
|
@@ -98,8 +97,8 @@ class LoadBalancer extends \OpenCloud\PersistentObject {
|
|
98 |
$node->condition = $cond;
|
99 |
break;
|
100 |
default:
|
101 |
-
throw new \OpenCloud\DomainError(sprintf(
|
102 |
-
|
103 |
}
|
104 |
if (isset($type)) {
|
105 |
switch(strtoupper($type)) {
|
@@ -108,16 +107,16 @@ class LoadBalancer extends \OpenCloud\PersistentObject {
|
|
108 |
$node->type = $type;
|
109 |
break;
|
110 |
default:
|
111 |
-
throw new \OpenCloud\DomainError(sprintf(
|
112 |
-
|
113 |
}
|
114 |
}
|
115 |
if (isset($weight)) {
|
116 |
if (is_integer($weight))
|
117 |
$node->weight = $weight;
|
118 |
else
|
119 |
-
throw new \OpenCloud\DomainError(sprintf(
|
120 |
-
|
121 |
}
|
122 |
$this->nodes[] = $node;
|
123 |
}
|
@@ -134,8 +133,8 @@ class LoadBalancer extends \OpenCloud\PersistentObject {
|
|
134 |
*/
|
135 |
public function AddNodes() {
|
136 |
if (count($this->nodes) < 1)
|
137 |
-
throw new MissingValueError(
|
138 |
-
|
139 |
|
140 |
// iterate through all the nodes
|
141 |
foreach($this->nodes as $node)
|
@@ -180,8 +179,8 @@ class LoadBalancer extends \OpenCloud\PersistentObject {
|
|
180 |
$obj->version = 'IPV6';
|
181 |
break;
|
182 |
default:
|
183 |
-
throw new \OpenCloud\DomainError(sprintf(
|
184 |
-
|
185 |
}
|
186 |
}
|
187 |
|
@@ -216,7 +215,7 @@ class LoadBalancer extends \OpenCloud\PersistentObject {
|
|
216 |
* returns a Node object
|
217 |
*/
|
218 |
public function Node($id=NULL) {
|
219 |
-
return new Node($this, $id);
|
220 |
}
|
221 |
|
222 |
/**
|
@@ -224,14 +223,14 @@ class LoadBalancer extends \OpenCloud\PersistentObject {
|
|
224 |
*/
|
225 |
public function NodeList() {
|
226 |
return $this->Parent()->Collection(
|
227 |
-
'\OpenCloud\
|
228 |
}
|
229 |
|
230 |
/**
|
231 |
* returns a NodeEvent object
|
232 |
*/
|
233 |
public function NodeEvent() {
|
234 |
-
return new NodeEvent($this);
|
235 |
}
|
236 |
|
237 |
/**
|
@@ -239,14 +238,14 @@ class LoadBalancer extends \OpenCloud\PersistentObject {
|
|
239 |
*/
|
240 |
public function NodeEventList() {
|
241 |
return $this->Parent()->Collection(
|
242 |
-
'\OpenCloud\
|
243 |
}
|
244 |
|
245 |
/**
|
246 |
* returns a single Virtual IP (not called publicly)
|
247 |
*/
|
248 |
public function VirtualIp($data=NULL) {
|
249 |
-
return new VirtualIp($this, $data);
|
250 |
}
|
251 |
|
252 |
/**
|
@@ -254,13 +253,13 @@ class LoadBalancer extends \OpenCloud\PersistentObject {
|
|
254 |
*/
|
255 |
public function VirtualIpList() {
|
256 |
return $this->Service()->Collection(
|
257 |
-
'\OpenCloud\
|
258 |
}
|
259 |
|
260 |
/**
|
261 |
*/
|
262 |
public function SessionPersistence() {
|
263 |
-
return new SessionPersistence($this);
|
264 |
}
|
265 |
|
266 |
/**
|
@@ -270,7 +269,17 @@ class LoadBalancer extends \OpenCloud\PersistentObject {
|
|
270 |
* @return ErrorPage
|
271 |
*/
|
272 |
public function ErrorPage() {
|
273 |
-
return new ErrorPage($this);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
274 |
}
|
275 |
|
276 |
/**
|
@@ -282,63 +291,63 @@ class LoadBalancer extends \OpenCloud\PersistentObject {
|
|
282 |
* @return Stats
|
283 |
*/
|
284 |
public function Stats() {
|
285 |
-
return new Stats($this);
|
286 |
}
|
287 |
|
288 |
/**
|
289 |
*/
|
290 |
public function Usage() {
|
291 |
-
return new Usage($this);
|
292 |
}
|
293 |
|
294 |
/**
|
295 |
*/
|
296 |
public function Access($data=NULL) {
|
297 |
-
return new Access($this, $data);
|
298 |
}
|
299 |
|
300 |
/**
|
301 |
*/
|
302 |
public function AccessList() {
|
303 |
return $this->Service()->Collection(
|
304 |
-
'\OpenCloud\
|
305 |
}
|
306 |
|
307 |
/**
|
308 |
*/
|
309 |
public function ConnectionThrottle() {
|
310 |
-
return new ConnectionThrottle($this);
|
311 |
}
|
312 |
|
313 |
/**
|
314 |
*/
|
315 |
public function ConnectionLogging() {
|
316 |
-
return new ConnectionLogging($this);
|
317 |
}
|
318 |
|
319 |
/**
|
320 |
*/
|
321 |
public function ContentCaching() {
|
322 |
-
return new ContentCaching($this);
|
323 |
}
|
324 |
|
325 |
/**
|
326 |
*/
|
327 |
public function SSLTermination() {
|
328 |
-
return new SSLTermination($this);
|
329 |
}
|
330 |
|
331 |
/**
|
332 |
*/
|
333 |
public function Metadata($data=NULL) {
|
334 |
-
return new Metadata($this, $data);
|
335 |
}
|
336 |
|
337 |
/**
|
338 |
*/
|
339 |
public function MetadataList() {
|
340 |
return $this->Service()->Collection(
|
341 |
-
'\OpenCloud\
|
342 |
}
|
343 |
|
344 |
/********** PROTECTED METHODS **********/
|
@@ -373,15 +382,3 @@ class LoadBalancer extends \OpenCloud\PersistentObject {
|
|
373 |
}
|
374 |
|
375 |
} // end LoadBalancer
|
376 |
-
|
377 |
-
/**
|
378 |
-
* used to get a list of billable load balancers for a specific date range
|
379 |
-
*/
|
380 |
-
class BillableLoadBalancer extends LoadBalancer {
|
381 |
-
protected static
|
382 |
-
$url_resource = 'loadbalancers/billable';
|
383 |
-
public function Create($params=array()) { $this->NoCreate(); }
|
384 |
-
public function Update($params=array()) { $this->NoUpdate(); }
|
385 |
-
public function Delete() { $this->NoDelete(); }
|
386 |
-
} // end BillableLoadBalancer
|
387 |
-
|
10 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
11 |
*/
|
12 |
|
13 |
+
namespace OpenCloud\LoadBalancer;
|
|
|
|
|
|
|
|
|
14 |
|
15 |
/**
|
16 |
* The LoadBalancer class represents a single load balancer
|
20 |
* @api
|
21 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
22 |
*/
|
23 |
+
class LoadBalancer extends \OpenCloud\AbstractClass\PersistentObject {
|
24 |
|
25 |
public
|
26 |
$id,
|
39 |
/* returned in response */
|
40 |
$created,
|
41 |
$updated,
|
42 |
+
$status,
|
43 |
+
$timeout,
|
44 |
+
$nodeCount,
|
45 |
$sourceAddresses;
|
46 |
|
47 |
protected static
|
97 |
$node->condition = $cond;
|
98 |
break;
|
99 |
default:
|
100 |
+
throw new \OpenCloud\Base\Exceptions\DomainError(sprintf(
|
101 |
+
\OpenCloud\Base\Lang::translate('Value [%s] for Node::condition is not valid'), $condition));
|
102 |
}
|
103 |
if (isset($type)) {
|
104 |
switch(strtoupper($type)) {
|
107 |
$node->type = $type;
|
108 |
break;
|
109 |
default:
|
110 |
+
throw new \OpenCloud\Base\Exceptions\DomainError(sprintf(
|
111 |
+
\OpenCloud\Base\Lang::translate('Value [%s] for Node::type is not valid'), $type));
|
112 |
}
|
113 |
}
|
114 |
if (isset($weight)) {
|
115 |
if (is_integer($weight))
|
116 |
$node->weight = $weight;
|
117 |
else
|
118 |
+
throw new \OpenCloud\Base\Exceptions\DomainError(sprintf(
|
119 |
+
\OpenCloud\Base\Lang::translate('Value [%s] for Node::weight must be integer'), $weight));
|
120 |
}
|
121 |
$this->nodes[] = $node;
|
122 |
}
|
133 |
*/
|
134 |
public function AddNodes() {
|
135 |
if (count($this->nodes) < 1)
|
136 |
+
throw new \OpenCloud\Base\Exceptions\MissingValueError(
|
137 |
+
\OpenCloud\Base\Lang::translate('Cannot add nodes; no nodes are defined'));
|
138 |
|
139 |
// iterate through all the nodes
|
140 |
foreach($this->nodes as $node)
|
179 |
$obj->version = 'IPV6';
|
180 |
break;
|
181 |
default:
|
182 |
+
throw new \OpenCloud\Base\Exceptions\DomainError(sprintf(
|
183 |
+
\OpenCloud\Base\Lang::translate('Value [%s] for ipVersion is not valid'), $ipVersion));
|
184 |
}
|
185 |
}
|
186 |
|
215 |
* returns a Node object
|
216 |
*/
|
217 |
public function Node($id=NULL) {
|
218 |
+
return new Resources\Node($this, $id);
|
219 |
}
|
220 |
|
221 |
/**
|
223 |
*/
|
224 |
public function NodeList() {
|
225 |
return $this->Parent()->Collection(
|
226 |
+
'\OpenCloud\LoadBalancer\Resources\Node', NULL, $this);
|
227 |
}
|
228 |
|
229 |
/**
|
230 |
* returns a NodeEvent object
|
231 |
*/
|
232 |
public function NodeEvent() {
|
233 |
+
return new Resources\NodeEvent($this);
|
234 |
}
|
235 |
|
236 |
/**
|
238 |
*/
|
239 |
public function NodeEventList() {
|
240 |
return $this->Parent()->Collection(
|
241 |
+
'\OpenCloud\LoadBalancer\Resources\NodeEvent', NULL, $this);
|
242 |
}
|
243 |
|
244 |
/**
|
245 |
* returns a single Virtual IP (not called publicly)
|
246 |
*/
|
247 |
public function VirtualIp($data=NULL) {
|
248 |
+
return new Resources\VirtualIp($this, $data);
|
249 |
}
|
250 |
|
251 |
/**
|
253 |
*/
|
254 |
public function VirtualIpList() {
|
255 |
return $this->Service()->Collection(
|
256 |
+
'\OpenCloud\LoadBalancer\Resources\VirtualIp', NULL, $this);
|
257 |
}
|
258 |
|
259 |
/**
|
260 |
*/
|
261 |
public function SessionPersistence() {
|
262 |
+
return new Resources\SessionPersistence($this);
|
263 |
}
|
264 |
|
265 |
/**
|
269 |
* @return ErrorPage
|
270 |
*/
|
271 |
public function ErrorPage() {
|
272 |
+
return new Resources\ErrorPage($this);
|
273 |
+
}
|
274 |
+
|
275 |
+
/**
|
276 |
+
* returns the load balancer's health monitor object
|
277 |
+
*
|
278 |
+
* @api
|
279 |
+
* @return HealthMonitor
|
280 |
+
*/
|
281 |
+
public function HealthMonitor() {
|
282 |
+
return new Resources\HealthMonitor($this);
|
283 |
}
|
284 |
|
285 |
/**
|
291 |
* @return Stats
|
292 |
*/
|
293 |
public function Stats() {
|
294 |
+
return new Resources\Stats($this);
|
295 |
}
|
296 |
|
297 |
/**
|
298 |
*/
|
299 |
public function Usage() {
|
300 |
+
return new Resources\Usage($this);
|
301 |
}
|
302 |
|
303 |
/**
|
304 |
*/
|
305 |
public function Access($data=NULL) {
|
306 |
+
return new Resources\Access($this, $data);
|
307 |
}
|
308 |
|
309 |
/**
|
310 |
*/
|
311 |
public function AccessList() {
|
312 |
return $this->Service()->Collection(
|
313 |
+
'\OpenCloud\LoadBalancer\Resources\Access', NULL, $this);
|
314 |
}
|
315 |
|
316 |
/**
|
317 |
*/
|
318 |
public function ConnectionThrottle() {
|
319 |
+
return new Resources\ConnectionThrottle($this);
|
320 |
}
|
321 |
|
322 |
/**
|
323 |
*/
|
324 |
public function ConnectionLogging() {
|
325 |
+
return new Resources\ConnectionLogging($this);
|
326 |
}
|
327 |
|
328 |
/**
|
329 |
*/
|
330 |
public function ContentCaching() {
|
331 |
+
return new Resources\ContentCaching($this);
|
332 |
}
|
333 |
|
334 |
/**
|
335 |
*/
|
336 |
public function SSLTermination() {
|
337 |
+
return new Resources\SSLTermination($this);
|
338 |
}
|
339 |
|
340 |
/**
|
341 |
*/
|
342 |
public function Metadata($data=NULL) {
|
343 |
+
return new Resources\Metadata($this, $data);
|
344 |
}
|
345 |
|
346 |
/**
|
347 |
*/
|
348 |
public function MetadataList() {
|
349 |
return $this->Service()->Collection(
|
350 |
+
'\OpenCloud\LoadBalancer\Resources\Metadata', NULL, $this);
|
351 |
}
|
352 |
|
353 |
/********** PROTECTED METHODS **********/
|
382 |
}
|
383 |
|
384 |
} // end LoadBalancer
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sdk/OpenCloud/OpenCloud/LoadBalancer/Protocol.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\LoadBalancer;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* sub-resource to manage protocols (read-only)
|
7 |
+
*/
|
8 |
+
class Protocol extends \OpenCloud\AbstractClass\PersistentObject {
|
9 |
+
public
|
10 |
+
$name,
|
11 |
+
$port;
|
12 |
+
protected static
|
13 |
+
$json_name = 'protocol',
|
14 |
+
$url_resource = 'loadbalancers/protocols';
|
15 |
+
public function Create($params=array()) { $this->NoCreate(); }
|
16 |
+
public function Update($params=array()) { $this->NoUpdate(); }
|
17 |
+
public function Delete() { $this->NoDelete(); }
|
18 |
+
}
|
sdk/OpenCloud/OpenCloud/LoadBalancer/Resources/Access.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\LoadBalancer\Resources;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* sub-resource to manage access lists
|
7 |
+
*
|
8 |
+
* @api
|
9 |
+
*/
|
10 |
+
class Access extends SubResource {
|
11 |
+
public
|
12 |
+
$id,
|
13 |
+
$type,
|
14 |
+
$address;
|
15 |
+
protected static
|
16 |
+
$json_name = "accessList",
|
17 |
+
$url_resource = "accesslist";
|
18 |
+
protected
|
19 |
+
$_create_keys = array('type', 'address');
|
20 |
+
public function Update($params=array()) { $this->NoUpdate(); }
|
21 |
+
}
|
sdk/OpenCloud/OpenCloud/LoadBalancer/Resources/ConnectionLogging.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\LoadBalancer\Resources;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* sub-resource to manage connection logging
|
7 |
+
*
|
8 |
+
* @api
|
9 |
+
*/
|
10 |
+
class ConnectionLogging extends SubResource {
|
11 |
+
public
|
12 |
+
$enabled;
|
13 |
+
protected static
|
14 |
+
$json_name = "connectionLogging",
|
15 |
+
$url_resource = "connectionlogging";
|
16 |
+
protected
|
17 |
+
$_create_keys = array( 'enabled' );
|
18 |
+
public function Create($params=array()) { $this->Update($params); }
|
19 |
+
public function Delete() { $this->NoDelete(); }
|
20 |
+
}
|
sdk/OpenCloud/OpenCloud/LoadBalancer/Resources/ConnectionThrottle.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\LoadBalancer\Resources;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* sub-resource to manage connection throttling
|
7 |
+
*
|
8 |
+
* @api
|
9 |
+
*/
|
10 |
+
class ConnectionThrottle extends SubResource {
|
11 |
+
public
|
12 |
+
$minConnections,
|
13 |
+
$maxConnections,
|
14 |
+
$maxConnectionRate,
|
15 |
+
$rateInterval;
|
16 |
+
protected static
|
17 |
+
$json_name = "connectionThrottle",
|
18 |
+
$url_resource = "connectionthrottle";
|
19 |
+
protected
|
20 |
+
$_create_keys = array(
|
21 |
+
'minConnections',
|
22 |
+
'maxConnections',
|
23 |
+
'maxConnectionRate',
|
24 |
+
'rateInterval'
|
25 |
+
);
|
26 |
+
/**
|
27 |
+
* create uses PUT like Update
|
28 |
+
*/
|
29 |
+
public function Create($parm=array()) { $this->Update($parm); }
|
30 |
+
}
|
sdk/OpenCloud/OpenCloud/LoadBalancer/Resources/ContentCaching.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\LoadBalancer\Resources;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* sub-resource to manage content caching
|
7 |
+
*
|
8 |
+
* @api
|
9 |
+
*/
|
10 |
+
class ContentCaching extends SubResource {
|
11 |
+
public
|
12 |
+
$enabled;
|
13 |
+
protected static
|
14 |
+
$json_name = "contentCaching",
|
15 |
+
$url_resource = "contentcaching";
|
16 |
+
protected
|
17 |
+
$_create_keys = array( 'enabled' );
|
18 |
+
public function Create($parm=array()) { $this->Update($parm); }
|
19 |
+
public function Delete() { $this->NoDelete(); }
|
20 |
+
}
|
sdk/OpenCloud/OpenCloud/LoadBalancer/Resources/ErrorPage.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\LoadBalancer\Resources;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* The /loadbalancer/{id}/errorpage manages the error page for the load
|
7 |
+
* balancer.
|
8 |
+
*/
|
9 |
+
class ErrorPage extends SubResource {
|
10 |
+
public
|
11 |
+
$content;
|
12 |
+
protected static
|
13 |
+
$json_name = 'errorpage',
|
14 |
+
$url_resource = 'errorpage';
|
15 |
+
protected
|
16 |
+
$_create_keys = array('content');
|
17 |
+
/**
|
18 |
+
* creates a new error page
|
19 |
+
*
|
20 |
+
* This calls the Update() method, since it requires a PUT to create
|
21 |
+
* a new error page. A POST request is not supported, since the URL
|
22 |
+
* resource is already defined.
|
23 |
+
*
|
24 |
+
* @param array $parm array of parameters
|
25 |
+
*/
|
26 |
+
public function Create($parm=array()) { $this->Update($parm); }
|
27 |
+
} // end ErrorPage
|
sdk/OpenCloud/OpenCloud/LoadBalancer/Resources/HealthMonitor.php
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\LoadBalancer\Resources;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* sub-resource to manage health monitor info
|
7 |
+
*/
|
8 |
+
class HealthMonitor extends SubResource {
|
9 |
+
public
|
10 |
+
$type,
|
11 |
+
$delay,
|
12 |
+
$timeout,
|
13 |
+
$attemptsBeforeDeactivation,
|
14 |
+
$bodyRegex,
|
15 |
+
$hostHeader,
|
16 |
+
$path,
|
17 |
+
$statusRegex;
|
18 |
+
protected static
|
19 |
+
$json_name = 'healthMonitor',
|
20 |
+
$url_resource = 'healthmonitor';
|
21 |
+
protected
|
22 |
+
$_create_keys = array(
|
23 |
+
'type',
|
24 |
+
'delay',
|
25 |
+
'timeout',
|
26 |
+
'attemptsBeforeDeactivation',
|
27 |
+
'bodyRegex',
|
28 |
+
'hostHeader',
|
29 |
+
'path',
|
30 |
+
'statusRegex'
|
31 |
+
);
|
32 |
+
/**
|
33 |
+
* creates a new health monitor
|
34 |
+
*
|
35 |
+
* This calls the Update() method, since it requires a PUT to create
|
36 |
+
* a new error page. A POST request is not supported, since the URL
|
37 |
+
* resource is already defined.
|
38 |
+
*
|
39 |
+
* @param array $parm array of parameters
|
40 |
+
*/
|
41 |
+
public function Create($parm=array()) { $this->Update($parm); }
|
42 |
+
} // end HealthMonitor
|
sdk/OpenCloud/OpenCloud/LoadBalancer/Resources/Metadata.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\LoadBalancer\Resources;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* sub-resource to manage Metadata
|
7 |
+
*/
|
8 |
+
class Metadata extends SubResource {
|
9 |
+
public
|
10 |
+
$id,
|
11 |
+
$key,
|
12 |
+
$value;
|
13 |
+
protected static
|
14 |
+
$json_name = 'meta',
|
15 |
+
$json_collection_name = 'metadata',
|
16 |
+
$url_resource = 'metadata';
|
17 |
+
protected
|
18 |
+
$_create_keys = array('key', 'value');
|
19 |
+
public function Name() {
|
20 |
+
return $this->key;
|
21 |
+
}
|
22 |
+
}
|
sdk/OpenCloud/OpenCloud/LoadBalancer/Resources/Node.php
ADDED
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\LoadBalancer\Resources;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* information on a single node in the load balancer
|
7 |
+
*
|
8 |
+
* This extends `PersistentObject` because it has an ID, unlike most other
|
9 |
+
* sub-resources.
|
10 |
+
*/
|
11 |
+
class Node extends \OpenCloud\AbstractClass\PersistentObject {
|
12 |
+
public
|
13 |
+
$id,
|
14 |
+
$address,
|
15 |
+
$port,
|
16 |
+
$condition,
|
17 |
+
$status,
|
18 |
+
$weight,
|
19 |
+
$type;
|
20 |
+
protected static
|
21 |
+
$json_name = FALSE,
|
22 |
+
$json_collection_name = 'nodes',
|
23 |
+
$url_resource = 'nodes';
|
24 |
+
private
|
25 |
+
$_create_keys = array(
|
26 |
+
'address',
|
27 |
+
'port',
|
28 |
+
'condition',
|
29 |
+
'type',
|
30 |
+
'weight'
|
31 |
+
),
|
32 |
+
$_lb;
|
33 |
+
/**
|
34 |
+
* builds a new Node object
|
35 |
+
*
|
36 |
+
* @param LoadBalancer $lb the parent LB object
|
37 |
+
* @param mixed $info either an ID or an array of values
|
38 |
+
* @returns void
|
39 |
+
*/
|
40 |
+
public function __construct(\OpenCloud\LoadBalancer\LoadBalancer $lb, $info=NULL) {
|
41 |
+
$this->_lb = $lb;
|
42 |
+
parent::__construct($lb->Service(), $info);
|
43 |
+
}
|
44 |
+
/**
|
45 |
+
* returns the parent LoadBalancer object
|
46 |
+
*
|
47 |
+
* @return LoadBalancer
|
48 |
+
*/
|
49 |
+
public function Parent() {
|
50 |
+
return $this->_lb;
|
51 |
+
}
|
52 |
+
/**
|
53 |
+
* returns the Node name
|
54 |
+
*
|
55 |
+
* @return string
|
56 |
+
*/
|
57 |
+
public function Name() {
|
58 |
+
return get_class().'['.$this->Id().']';
|
59 |
+
}
|
60 |
+
/**
|
61 |
+
* returns the object for the Create JSON
|
62 |
+
*
|
63 |
+
* @return \stdClass
|
64 |
+
*/
|
65 |
+
protected function CreateJson() {
|
66 |
+
$obj = new \stdClass();
|
67 |
+
$obj->nodes = array();
|
68 |
+
$node = new \stdClass();
|
69 |
+
$node->node = new \stdClass();
|
70 |
+
foreach($this->_create_keys as $key) {
|
71 |
+
$node->node->$key = $this->$key;
|
72 |
+
}
|
73 |
+
$obj->nodes[] = $node;
|
74 |
+
return $obj;
|
75 |
+
}
|
76 |
+
|
77 |
+
/**
|
78 |
+
* factory method to create a new Metadata child of the Node
|
79 |
+
*
|
80 |
+
* @api
|
81 |
+
* @return Metadata
|
82 |
+
*/
|
83 |
+
public function Metadata($data=NULL) {
|
84 |
+
return new Metadata($this, $data);
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* factory method to create a Collection of Metadata object
|
89 |
+
*
|
90 |
+
* Note that these are metadata children of the Node, not of the
|
91 |
+
* LoadBalancer.
|
92 |
+
*
|
93 |
+
* @api
|
94 |
+
* @return Collection of Metadata
|
95 |
+
*/
|
96 |
+
public function MetadataList() {
|
97 |
+
return $this->Service()->Collection(
|
98 |
+
'\OpenCloud\LoadBalancer\Resources\Metadata', NULL, $this);
|
99 |
+
}
|
100 |
+
}
|
sdk/OpenCloud/OpenCloud/LoadBalancer/Resources/NodeEvent.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\LoadBalancer\Resources;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* a single node event, usually called as part of a Collection
|
7 |
+
*
|
8 |
+
* This is a read-only subresource.
|
9 |
+
*/
|
10 |
+
class NodeEvent extends Readonly {
|
11 |
+
public
|
12 |
+
$detailedMessage,
|
13 |
+
$nodeId,
|
14 |
+
$id,
|
15 |
+
$type,
|
16 |
+
$description,
|
17 |
+
$category,
|
18 |
+
$severity,
|
19 |
+
$relativeUri,
|
20 |
+
$accountId,
|
21 |
+
$loadbalancerId,
|
22 |
+
$title,
|
23 |
+
$author,
|
24 |
+
$created;
|
25 |
+
protected static
|
26 |
+
$json_name = 'nodeServiceEvent',
|
27 |
+
$url_resource = 'nodes/events';
|
28 |
+
}
|
sdk/OpenCloud/OpenCloud/LoadBalancer/Resources/Readonly.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\LoadBalancer\Resources;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* This defines a read-only SubResource - one that cannot be created, updated,
|
7 |
+
* or deleted. Many subresources are like this, and this simplifies their
|
8 |
+
* class definitions.
|
9 |
+
*/
|
10 |
+
abstract class Readonly extends SubResource {
|
11 |
+
/**
|
12 |
+
* no Create
|
13 |
+
*/
|
14 |
+
public function Create($params=array()) { $this->NoCreate(); }
|
15 |
+
/**
|
16 |
+
* no Update
|
17 |
+
*/
|
18 |
+
public function Update($params=array()) { $this->NoUpdate(); }
|
19 |
+
/**
|
20 |
+
* no Delete
|
21 |
+
*/
|
22 |
+
public function Delete() { $this->NoDelete(); }
|
23 |
+
}
|
sdk/OpenCloud/OpenCloud/LoadBalancer/Resources/SSLTermination.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\LoadBalancer\Resources;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* sub-resource to manage SSL termination
|
7 |
+
*/
|
8 |
+
class SSLTermination extends SubResource {
|
9 |
+
public
|
10 |
+
$certificate,
|
11 |
+
$enabled,
|
12 |
+
$secureTrafficOnly,
|
13 |
+
$privatekey,
|
14 |
+
$intermediateCertificate,
|
15 |
+
$securePort;
|
16 |
+
protected static
|
17 |
+
$json_name = "sslTermination",
|
18 |
+
$url_resource = "ssltermination";
|
19 |
+
protected
|
20 |
+
$_create_keys = array(
|
21 |
+
'certificate',
|
22 |
+
'enabled',
|
23 |
+
'secureTrafficOnly',
|
24 |
+
'privatekey',
|
25 |
+
'intermediateCertificate',
|
26 |
+
'securePort'
|
27 |
+
);
|
28 |
+
public function Create($params=array()) { $this->Update($params); }
|
29 |
+
}
|
sdk/OpenCloud/OpenCloud/LoadBalancer/Resources/SessionPersistence.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\LoadBalancer\Resources;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* sub-resource to manage session persistence setting
|
7 |
+
*/
|
8 |
+
class SessionPersistence extends SubResource {
|
9 |
+
public
|
10 |
+
$persistenceType;
|
11 |
+
protected static
|
12 |
+
$json_name = 'sessionPersistence',
|
13 |
+
$url_resource = 'sessionpersistence';
|
14 |
+
private
|
15 |
+
$_create_keys = array('persistenceType');
|
16 |
+
}
|
sdk/OpenCloud/OpenCloud/LoadBalancer/Resources/Stats.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\LoadBalancer\Resources;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Stats returns statistics about the load balancer
|
7 |
+
*/
|
8 |
+
class Stats extends Readonly {
|
9 |
+
public
|
10 |
+
$connectTimeOut,
|
11 |
+
$connectError,
|
12 |
+
$connectFailure,
|
13 |
+
$dataTimedOut,
|
14 |
+
$keepAliveTimedOut,
|
15 |
+
$maxConn;
|
16 |
+
protected static
|
17 |
+
$json_name = FALSE,
|
18 |
+
$url_resource = 'stats';
|
19 |
+
}
|
sdk/OpenCloud/OpenCloud/LoadBalancer/Resources/SubResource.php
ADDED
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\LoadBalancer\Resources;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* SubResource is an abstract class that handles subresources of a
|
7 |
+
* LoadBalancer object; for example, the
|
8 |
+
* `/loadbalancers/{id}/errorpage`. Since most of the subresources are
|
9 |
+
* handled in a similar manner, this consolidates the functions.
|
10 |
+
*
|
11 |
+
* There are really four pieces of data that define a subresource:
|
12 |
+
* * `$url_resource` - the actual name of the url component
|
13 |
+
* * `$json_name` - the name of the JSON object holding the data
|
14 |
+
* * `$json_collection_name` - if the collection is not simply
|
15 |
+
* `$json_name . 's'`, this defines the collectio name.
|
16 |
+
* * `$json_collection_element` - if the object in a collection is not
|
17 |
+
* anonymous, this defines the name of the element holding the object.
|
18 |
+
* Of these, only the `$json_name` and `$url_resource` are required.
|
19 |
+
*/
|
20 |
+
abstract class SubResource extends \OpenCloud\AbstractClass\PersistentObject {
|
21 |
+
|
22 |
+
private
|
23 |
+
$parent; // holds the parent load balancer
|
24 |
+
|
25 |
+
/**
|
26 |
+
* constructs the SubResource's object
|
27 |
+
*
|
28 |
+
* @param mixed $obj the parent object
|
29 |
+
* @param mixed $value the ID or array of values for the object
|
30 |
+
*/
|
31 |
+
public function __construct($obj, $value=NULL) {
|
32 |
+
$this->parent = $obj;
|
33 |
+
parent::__construct($obj->Service(), $value);
|
34 |
+
/**
|
35 |
+
* Note that, since these sub-resources do not have an ID, we must
|
36 |
+
* fake out the `Refresh` method.
|
37 |
+
*/
|
38 |
+
if (isset($this->id))
|
39 |
+
$this->Refresh();
|
40 |
+
else
|
41 |
+
$this->Refresh('<no-id>');
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* returns the URL of the SubResource
|
46 |
+
*
|
47 |
+
* @api
|
48 |
+
* @param string $subresource the subresource of the parent
|
49 |
+
* @param array $qstr an array of key/value pairs to be converted to
|
50 |
+
* query string parameters for the subresource
|
51 |
+
* @return string
|
52 |
+
*/
|
53 |
+
public function Url($subresource=NULL, $qstr=array()) {
|
54 |
+
return $this->Parent()->Url($this->ResourceName());
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* returns the JSON document's object for creating the subresource
|
59 |
+
*
|
60 |
+
* The value `$_create_keys` should be an array of names of data items
|
61 |
+
* that can be used in the creation of the object.
|
62 |
+
*
|
63 |
+
* @return \stdClass;
|
64 |
+
*/
|
65 |
+
protected function CreateJson() {
|
66 |
+
$obj = new \stdClass();
|
67 |
+
$top = $this->JsonName();
|
68 |
+
if ($top) {
|
69 |
+
$obj->$top = new \stdClass();
|
70 |
+
foreach($this->_create_keys as $item)
|
71 |
+
$obj->$top->$item = $this->$item;
|
72 |
+
}
|
73 |
+
else {
|
74 |
+
foreach($this->_create_keys as $item)
|
75 |
+
$obj->$item = $this->$item;
|
76 |
+
}
|
77 |
+
return $obj;
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* returns the JSON for the update (same as create)
|
82 |
+
*
|
83 |
+
* For these subresources, the update JSON is the same as the Create JSON
|
84 |
+
* @return \stdClass
|
85 |
+
*/
|
86 |
+
protected function UpdateJson($params = array()) {
|
87 |
+
return $this->CreateJson();
|
88 |
+
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* returns the Parent object (usually a LoadBalancer, but sometimes another
|
92 |
+
* SubResource)
|
93 |
+
*
|
94 |
+
* @return mixed
|
95 |
+
*/
|
96 |
+
public function Parent() {
|
97 |
+
return $this->parent;
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* returns a (default) name of the object
|
102 |
+
*
|
103 |
+
* The name is constructed by the object class and the object's ID.
|
104 |
+
*
|
105 |
+
* @api
|
106 |
+
* @return string
|
107 |
+
*/
|
108 |
+
public function Name() {
|
109 |
+
return sprintf(\OpenCloud\Base\Lang::translate('%s-%s'),
|
110 |
+
get_class($this), $this->Parent()->Id());
|
111 |
+
}
|
112 |
+
} // end SubResource
|
sdk/OpenCloud/OpenCloud/LoadBalancer/Resources/Usage.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\LoadBalancer\Resources;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* used to get usage data for a load balancer
|
7 |
+
*/
|
8 |
+
class Usage extends Readonly {
|
9 |
+
public
|
10 |
+
$id,
|
11 |
+
$averageNumConnections,
|
12 |
+
$incomingTransfer,
|
13 |
+
$outgoingTransfer,
|
14 |
+
$averageNumConnectionsSsl,
|
15 |
+
$incomingTransferSsl,
|
16 |
+
$outgoingTransferSsl,
|
17 |
+
$numVips,
|
18 |
+
$numPolls,
|
19 |
+
$startTime,
|
20 |
+
$endTime,
|
21 |
+
$vipType,
|
22 |
+
$sslMode,
|
23 |
+
$eventType;
|
24 |
+
protected static
|
25 |
+
$json_name = 'loadBalancerUsageRecord',
|
26 |
+
$url_resource = 'usage';
|
27 |
+
} // end Usage
|
sdk/OpenCloud/OpenCloud/LoadBalancer/Resources/VirtualIp.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\LoadBalancer\Resources;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* VirtualIp represents a single virtual IP (usually returned in a Collection)
|
7 |
+
*
|
8 |
+
* Virtual IPs can be added to a load balancer when it is created; however,
|
9 |
+
* this subresource allows the user to add or update them one at a time.
|
10 |
+
*
|
11 |
+
* @api
|
12 |
+
*/
|
13 |
+
class VirtualIp extends SubResource {
|
14 |
+
public
|
15 |
+
$id,
|
16 |
+
$address,
|
17 |
+
$type,
|
18 |
+
$ipVersion;
|
19 |
+
protected static
|
20 |
+
$json_collection_name = 'virtualIps',
|
21 |
+
$json_name = FALSE,
|
22 |
+
$url_resource = 'virtualips';
|
23 |
+
protected
|
24 |
+
$_create_keys = array('type', 'ipVersion');
|
25 |
+
public function Update($params=array()) { $this->NoUpdate(); }
|
26 |
+
}
|
sdk/OpenCloud/{lbservice.php → OpenCloud/LoadBalancer/Service.php}
RENAMED
@@ -10,17 +10,14 @@
|
|
10 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
11 |
*/
|
12 |
|
13 |
-
namespace OpenCloud;
|
14 |
-
|
15 |
-
require_once(__DIR__.'/nova.php');
|
16 |
-
require_once(__DIR__.'/loadbalancer.php');
|
17 |
|
18 |
/**
|
19 |
* The Rackspace Cloud Load Balancers
|
20 |
*
|
21 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
22 |
*/
|
23 |
-
class
|
24 |
|
25 |
const
|
26 |
SERVICE_TYPE = 'rax:load-balancer',
|
@@ -39,7 +36,7 @@ class LoadBalancerService extends Nova {
|
|
39 |
* @param string $region the region of the service (e.g., "DFW" or "LON")
|
40 |
* @param string $urltype the type of URL (normally "publicURL")
|
41 |
*/
|
42 |
-
public function __construct(OpenStack $conn, $name, $region, $urltype) {
|
43 |
parent::__construct($conn, self::SERVICE_TYPE,
|
44 |
$name, $region, $urltype);
|
45 |
}
|
@@ -51,7 +48,7 @@ class LoadBalancerService extends Nova {
|
|
51 |
* @param string $resource the resource required
|
52 |
* @param array $args extra arguments to pass to the URL as query strings
|
53 |
*/
|
54 |
-
public function Url($resource=self::URL_RESOURCE, $args=array()) {
|
55 |
return parent::Url($resource, $args);
|
56 |
}
|
57 |
|
@@ -63,7 +60,7 @@ class LoadBalancerService extends Nova {
|
|
63 |
* @return LoadBalancerService\LoadBalancer
|
64 |
*/
|
65 |
public function LoadBalancer($id=NULL) {
|
66 |
-
return new
|
67 |
}
|
68 |
|
69 |
/**
|
@@ -77,7 +74,7 @@ class LoadBalancerService extends Nova {
|
|
77 |
* @return \OpenCloud\Collection
|
78 |
*/
|
79 |
public function LoadBalancerList($detail=TRUE, $filter=array()) {
|
80 |
-
return $this->Collection('\OpenCloud\
|
81 |
}
|
82 |
|
83 |
/**
|
@@ -88,7 +85,7 @@ class LoadBalancerService extends Nova {
|
|
88 |
* @return LoadBalancerService\LoadBalancer
|
89 |
*/
|
90 |
public function BillableLoadBalancer($id=NULL) {
|
91 |
-
return new
|
92 |
}
|
93 |
|
94 |
/**
|
@@ -103,7 +100,7 @@ class LoadBalancerService extends Nova {
|
|
103 |
*/
|
104 |
public function BillableLoadBalancerList($detail=TRUE, $filter=array()) {
|
105 |
return $this->Collection(
|
106 |
-
'\OpenCloud\
|
107 |
NULL,
|
108 |
NULL,
|
109 |
$filter);
|
@@ -117,31 +114,31 @@ class LoadBalancerService extends Nova {
|
|
117 |
* @return LoadBalancerService\AllowedDomain
|
118 |
*/
|
119 |
public function AllowedDomain($data=NULL) {
|
120 |
-
return new
|
121 |
}
|
122 |
|
123 |
/**
|
124 |
* returns Collection of AllowedDomain object
|
125 |
-
*
|
126 |
* @api
|
127 |
* @return Collection
|
128 |
*/
|
129 |
public function AllowedDomainList() {
|
130 |
return $this->Collection(
|
131 |
-
'\OpenCloud\
|
132 |
}
|
133 |
-
|
134 |
/**
|
135 |
* single protocol (should never be called directly)
|
136 |
*
|
137 |
-
* Convenience method to be used by the ProtocolList Collection.
|
138 |
*
|
139 |
* @return LoadBalancerService\Protocol
|
140 |
*/
|
141 |
public function Protocol($data=NULL) {
|
142 |
-
return new
|
143 |
}
|
144 |
-
|
145 |
/**
|
146 |
* a list of Protocol objects
|
147 |
*
|
@@ -150,7 +147,7 @@ class LoadBalancerService extends Nova {
|
|
150 |
*/
|
151 |
public function ProtocolList() {
|
152 |
return $this->Collection(
|
153 |
-
'\OpenCloud\
|
154 |
}
|
155 |
|
156 |
/**
|
@@ -161,9 +158,9 @@ class LoadBalancerService extends Nova {
|
|
161 |
* @return LoadBalancerService\Algorithm
|
162 |
*/
|
163 |
public function Algorithm($data=NULL) {
|
164 |
-
return new
|
165 |
}
|
166 |
-
|
167 |
/**
|
168 |
* a list of Algorithm objects
|
169 |
*
|
@@ -172,7 +169,7 @@ class LoadBalancerService extends Nova {
|
|
172 |
*/
|
173 |
public function AlgorithmList() {
|
174 |
return $this->Collection(
|
175 |
-
'\OpenCloud\
|
176 |
}
|
177 |
|
178 |
}
|
10 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
11 |
*/
|
12 |
|
13 |
+
namespace OpenCloud\LoadBalancer;
|
|
|
|
|
|
|
14 |
|
15 |
/**
|
16 |
* The Rackspace Cloud Load Balancers
|
17 |
*
|
18 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
19 |
*/
|
20 |
+
class Service extends \OpenCloud\AbstractClass\Nova {
|
21 |
|
22 |
const
|
23 |
SERVICE_TYPE = 'rax:load-balancer',
|
36 |
* @param string $region the region of the service (e.g., "DFW" or "LON")
|
37 |
* @param string $urltype the type of URL (normally "publicURL")
|
38 |
*/
|
39 |
+
public function __construct(\OpenCloud\OpenStack $conn, $name, $region, $urltype) {
|
40 |
parent::__construct($conn, self::SERVICE_TYPE,
|
41 |
$name, $region, $urltype);
|
42 |
}
|
48 |
* @param string $resource the resource required
|
49 |
* @param array $args extra arguments to pass to the URL as query strings
|
50 |
*/
|
51 |
+
public function Url($resource=self::URL_RESOURCE, array $args=array()) {
|
52 |
return parent::Url($resource, $args);
|
53 |
}
|
54 |
|
60 |
* @return LoadBalancerService\LoadBalancer
|
61 |
*/
|
62 |
public function LoadBalancer($id=NULL) {
|
63 |
+
return new LoadBalancer($this, $id);
|
64 |
}
|
65 |
|
66 |
/**
|
74 |
* @return \OpenCloud\Collection
|
75 |
*/
|
76 |
public function LoadBalancerList($detail=TRUE, $filter=array()) {
|
77 |
+
return $this->Collection('\OpenCloud\LoadBalancer\LoadBalancer');
|
78 |
}
|
79 |
|
80 |
/**
|
85 |
* @return LoadBalancerService\LoadBalancer
|
86 |
*/
|
87 |
public function BillableLoadBalancer($id=NULL) {
|
88 |
+
return new BillableLoadBalancer($this, $id);
|
89 |
}
|
90 |
|
91 |
/**
|
100 |
*/
|
101 |
public function BillableLoadBalancerList($detail=TRUE, $filter=array()) {
|
102 |
return $this->Collection(
|
103 |
+
'\OpenCloud\LoadBalancer\BillableLoadBalancer',
|
104 |
NULL,
|
105 |
NULL,
|
106 |
$filter);
|
114 |
* @return LoadBalancerService\AllowedDomain
|
115 |
*/
|
116 |
public function AllowedDomain($data=NULL) {
|
117 |
+
return new AllowedDomain($this, $data);
|
118 |
}
|
119 |
|
120 |
/**
|
121 |
* returns Collection of AllowedDomain object
|
122 |
+
*
|
123 |
* @api
|
124 |
* @return Collection
|
125 |
*/
|
126 |
public function AllowedDomainList() {
|
127 |
return $this->Collection(
|
128 |
+
'\OpenCloud\LoadBalancer\AllowedDomain', NULL, $this);
|
129 |
}
|
130 |
+
|
131 |
/**
|
132 |
* single protocol (should never be called directly)
|
133 |
*
|
134 |
+
* Convenience method to be used by the ProtocolList Collection.
|
135 |
*
|
136 |
* @return LoadBalancerService\Protocol
|
137 |
*/
|
138 |
public function Protocol($data=NULL) {
|
139 |
+
return new Protocol($this, $data);
|
140 |
}
|
141 |
+
|
142 |
/**
|
143 |
* a list of Protocol objects
|
144 |
*
|
147 |
*/
|
148 |
public function ProtocolList() {
|
149 |
return $this->Collection(
|
150 |
+
'\OpenCloud\LoadBalancer\Protocol', NULL, $this);
|
151 |
}
|
152 |
|
153 |
/**
|
158 |
* @return LoadBalancerService\Algorithm
|
159 |
*/
|
160 |
public function Algorithm($data=NULL) {
|
161 |
+
return new Algorithm($this, $data);
|
162 |
}
|
163 |
+
|
164 |
/**
|
165 |
* a list of Algorithm objects
|
166 |
*
|
169 |
*/
|
170 |
public function AlgorithmList() {
|
171 |
return $this->Collection(
|
172 |
+
'\OpenCloud\LoadBalancer\Algorithm', NULL, $this);
|
173 |
}
|
174 |
|
175 |
}
|
sdk/OpenCloud/OpenCloud/ObjectStore/CDNContainer.php
ADDED
@@ -0,0 +1,285 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Containers for OpenStack Object Storage (Swift) and Rackspace Cloud Files
|
4 |
+
*
|
5 |
+
* @copyright 2012-2013 Rackspace Hosting, Inc.
|
6 |
+
* See COPYING for licensing information
|
7 |
+
*
|
8 |
+
* @package phpOpenCloud
|
9 |
+
* @version 1.0
|
10 |
+
* @author Glen Campbell <glen.campbell@rackspace.com>
|
11 |
+
*/
|
12 |
+
|
13 |
+
namespace OpenCloud\ObjectStore;
|
14 |
+
|
15 |
+
use OpenCloud\Base\Lang;
|
16 |
+
use OpenCloud\Base\Exceptions;
|
17 |
+
|
18 |
+
/**
|
19 |
+
* A simple container for the CDN Service
|
20 |
+
*
|
21 |
+
* @author Glen Campbell <glen.campbell@rackspace.com>
|
22 |
+
*/
|
23 |
+
class CDNContainer extends \OpenCloud\AbstractClass\ObjectStore {
|
24 |
+
|
25 |
+
public
|
26 |
+
$name,
|
27 |
+
$count=0,
|
28 |
+
$bytes=0;
|
29 |
+
private
|
30 |
+
$service,
|
31 |
+
$container_url,
|
32 |
+
$_cdn;
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Creates the container object
|
36 |
+
*
|
37 |
+
* Creates a new container object or, if the $cdata object is a string,
|
38 |
+
* retrieves the named container from the object store. If $cdata is an
|
39 |
+
* array or an object, then its values are used to set this object.
|
40 |
+
*
|
41 |
+
* @param OpenCloud\ObjectStore $service - the ObjectStore service
|
42 |
+
* @param mixed $cdata - if supplied, the name of the object
|
43 |
+
*/
|
44 |
+
public function __construct(\OpenCloud\AbstractClass\Service $service, $cdata=NULL) {
|
45 |
+
$this->debug(Lang::translate('Initializing Container...'));
|
46 |
+
parent::__construct();
|
47 |
+
$this->service = $service;
|
48 |
+
|
49 |
+
// set values from an object (via containerlist)
|
50 |
+
if (is_object($cdata)) {
|
51 |
+
foreach($cdata as $name => $value)
|
52 |
+
if ($name == 'metadata')
|
53 |
+
$this->metadata->SetArray($value);
|
54 |
+
else
|
55 |
+
$this->$name = $value;
|
56 |
+
}
|
57 |
+
// or, if it's a string, retrieve the object with that name
|
58 |
+
else if ($cdata) {
|
59 |
+
$this->debug(Lang::translate('Getting container [%s]'), $cdata);
|
60 |
+
$this->name = $cdata;
|
61 |
+
$this->Refresh();
|
62 |
+
}
|
63 |
+
} // __construct()
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Returns the URL of the container
|
67 |
+
*
|
68 |
+
* @return string
|
69 |
+
* @throws NoNameError
|
70 |
+
*/
|
71 |
+
public function Url() {
|
72 |
+
if (!$this->name)
|
73 |
+
throw new \OpenCloud\Base\Exceptions\NoNameError(Lang::translate('Container does not have an identifier'));
|
74 |
+
return Lang::noslash($this->Service()->Url(
|
75 |
+
rawurlencode($this->name)));
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Creates a new container with the specified attributes
|
80 |
+
*
|
81 |
+
* @param array $params array of parameters
|
82 |
+
* @return boolean TRUE on success; FALSE on failure
|
83 |
+
* @throws ContainerCreateError
|
84 |
+
*/
|
85 |
+
public function Create($params=array()) {
|
86 |
+
foreach($params as $name => $value) {
|
87 |
+
switch($name) {
|
88 |
+
case 'name':
|
89 |
+
if ($this->is_valid_name($value))
|
90 |
+
$this->name = $value;
|
91 |
+
break;
|
92 |
+
default:
|
93 |
+
$this->$name = $value;
|
94 |
+
}
|
95 |
+
}
|
96 |
+
$this->container_url = $this->Url();
|
97 |
+
$headers = $this->MetadataHeaders();
|
98 |
+
$response = $this->Service()->Request(
|
99 |
+
$this->Url(),
|
100 |
+
'PUT',
|
101 |
+
$headers
|
102 |
+
);
|
103 |
+
|
104 |
+
// check return code
|
105 |
+
if ($response->HttpStatus() > 202) {
|
106 |
+
throw new \OpenCloud\Base\Exceptions\ContainerCreateError(
|
107 |
+
sprintf(Lang::translate('Problem creating container [%s] status [%d] '.
|
108 |
+
'response [%s]'),
|
109 |
+
$this->Url(),
|
110 |
+
$response->HttpStatus(),
|
111 |
+
$response->HttpBody()));
|
112 |
+
return FALSE;
|
113 |
+
}
|
114 |
+
return TRUE;
|
115 |
+
}
|
116 |
+
|
117 |
+
/**
|
118 |
+
* Updates the metadata for a container
|
119 |
+
*
|
120 |
+
* @return boolean TRUE on success; FALSE on failure
|
121 |
+
* @throws ContainerCreateError
|
122 |
+
*/
|
123 |
+
public function Update() {
|
124 |
+
$headers = $this->MetadataHeaders();
|
125 |
+
$response = $this->Service()->Request(
|
126 |
+
$this->Url(),
|
127 |
+
'POST',
|
128 |
+
$headers
|
129 |
+
);
|
130 |
+
|
131 |
+
// check return code
|
132 |
+
if ($response->HttpStatus() > 204) {
|
133 |
+
throw new \OpenCloud\Base\Exceptions\ContainerCreateError(
|
134 |
+
sprintf(Lang::translate('Problem updating container [%s] status [%d] '.
|
135 |
+
'response [%s]'),
|
136 |
+
$this->Url(),
|
137 |
+
$response->HttpStatus(),
|
138 |
+
$response->HttpBody()));
|
139 |
+
return FALSE;
|
140 |
+
}
|
141 |
+
return TRUE;
|
142 |
+
}
|
143 |
+
|
144 |
+
/**
|
145 |
+
* Deletes the specified container
|
146 |
+
*
|
147 |
+
* @return boolean TRUE on success; FALSE on failure
|
148 |
+
* @throws ContainerDeleteError
|
149 |
+
*/
|
150 |
+
public function Delete() {
|
151 |
+
$response = $this->Service()->Request(
|
152 |
+
$this->Url(),
|
153 |
+
'DELETE'
|
154 |
+
);
|
155 |
+
|
156 |
+
// validate the response code
|
157 |
+
if ($response->HttpStatus() == 404)
|
158 |
+
throw new \OpenCloud\Base\Exceptions\ContainerNotFoundError(sprintf(
|
159 |
+
Lang::translate('Container [%s] not found'), $this->name));
|
160 |
+
|
161 |
+
if ($response->HttpStatus() == 409)
|
162 |
+
throw new \OpenCloud\Base\Exceptions\ContainerNotEmptyError(sprintf(
|
163 |
+
Lang::translate('Container [%s] must be empty before deleting'),
|
164 |
+
$this->name));
|
165 |
+
|
166 |
+
if ($response->HttpStatus() >= 300) {
|
167 |
+
throw new \OpenCloud\Base\Exceptions\ContainerDeleteError(
|
168 |
+
sprintf(Lang::translate('Problem deleting container [%s] status [%d] '.
|
169 |
+
'response [%s]'),
|
170 |
+
$this->Url(),
|
171 |
+
$response->HttpStatus(),
|
172 |
+
$response->HttpBody()));
|
173 |
+
return FALSE;
|
174 |
+
}
|
175 |
+
return TRUE;
|
176 |
+
}
|
177 |
+
|
178 |
+
/**
|
179 |
+
* Creates a Collection of objects in the container
|
180 |
+
*
|
181 |
+
* @param array $params associative array of parameter values.
|
182 |
+
* * account/tenant - The unique identifier of the account/tenant.
|
183 |
+
* * container- The unique identifier of the container.
|
184 |
+
* * limit (Optional) - The number limit of results.
|
185 |
+
* * marker (Optional) - Value of the marker, that the object names
|
186 |
+
* greater in value than are returned.
|
187 |
+
* * end_marker (Optional) - Value of the marker, that the object names
|
188 |
+
* less in value than are returned.
|
189 |
+
* * prefix (Optional) - Value of the prefix, which the returned object
|
190 |
+
* names begin with.
|
191 |
+
* * format (Optional) - Value of the serialized response format, either
|
192 |
+
* json or xml.
|
193 |
+
* * delimiter (Optional) - Value of the delimiter, that all the object
|
194 |
+
* names nested in the container are returned.
|
195 |
+
* @link http://api.openstack.org for a list of possible parameter
|
196 |
+
* names and values
|
197 |
+
* @return OpenCloud\Collection
|
198 |
+
* @throws ObjFetchError
|
199 |
+
*/
|
200 |
+
public function ObjectList($params=array()) {
|
201 |
+
// construct a query string out of the parameters
|
202 |
+
$params['format'] = 'json';
|
203 |
+
$qstring = $this->MakeQueryString($params);
|
204 |
+
|
205 |
+
// append the query string to the URL
|
206 |
+
$url = $this->Url();
|
207 |
+
if (strlen($qstring) > 0)
|
208 |
+
$url .= '?' . $qstring;
|
209 |
+
|
210 |
+
// fetch it
|
211 |
+
return $this->Service()->Collection(
|
212 |
+
'\OpenCloud\ObjectStore\DataObject', $url, $this);
|
213 |
+
} // object_list()
|
214 |
+
|
215 |
+
/**
|
216 |
+
* Returns a new DataObject associated with this container
|
217 |
+
*
|
218 |
+
* @param string $name if supplied, the name of the object to return
|
219 |
+
* @return DataObject
|
220 |
+
*/
|
221 |
+
public function DataObject($name=NULL) {
|
222 |
+
return new DataObject($this, $name);
|
223 |
+
}
|
224 |
+
|
225 |
+
/**
|
226 |
+
* Returns the Service associated with the Container
|
227 |
+
*/
|
228 |
+
public function Service() {
|
229 |
+
return $this->service;
|
230 |
+
}
|
231 |
+
|
232 |
+
/********** PRIVATE METHODS **********/
|
233 |
+
|
234 |
+
/**
|
235 |
+
* Loads the object from the service
|
236 |
+
*
|
237 |
+
* @return void
|
238 |
+
*/
|
239 |
+
protected function Refresh()
|
240 |
+
{
|
241 |
+
$response = $this->Service()->Request($this->Url(), 'HEAD', array('Accept'=>'*/*'));
|
242 |
+
|
243 |
+
// validate the response code
|
244 |
+
if ($this->name != 'TEST') {
|
245 |
+
if ($response->HttpStatus() == 404)
|
246 |
+
throw new \OpenCloud\Base\Exceptions\ContainerNotFoundError(sprintf(
|
247 |
+
Lang::translate('Container [%s] (%s) not found'),
|
248 |
+
$this->name, $this->Url()));
|
249 |
+
|
250 |
+
if ($response->HttpStatus() >= 300)
|
251 |
+
throw new \OpenCloud\Base\Exceptions\HttpError(
|
252 |
+
sprintf(
|
253 |
+
Lang::translate('Error retrieving Container, status [%d]'.
|
254 |
+
' response [%s]'),
|
255 |
+
$response->HttpStatus(),
|
256 |
+
$response->HttpBody()));
|
257 |
+
}
|
258 |
+
// parse the returned object
|
259 |
+
$this->GetMetadata($response);
|
260 |
+
}
|
261 |
+
|
262 |
+
/**
|
263 |
+
* Validates that the container name is acceptable
|
264 |
+
*
|
265 |
+
* @param string $name the container name to validate
|
266 |
+
* @return boolean TRUE if ok; throws an exception if not
|
267 |
+
* @throws ContainerNameError
|
268 |
+
*/
|
269 |
+
private function is_valid_name($name) {
|
270 |
+
if (($name == NULL) || ($name == ''))
|
271 |
+
throw new \OpenCloud\Base\Exceptions\ContainerNameError(
|
272 |
+
Lang::translate('Container name cannot be blank'));
|
273 |
+
if ($name == '0')
|
274 |
+
throw new \OpenCloud\Base\Exceptions\ContainerNameError(
|
275 |
+
Lang::translate('"0" is not a valid container name'));
|
276 |
+
if (strpos($name, '/') !== FALSE)
|
277 |
+
throw new \OpenCloud\Base\Exceptions\ContainerNameError(
|
278 |
+
Lang::translate('Container name cannot contain "/"'));
|
279 |
+
if (strlen($name) > \OpenCloud\ObjectStore\Service::MAX_CONTAINER_NAME_LEN)
|
280 |
+
throw new \OpenCloud\Base\Exceptions\ContainerNameError(
|
281 |
+
Lang::translate('Container name is too long'));
|
282 |
+
return TRUE;
|
283 |
+
}
|
284 |
+
|
285 |
+
} // class CDNContainer
|
sdk/OpenCloud/OpenCloud/ObjectStore/Container.php
ADDED
@@ -0,0 +1,246 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Containers for OpenStack Object Storage (Swift) and Rackspace Cloud Files
|
4 |
+
*
|
5 |
+
* @copyright 2012-2013 Rackspace Hosting, Inc.
|
6 |
+
* See COPYING for licensing information
|
7 |
+
*
|
8 |
+
* @package phpOpenCloud
|
9 |
+
* @version 1.0
|
10 |
+
* @author Glen Campbell <glen.campbell@rackspace.com>
|
11 |
+
*/
|
12 |
+
|
13 |
+
namespace OpenCloud\ObjectStore;
|
14 |
+
|
15 |
+
use OpenCloud\Base\Exceptions;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* A regular container with a (potentially) CDN container
|
19 |
+
*
|
20 |
+
* This is the main entry point; CDN containers should only be used internally.
|
21 |
+
*/
|
22 |
+
class Container extends CDNContainer {
|
23 |
+
|
24 |
+
private
|
25 |
+
$_cdn; // holds the related CDN container (if any)
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Makes the container public via the CDN
|
29 |
+
*
|
30 |
+
* @api
|
31 |
+
* @param integer $TTL the Time-To-Live for the CDN container; if NULL,
|
32 |
+
* then the cloud's default value will be used for caching.
|
33 |
+
* @throws CDNNotAvailableError if CDN services are not available
|
34 |
+
* @return CDNContainer
|
35 |
+
*/
|
36 |
+
public function EnableCDN($TTL=NULL) {
|
37 |
+
$url = $this->Service()->CDN()->Url().'/'.$this->name;
|
38 |
+
$headers = $this->MetadataHeaders();
|
39 |
+
if ($TTL && !is_integer($TTL))
|
40 |
+
throw new \OpenCloud\Base\Exceptions\CdnTtlError(sprintf(
|
41 |
+
\OpenCloud\Base\Lang::translate('TTL value [%s] must be an integer'), $TTL));
|
42 |
+
if ($TTL)
|
43 |
+
$headers['X-TTL'] = $TTL;
|
44 |
+
$headers['X-Log-Retention'] = 'True';
|
45 |
+
$headers['X-CDN-Enabled'] = 'True';
|
46 |
+
|
47 |
+
// PUT to the CDN container
|
48 |
+
$response = $this->Service()->Request($url, 'PUT', $headers);
|
49 |
+
|
50 |
+
// check the response status
|
51 |
+
if ($response->HttpStatus() > 202)
|
52 |
+
throw new \OpenCloud\Base\Exceptions\CdnHttpError(sprintf(
|
53 |
+
\OpenCloud\Base\Lang::translate('HTTP error publishing to CDN, status [%d] response [%s]'),
|
54 |
+
$response->HttpStatus(), $response->HttpBody()));
|
55 |
+
|
56 |
+
// refresh the data
|
57 |
+
$this->Refresh();
|
58 |
+
|
59 |
+
// return the CDN container object
|
60 |
+
$this->_cdn = new CDNContainer($this->Service()->CDN(), $this->name);
|
61 |
+
return $this->CDN();
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* a synonym for PublishToCDN for backwards-compatibility
|
66 |
+
*
|
67 |
+
* @api
|
68 |
+
*/
|
69 |
+
public function PublishToCDN($TTL=NULL) {
|
70 |
+
return $this->EnableCDN($TTL);
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Disables the containers CDN function.
|
75 |
+
*
|
76 |
+
* Note that the container will still be available on the CDN until
|
77 |
+
* its TTL expires.
|
78 |
+
*
|
79 |
+
* @api
|
80 |
+
* @return void
|
81 |
+
*/
|
82 |
+
public function DisableCDN() {
|
83 |
+
$headers['X-Log-Retention'] = 'False';
|
84 |
+
$headers['X-CDN-Enabled'] = 'False';
|
85 |
+
|
86 |
+
// PUT it to the CDN service
|
87 |
+
$response = $this->Service()->Request($this->CDNURL(), 'PUT', $headers);
|
88 |
+
|
89 |
+
// check the response status
|
90 |
+
if ($response->HttpStatus() != 201)
|
91 |
+
throw new \OpenCloud\Base\Exceptions\CdnHttpError(sprintf(
|
92 |
+
\OpenCloud\Base\Lang::translate('HTTP error disabling CDN, status [%d] response [%s]'),
|
93 |
+
$response->HttpStatus(), $response->HttpBody()));
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Creates a static website from the container
|
98 |
+
*
|
99 |
+
* @api
|
100 |
+
* @link http://docs.rackspace.com/files/api/v1/cf-devguide/content/Create_Static_Website-dle4000.html
|
101 |
+
* @param string $index the index page (starting page) of the website
|
102 |
+
* @return \OpenCloud\HttpResponse
|
103 |
+
*/
|
104 |
+
public function CreateStaticSite($index) {
|
105 |
+
$headers = array('X-Container-Meta-Web-Index'=>$index);
|
106 |
+
$response = $this->Service()->Request($this->Url(), 'POST', $headers);
|
107 |
+
|
108 |
+
// check return code
|
109 |
+
if ($response->HttpStatus() > 204)
|
110 |
+
throw new \OpenCloud\Base\Exceptions\ContainerError(sprintf(
|
111 |
+
\OpenCloud\Base\Lang::translate('Error creating static website for [%s], status [%d] response [%s]'),
|
112 |
+
$this->name, $response->HttpStatus(), $response->HttpBody()));
|
113 |
+
|
114 |
+
return $response;
|
115 |
+
}
|
116 |
+
|
117 |
+
/**
|
118 |
+
* Sets the error page(s) for the static website
|
119 |
+
*
|
120 |
+
* @api
|
121 |
+
* @link http://docs.rackspace.com/files/api/v1/cf-devguide/content/Set_Error_Pages_for_Static_Website-dle4005.html
|
122 |
+
* @param string $name the name of the error page
|
123 |
+
* @return \OpenCloud\HttpResponse
|
124 |
+
*/
|
125 |
+
public function StaticSiteErrorPage($name) {
|
126 |
+
$headers = array('X-Container-Meta-Web-Error'=>$name);
|
127 |
+
$response = $this->Service()->Request($this->Url(), 'POST', $headers);
|
128 |
+
|
129 |
+
// check return code
|
130 |
+
if ($response->HttpStatus() > 204)
|
131 |
+
throw new \OpenCloud\Base\Exceptions\ContainerError(sprintf(
|
132 |
+
\OpenCloud\Base\Lang::translate('Error creating static site error page for [%s], '.
|
133 |
+
'status [%d] response [%s]'),
|
134 |
+
$this->name, $response->HttpStatus(), $response->HttpBody()));
|
135 |
+
|
136 |
+
return $response;
|
137 |
+
}
|
138 |
+
|
139 |
+
/**
|
140 |
+
* Returns the CDN service associated with this container.
|
141 |
+
*/
|
142 |
+
public function CDN() {
|
143 |
+
$cdn = $this->_cdn;
|
144 |
+
if (!$cdn)
|
145 |
+
throw new \OpenCloud\Base\Exceptions\CdnNotAvailableError(\OpenCloud\Base\Lang::translate('CDN service is not available'));
|
146 |
+
return $cdn;
|
147 |
+
}
|
148 |
+
|
149 |
+
/**
|
150 |
+
* Returns the CDN URL of the container (if enabled)
|
151 |
+
*
|
152 |
+
* The CDNURL() is used to manage the container. Note that it is different
|
153 |
+
* from the PublicURL() of the container, which is the publicly-accessible
|
154 |
+
* URL on the network.
|
155 |
+
*
|
156 |
+
* @api
|
157 |
+
* @return string
|
158 |
+
*/
|
159 |
+
public function CDNURL() {
|
160 |
+
return $this->CDN()->Url();
|
161 |
+
}
|
162 |
+
|
163 |
+
/**
|
164 |
+
* Returns the Public URL of the container (on the CDN network)
|
165 |
+
*
|
166 |
+
*/
|
167 |
+
public function PublicURL() {
|
168 |
+
// return $this->CDNURI().'/'.$this->name;
|
169 |
+
return $this->CDNURI();
|
170 |
+
}
|
171 |
+
|
172 |
+
/**
|
173 |
+
* Returns the CDN info about the container
|
174 |
+
*
|
175 |
+
* @api
|
176 |
+
* @return stdClass
|
177 |
+
*/
|
178 |
+
public function CDNinfo($prop=NULL) {
|
179 |
+
|
180 |
+
// return NULL if the CDN container is not enabled
|
181 |
+
if (!isset($this->CDN()->metadata->Enabled))
|
182 |
+
return NULL;
|
183 |
+
if (!$this->CDN()->metadata->Enabled)
|
184 |
+
return NULL;
|
185 |
+
|
186 |
+
// check to see if it's set
|
187 |
+
if (isset($this->CDN()->metadata->$prop))
|
188 |
+
return trim($this->CDN()->metadata->$prop);
|
189 |
+
else if (isset($prop))
|
190 |
+
return NULL;
|
191 |
+
|
192 |
+
// otherwise, return the whole metadata object
|
193 |
+
return $this->CDN()->metadata;
|
194 |
+
}
|
195 |
+
|
196 |
+
/**
|
197 |
+
* Returns the CDN container URI prefix
|
198 |
+
*
|
199 |
+
* @api
|
200 |
+
* @return string
|
201 |
+
*/
|
202 |
+
public function CDNURI() {
|
203 |
+
return $this->CDNinfo('Uri');
|
204 |
+
}
|
205 |
+
|
206 |
+
/**
|
207 |
+
* Returns the SSL URI for the container
|
208 |
+
*
|
209 |
+
* @api
|
210 |
+
* @return string
|
211 |
+
*/
|
212 |
+
public function SSLURI() {
|
213 |
+
return $this->CDNinfo('Ssl-Uri');
|
214 |
+
}
|
215 |
+
|
216 |
+
/**
|
217 |
+
* Returns the streaming URI for the container
|
218 |
+
*
|
219 |
+
* @api
|
220 |
+
* @return string
|
221 |
+
*/
|
222 |
+
public function StreamingURI() {
|
223 |
+
return $this->CDNinfo('Streaming-Uri');
|
224 |
+
}
|
225 |
+
|
226 |
+
/**
|
227 |
+
* Refreshes, then associates the CDN container
|
228 |
+
*/
|
229 |
+
protected function Refresh() {
|
230 |
+
parent::Refresh();
|
231 |
+
|
232 |
+
// find the CDN object
|
233 |
+
$cdn = $this->Service()->CDN();
|
234 |
+
if (isset($cdn)) {
|
235 |
+
try {
|
236 |
+
$this->_cdn = new CDNContainer(
|
237 |
+
$this->Service()->CDN(),
|
238 |
+
$this->name
|
239 |
+
);
|
240 |
+
} catch (\OpenCloud\Base\Exceptions\ContainerNotFoundError $e) {
|
241 |
+
$this->_cdn = new CDNContainer($cdn);
|
242 |
+
$this->_cdn->name = $this->name;
|
243 |
+
}
|
244 |
+
}
|
245 |
+
}
|
246 |
+
} // class Container
|
sdk/OpenCloud/{dataobject.php → OpenCloud/ObjectStore/DataObject.php}
RENAMED
@@ -12,9 +12,7 @@
|
|
12 |
|
13 |
namespace OpenCloud\ObjectStore;
|
14 |
|
15 |
-
|
16 |
-
require_once(__DIR__.'/container.php');
|
17 |
-
require_once(__DIR__.'/objstorebase.php');
|
18 |
|
19 |
/**
|
20 |
* A DataObject is an object in the ObjectStore
|
@@ -24,7 +22,7 @@ require_once(__DIR__.'/objstorebase.php');
|
|
24 |
*
|
25 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
26 |
*/
|
27 |
-
class DataObject extends
|
28 |
|
29 |
public
|
30 |
$name, // the object name
|
@@ -32,7 +30,8 @@ class DataObject extends ObjStoreBase {
|
|
32 |
$bytes, // size of object in bytes
|
33 |
$last_modified, // date of last modification
|
34 |
$content_type, // Content-Type:
|
35 |
-
$content_length
|
|
|
36 |
|
37 |
private
|
38 |
$data, // the actual data
|
@@ -87,8 +86,8 @@ class DataObject extends ObjStoreBase {
|
|
87 |
*/
|
88 |
public function Url() {
|
89 |
if (!$this->name)
|
90 |
-
throw new NoNameError(
|
91 |
-
return noslash($this->container->Url()) . '/' .
|
92 |
str_replace('%2F', '/', rawurlencode($this->name));
|
93 |
|
94 |
}
|
@@ -98,7 +97,7 @@ class DataObject extends ObjStoreBase {
|
|
98 |
*
|
99 |
* @api
|
100 |
* @param array $params an optional associative array that can contain the
|
101 |
-
* 'name' and '
|
102 |
* @param string $filename if provided, then the object is loaded from the
|
103 |
* specified file
|
104 |
* @return boolean
|
@@ -113,19 +112,20 @@ class DataObject extends ObjStoreBase {
|
|
113 |
if ($filename) {
|
114 |
$fp = @fopen($filename, 'r');
|
115 |
if (!$fp) {
|
116 |
-
throw new IOError(sprintf(
|
117 |
-
|
118 |
}
|
119 |
|
120 |
clearstatcache(TRUE, $filename);
|
121 |
|
122 |
$filesize = (float) sprintf("%u", filesize($filename));
|
123 |
-
if ($filesize > \OpenCloud\ObjectStore::MAX_OBJECT_SIZE) {
|
124 |
-
throw new ObjectError("File size exceeds maximum object size.");
|
125 |
}
|
126 |
$this->content_length = $filesize;
|
127 |
|
128 |
-
$this->
|
|
|
129 |
/*
|
130 |
$this->write($fp, $size, $verify);
|
131 |
fclose($fp);
|
@@ -139,8 +139,8 @@ class DataObject extends ObjStoreBase {
|
|
139 |
}
|
140 |
|
141 |
// flag missing Content-Type
|
142 |
-
if (
|
143 |
-
|
144 |
|
145 |
// set the headers
|
146 |
$headers = $this->MetadataHeaders();
|
@@ -149,6 +149,13 @@ class DataObject extends ObjStoreBase {
|
|
149 |
$headers['Content-Type'] = $this->content_type;
|
150 |
$headers['Content-Length'] = $this->content_length;
|
151 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
// perform the request
|
153 |
$response = $this->Service()->Request(
|
154 |
$this->Url(),
|
@@ -159,9 +166,9 @@ class DataObject extends ObjStoreBase {
|
|
159 |
|
160 |
// check the status
|
161 |
if (($stat=$response->HttpStatus()) >= 300) {
|
162 |
-
throw new CreateUpdateError(
|
163 |
sprintf(
|
164 |
-
|
165 |
'response [%s]'),
|
166 |
$this->Url(),
|
167 |
$stat,
|
@@ -200,6 +207,43 @@ class DataObject extends ObjStoreBase {
|
|
200 |
return $this->Create($params, $filename);
|
201 |
}
|
202 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
203 |
/**
|
204 |
* Deletes an object from the Object Store
|
205 |
*
|
@@ -220,9 +264,9 @@ class DataObject extends ObjStoreBase {
|
|
220 |
|
221 |
// check the status
|
222 |
if (($stat=$response->HttpStatus()) >= 300) {
|
223 |
-
throw new DeleteError(
|
224 |
sprintf(
|
225 |
-
|
226 |
' response [%s]'),
|
227 |
$this->Url(),
|
228 |
$stat,
|
@@ -252,8 +296,8 @@ class DataObject extends ObjStoreBase {
|
|
252 |
|
253 |
// check response code
|
254 |
if ($response->HttpStatus() > 202)
|
255 |
-
throw new ObjectCopyError(sprintf(
|
256 |
-
|
257 |
$this->Url(), $response->HttpStatus(), $response->HttpBody()));
|
258 |
|
259 |
return $response;
|
@@ -296,18 +340,19 @@ class DataObject extends ObjStoreBase {
|
|
296 |
case 'PUT':
|
297 |
break;
|
298 |
default:
|
299 |
-
throw new TempUrlMethodError(sprintf(
|
300 |
-
|
301 |
$method));
|
302 |
}
|
303 |
|
304 |
// construct the URL
|
305 |
$url = $this->Url();
|
306 |
$path = parse_url($url, PHP_URL_PATH);
|
|
|
|
|
|
|
307 |
$temp_url = sprintf('%s?temp_url_sig=%s&temp_url_expires=%d',
|
308 |
-
$url,
|
309 |
-
hash_hmac('sha1', "$method\n$expires\n$path", $secret),
|
310 |
-
$expiry_time);
|
311 |
|
312 |
// debug that stuff
|
313 |
$this->debug('TempUrl generated [%s]', $temp_url);
|
@@ -366,8 +411,8 @@ class DataObject extends ObjStoreBase {
|
|
366 |
{
|
367 |
$fp = @fopen($filename, "wb");
|
368 |
if (!$fp) {
|
369 |
-
throw new IOError(sprintf(
|
370 |
-
|
371 |
}
|
372 |
$result = $this->Service()->Request(
|
373 |
$this->Url(),
|
@@ -410,15 +455,15 @@ class DataObject extends ObjStoreBase {
|
|
410 |
public function PurgeCDN($email) {
|
411 |
$cdn = $this->Container()->CDNURL();
|
412 |
if (!$cdn)
|
413 |
-
throw new CdnError(
|
414 |
$url = $cdn . '/' . $this->name;
|
415 |
$headers['X-Purge-Email'] = $email;
|
416 |
$response = $this->Service()->Request($url, 'DELETE', $headers);
|
417 |
|
418 |
// check the status
|
419 |
if ($response->HttpStatus() > 204)
|
420 |
-
throw new CdnHttpError(sprintf(
|
421 |
-
|
422 |
$response->HttpStatus(),
|
423 |
$response->HttpBody()));
|
424 |
}
|
@@ -474,15 +519,18 @@ class DataObject extends ObjStoreBase {
|
|
474 |
$this->name = $value;
|
475 |
break;
|
476 |
case 'type':
|
477 |
-
throw new UnknownParameterError(
|
478 |
-
|
479 |
case 'content_type':
|
480 |
$this->content_type = $value;
|
481 |
break;
|
|
|
|
|
|
|
482 |
default:
|
483 |
-
throw new UnknownParameterError(
|
484 |
sprintf(
|
485 |
-
|
486 |
$item,
|
487 |
$this->Url()));
|
488 |
}
|
@@ -497,7 +545,7 @@ class DataObject extends ObjStoreBase {
|
|
497 |
*/
|
498 |
private function Fetch() {
|
499 |
if (!$this->name)
|
500 |
-
throw new NoNameError(
|
501 |
|
502 |
$response = $this->Service()->Request(
|
503 |
$this->Url(), 'HEAD', array('Accept'=>'*/*'));
|
@@ -505,11 +553,14 @@ class DataObject extends ObjStoreBase {
|
|
505 |
|
506 |
// check for errors
|
507 |
if ($response->HttpStatus() >= 300) {
|
508 |
-
throw new ObjFetchError(
|
509 |
-
sprintf(
|
510 |
return FALSE;
|
511 |
}
|
512 |
|
|
|
|
|
|
|
513 |
// set headers as metadata?
|
514 |
foreach($response->Headers() as $header => $value) {
|
515 |
switch($header) {
|
@@ -520,6 +571,7 @@ class DataObject extends ObjStoreBase {
|
|
520 |
$this->content_length = $value;
|
521 |
break;
|
522 |
default:
|
|
|
523 |
break;
|
524 |
}
|
525 |
}
|
@@ -600,7 +652,7 @@ class DataObject extends ObjStoreBase {
|
|
600 |
}
|
601 |
|
602 |
if (!$this->content_type) {
|
603 |
-
throw new NoContentTypeError(
|
604 |
}
|
605 |
return TRUE;
|
606 |
}
|
12 |
|
13 |
namespace OpenCloud\ObjectStore;
|
14 |
|
15 |
+
use OpenCloud\Base\Lang;
|
|
|
|
|
16 |
|
17 |
/**
|
18 |
* A DataObject is an object in the ObjectStore
|
22 |
*
|
23 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
24 |
*/
|
25 |
+
class DataObject extends \OpenCloud\AbstractClass\ObjectStore {
|
26 |
|
27 |
public
|
28 |
$name, // the object name
|
30 |
$bytes, // size of object in bytes
|
31 |
$last_modified, // date of last modification
|
32 |
$content_type, // Content-Type:
|
33 |
+
$content_length, // Content-Length:
|
34 |
+
$extra_headers; // Other headers, eg. Access-Control-Allow-Origin:
|
35 |
|
36 |
private
|
37 |
$data, // the actual data
|
86 |
*/
|
87 |
public function Url() {
|
88 |
if (!$this->name)
|
89 |
+
throw new \OpenCloud\Base\Exceptions\NoNameError(Lang::translate('Object has no name'));
|
90 |
+
return Lang::noslash($this->container->Url()) . '/' .
|
91 |
str_replace('%2F', '/', rawurlencode($this->name));
|
92 |
|
93 |
}
|
97 |
*
|
98 |
* @api
|
99 |
* @param array $params an optional associative array that can contain the
|
100 |
+
* 'name' and 'content_type' of the object
|
101 |
* @param string $filename if provided, then the object is loaded from the
|
102 |
* specified file
|
103 |
* @return boolean
|
112 |
if ($filename) {
|
113 |
$fp = @fopen($filename, 'r');
|
114 |
if (!$fp) {
|
115 |
+
throw new \OpenCloud\Base\Exceptions\IOError(sprintf(
|
116 |
+
Lang::translate('Could not open file [%s] for reading'), $filename));
|
117 |
}
|
118 |
|
119 |
clearstatcache(TRUE, $filename);
|
120 |
|
121 |
$filesize = (float) sprintf("%u", filesize($filename));
|
122 |
+
if ($filesize > \OpenCloud\ObjectStore\Service::MAX_OBJECT_SIZE) {
|
123 |
+
throw new \OpenCloud\Base\Exceptions\ObjectError("File size exceeds maximum object size.");
|
124 |
}
|
125 |
$this->content_length = $filesize;
|
126 |
|
127 |
+
if (empty($this->content_type))
|
128 |
+
$this->_guess_content_type($filename);
|
129 |
/*
|
130 |
$this->write($fp, $size, $verify);
|
131 |
fclose($fp);
|
139 |
}
|
140 |
|
141 |
// flag missing Content-Type
|
142 |
+
if (empty($this->content_type))
|
143 |
+
$this->content_type = 'application/octet-stream';
|
144 |
|
145 |
// set the headers
|
146 |
$headers = $this->MetadataHeaders();
|
149 |
$headers['Content-Type'] = $this->content_type;
|
150 |
$headers['Content-Length'] = $this->content_length;
|
151 |
|
152 |
+
// copy any extra headers
|
153 |
+
if (!empty($this->extra_headers) ) {
|
154 |
+
foreach ($this->extra_headers as $header=>$value) {
|
155 |
+
$headers[$header] = $value;
|
156 |
+
}
|
157 |
+
}
|
158 |
+
|
159 |
// perform the request
|
160 |
$response = $this->Service()->Request(
|
161 |
$this->Url(),
|
166 |
|
167 |
// check the status
|
168 |
if (($stat=$response->HttpStatus()) >= 300) {
|
169 |
+
throw new \OpenCloud\Base\Exceptions\CreateUpdateError(
|
170 |
sprintf(
|
171 |
+
Lang::translate('Problem saving/updating object [%s] HTTP status [%s] '.
|
172 |
'response [%s]'),
|
173 |
$this->Url(),
|
174 |
$stat,
|
207 |
return $this->Create($params, $filename);
|
208 |
}
|
209 |
|
210 |
+
/**
|
211 |
+
* UpdateMetadata() - updates headers
|
212 |
+
*
|
213 |
+
* Updates metadata headers
|
214 |
+
*
|
215 |
+
* @api
|
216 |
+
* @param array $params an optional associative array that can contain the
|
217 |
+
* 'name' and 'type' of the object
|
218 |
+
* @return boolean
|
219 |
+
*/
|
220 |
+
public function UpdateMetadata($params=array()) {
|
221 |
+
$this->SetParams($params);
|
222 |
+
|
223 |
+
// set the headers
|
224 |
+
$headers = $this->MetadataHeaders();
|
225 |
+
$headers['Content-Type'] = $this->content_type;
|
226 |
+
|
227 |
+
$response = $this->Service()->Request(
|
228 |
+
$this->Url(),
|
229 |
+
'POST',
|
230 |
+
$headers
|
231 |
+
);
|
232 |
+
|
233 |
+
// check the status
|
234 |
+
if (($stat=$response->HttpStatus()) >= 204) {
|
235 |
+
throw new \OpenCloud\Base\Exceptions\UpdateError(
|
236 |
+
sprintf(
|
237 |
+
Lang::translate('Problem updating object [%s] HTTP status [%s]'.
|
238 |
+
' response [%s]'),
|
239 |
+
$this->Url(),
|
240 |
+
$stat,
|
241 |
+
$response->HttpBody()));
|
242 |
+
return FALSE;
|
243 |
+
}
|
244 |
+
return $response;
|
245 |
+
}
|
246 |
+
|
247 |
/**
|
248 |
* Deletes an object from the Object Store
|
249 |
*
|
264 |
|
265 |
// check the status
|
266 |
if (($stat=$response->HttpStatus()) >= 300) {
|
267 |
+
throw new \OpenCloud\Base\Exceptions\DeleteError(
|
268 |
sprintf(
|
269 |
+
Lang::translate('Problem deleting object [%s] HTTP status [%s]'.
|
270 |
' response [%s]'),
|
271 |
$this->Url(),
|
272 |
$stat,
|
296 |
|
297 |
// check response code
|
298 |
if ($response->HttpStatus() > 202)
|
299 |
+
throw new \OpenCloud\Base\Exceptions\ObjectCopyError(sprintf(
|
300 |
+
Lang::translate('Error copying object [%s], status [%d] response [%s]'),
|
301 |
$this->Url(), $response->HttpStatus(), $response->HttpBody()));
|
302 |
|
303 |
return $response;
|
340 |
case 'PUT':
|
341 |
break;
|
342 |
default:
|
343 |
+
throw new \OpenCloud\Base\Exceptions\TempUrlMethodError(sprintf(
|
344 |
+
Lang::translate('Bad method [%s] for TempUrl; only GET or PUT supported'),
|
345 |
$method));
|
346 |
}
|
347 |
|
348 |
// construct the URL
|
349 |
$url = $this->Url();
|
350 |
$path = parse_url($url, PHP_URL_PATH);
|
351 |
+
$hmac_body = "$method\n$expiry_time\n$path";
|
352 |
+
$hash = hash_hmac('sha1', $hmac_body, $secret);
|
353 |
+
$this->debug('URL [%s] SIG [%s] HASH [%s]', $url, $hmac_body, $hash);
|
354 |
$temp_url = sprintf('%s?temp_url_sig=%s&temp_url_expires=%d',
|
355 |
+
$url, $hash, $expiry_time);
|
|
|
|
|
356 |
|
357 |
// debug that stuff
|
358 |
$this->debug('TempUrl generated [%s]', $temp_url);
|
411 |
{
|
412 |
$fp = @fopen($filename, "wb");
|
413 |
if (!$fp) {
|
414 |
+
throw new \OpenCloud\Base\Exceptions\IOError(sprintf(
|
415 |
+
Lang::translate('Could not open file [%s] for writing'), $filename));
|
416 |
}
|
417 |
$result = $this->Service()->Request(
|
418 |
$this->Url(),
|
455 |
public function PurgeCDN($email) {
|
456 |
$cdn = $this->Container()->CDNURL();
|
457 |
if (!$cdn)
|
458 |
+
throw new \OpenCloud\Base\Exceptions\CdnError(Lang::translate('Container is not CDN-enabled'));
|
459 |
$url = $cdn . '/' . $this->name;
|
460 |
$headers['X-Purge-Email'] = $email;
|
461 |
$response = $this->Service()->Request($url, 'DELETE', $headers);
|
462 |
|
463 |
// check the status
|
464 |
if ($response->HttpStatus() > 204)
|
465 |
+
throw new \OpenCloud\Base\Exceptions\CdnHttpError(sprintf(
|
466 |
+
Lang::translate('Error purging object, status [%d] response [%s]'),
|
467 |
$response->HttpStatus(),
|
468 |
$response->HttpBody()));
|
469 |
}
|
519 |
$this->name = $value;
|
520 |
break;
|
521 |
case 'type':
|
522 |
+
throw new \OpenCloud\Base\Exceptions\UnknownParameterError(
|
523 |
+
Lang::translate('Parameter [type] is deprecated; use "content_type"'));
|
524 |
case 'content_type':
|
525 |
$this->content_type = $value;
|
526 |
break;
|
527 |
+
case 'extra_headers':
|
528 |
+
$this->extra_headers = $value;
|
529 |
+
break;
|
530 |
default:
|
531 |
+
throw new \OpenCloud\Base\Exceptions\UnknownParameterError(
|
532 |
sprintf(
|
533 |
+
Lang::translate('Unrecognized parameter [%s] for object [%s]'),
|
534 |
$item,
|
535 |
$this->Url()));
|
536 |
}
|
545 |
*/
|
546 |
private function Fetch() {
|
547 |
if (!$this->name)
|
548 |
+
throw new \OpenCloud\Base\Exceptions\NoNameError(Lang::translate('Cannot retrieve an unnamed object'));
|
549 |
|
550 |
$response = $this->Service()->Request(
|
551 |
$this->Url(), 'HEAD', array('Accept'=>'*/*'));
|
553 |
|
554 |
// check for errors
|
555 |
if ($response->HttpStatus() >= 300) {
|
556 |
+
throw new \OpenCloud\Base\Exceptions\ObjFetchError(
|
557 |
+
sprintf(Lang::translate('Problem retrieving object [%s]'), $this->Url()));
|
558 |
return FALSE;
|
559 |
}
|
560 |
|
561 |
+
if(!isset($this->extra_headers))
|
562 |
+
$this->extra_headers = array();
|
563 |
+
|
564 |
// set headers as metadata?
|
565 |
foreach($response->Headers() as $header => $value) {
|
566 |
switch($header) {
|
571 |
$this->content_length = $value;
|
572 |
break;
|
573 |
default:
|
574 |
+
$this->extra_headers[$header] = $value;
|
575 |
break;
|
576 |
}
|
577 |
}
|
652 |
}
|
653 |
|
654 |
if (!$this->content_type) {
|
655 |
+
throw new \OpenCloud\Base\Exceptions\NoContentTypeError(Lang::translate('Required Content-Type not set'));
|
656 |
}
|
657 |
return TRUE;
|
658 |
}
|
sdk/OpenCloud/OpenCloud/ObjectStore/ObjectStoreBase.php
ADDED
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* The Object Storage service
|
4 |
+
*
|
5 |
+
* @copyright 2012-2013 Rackspace Hosting, Inc.
|
6 |
+
* See COPYING for licensing information
|
7 |
+
*
|
8 |
+
* @package phpOpenCloud
|
9 |
+
* @version 1.0
|
10 |
+
* @author Glen Campbell <glen.campbell@rackspace.com>
|
11 |
+
*/
|
12 |
+
|
13 |
+
namespace OpenCloud\ObjectStore;
|
14 |
+
|
15 |
+
use OpenCloud\Base\Lang;
|
16 |
+
|
17 |
+
define('SWIFT_MAX_OBJECT_SIZE', 5*1024*1024*1024+1);
|
18 |
+
|
19 |
+
/**
|
20 |
+
* A base class for common code shared between the ObjectStore and
|
21 |
+
* ObjectStoreCDN
|
22 |
+
* objects
|
23 |
+
*
|
24 |
+
* @author Glen Campbell <glen.campbell@rackspace.com>
|
25 |
+
*/
|
26 |
+
class ObjectStoreBase extends \OpenCloud\AbstractClass\Service {
|
27 |
+
|
28 |
+
const MAX_CONTAINER_NAME_LEN = 256;
|
29 |
+
const MAX_OBJECT_NAME_LEN = 1024;
|
30 |
+
const MAX_OBJECT_SIZE = SWIFT_MAX_OBJECT_SIZE;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Creates a Container object associated with the ObjectStore
|
34 |
+
*
|
35 |
+
* This is a factory method and should generally be used instead of
|
36 |
+
* calling the Container class directly.
|
37 |
+
*
|
38 |
+
* @param mixed $cdata (optional) the name of the container (if string)
|
39 |
+
* or an object from which to set values
|
40 |
+
* @return ObjectStore\Container
|
41 |
+
*/
|
42 |
+
public function Container($cdata = NULL)
|
43 |
+
{
|
44 |
+
return new Container($this, $cdata);
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Returns a Collection of Container objects
|
49 |
+
*
|
50 |
+
* This is a factory method and should generally be used instead of
|
51 |
+
* calling the ContainerList class directly.
|
52 |
+
*
|
53 |
+
* @param array $filter a list of key-value pairs to pass to the
|
54 |
+
* service to filter the results
|
55 |
+
* @return ObjectStore\ContainerList
|
56 |
+
*/
|
57 |
+
public function ContainerList(array $filter = array())
|
58 |
+
{
|
59 |
+
$filter['format'] = 'json';
|
60 |
+
return $this->Collection(
|
61 |
+
'\OpenCloud\ObjectStore\Container',
|
62 |
+
$this->Url(NULL, $filter)
|
63 |
+
);
|
64 |
+
}
|
65 |
+
|
66 |
+
}
|
sdk/OpenCloud/OpenCloud/ObjectStore/ObjectStoreCDN.php
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\ObjectStore;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* This is the CDN related to the ObjectStore
|
7 |
+
*
|
8 |
+
* This is intended for Rackspace customers, so it almost certainly will
|
9 |
+
* not work for other public clouds.
|
10 |
+
*
|
11 |
+
* @param OpenCloud\OpenStack $conn a connection object
|
12 |
+
* @param string $serviceName the name of the service to use
|
13 |
+
* @param string $serviceRegion the name of the service region to use
|
14 |
+
* @param string $urltype the type of URL to use (usually "publicURL")
|
15 |
+
*/
|
16 |
+
class ObjectStoreCDN extends ObjectStoreBase {
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Creates a new ObjectStoreCDN object
|
20 |
+
*
|
21 |
+
* This is a simple wrapper function around the parent Service construct,
|
22 |
+
* but supplies defaults for the service type.
|
23 |
+
*
|
24 |
+
* @param OpenStack $conn the connection object
|
25 |
+
* @param string $serviceName the name of the service
|
26 |
+
* @param string $serviceRegion the service's region
|
27 |
+
* @param string $urlType the type of URL (normally 'publicURL')
|
28 |
+
*/
|
29 |
+
public function __construct(
|
30 |
+
\OpenCloud\OpenStack $conn,
|
31 |
+
$serviceName=RAXSDK_OBJSTORE_NAME,
|
32 |
+
$serviceRegion=RAXSDK_OBJSTORE_REGION,
|
33 |
+
$urltype=RAXSDK_OBJSTORE_URLTYPE) {
|
34 |
+
|
35 |
+
// call the parent contructor
|
36 |
+
parent::__construct(
|
37 |
+
$conn,
|
38 |
+
'rax:object-cdn',
|
39 |
+
$serviceName,
|
40 |
+
$serviceRegion,
|
41 |
+
$urltype
|
42 |
+
);
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Helps catch errors if someone calls the method on the
|
47 |
+
* wrong object
|
48 |
+
*/
|
49 |
+
public function CDN() {
|
50 |
+
throw new \OpenCloud\Base\Exceptions\CdnError(
|
51 |
+
\OpenCloud\Base\Lang::translate('Invalid method call; no CDN() on the CDN object'));
|
52 |
+
}
|
53 |
+
}
|
sdk/OpenCloud/OpenCloud/ObjectStore/Service.php
ADDED
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace OpenCloud\ObjectStore;
|
4 |
+
|
5 |
+
use OpenCloud\Base\Lang;
|
6 |
+
|
7 |
+
/**
|
8 |
+
* ObjectStore - this defines the object-store (Cloud Files) service.
|
9 |
+
*
|
10 |
+
* Usage:
|
11 |
+
* <code>
|
12 |
+
* $conn = new OpenStack('{URL}', '{SECRET}');
|
13 |
+
* $ostore = new OpenCloud\ObjectStore(
|
14 |
+
* $conn,
|
15 |
+
* 'service name',
|
16 |
+
* 'service region',
|
17 |
+
* 'URL type'
|
18 |
+
* );
|
19 |
+
* </code>
|
20 |
+
*
|
21 |
+
* Default values for service name, service region, and urltype can be
|
22 |
+
* provided via the global constants RAXSDK_OBJSTORE_NAME,
|
23 |
+
* RAXSDK_OBJSTORE_REGION, and RAXSDK_OBJSTORE_URLTYPE.
|
24 |
+
*
|
25 |
+
* @author Glen Campbell <glen.campbell@rackspace.com>
|
26 |
+
*/
|
27 |
+
|
28 |
+
class Service extends ObjectStoreBase {
|
29 |
+
|
30 |
+
/**
|
31 |
+
* This holds the associated CDN object (for Rackspace public cloud)
|
32 |
+
* or is NULL otherwise. The existence of an object here is
|
33 |
+
* indicative that the CDN service is available.
|
34 |
+
*/
|
35 |
+
private $cdn;
|
36 |
+
|
37 |
+
/**
|
38 |
+
* creates a new ObjectStore object
|
39 |
+
*
|
40 |
+
* @param OpenCloud\OpenStack $conn a connection object
|
41 |
+
* @param string $serviceName the name of the service to use
|
42 |
+
* @param string $serviceRegion the name of the service region to use
|
43 |
+
* @param string $urltype the type of URL to use (usually "publicURL")
|
44 |
+
*/
|
45 |
+
public function __construct(
|
46 |
+
\OpenCloud\OpenStack $conn,
|
47 |
+
$serviceName=RAXSDK_OBJSTORE_NAME,
|
48 |
+
$serviceRegion=RAXSDK_OBJSTORE_REGION,
|
49 |
+
$urltype=RAXSDK_OBJSTORE_URLTYPE) {
|
50 |
+
$this->debug(Lang::translate('initializing ObjectStore...'));
|
51 |
+
|
52 |
+
// call the parent contructor
|
53 |
+
parent::__construct(
|
54 |
+
$conn,
|
55 |
+
'object-store',
|
56 |
+
$serviceName,
|
57 |
+
$serviceRegion,
|
58 |
+
$urltype
|
59 |
+
);
|
60 |
+
|
61 |
+
// establish the CDN container, if available
|
62 |
+
try {
|
63 |
+
$this->cdn = new ObjectStoreCDN(
|
64 |
+
$conn,
|
65 |
+
$serviceName.'CDN', // will work for Rackspace
|
66 |
+
$serviceRegion,
|
67 |
+
$urltype
|
68 |
+
);
|
69 |
+
} catch (\OpenCloud\Base\Exceptions\EndpointError $e) {
|
70 |
+
/**
|
71 |
+
* if we have an endpoint error, then
|
72 |
+
* the CDN functionality is not available
|
73 |
+
* In this case, we silently ignore it.
|
74 |
+
*/
|
75 |
+
$this->cdn = NULL;
|
76 |
+
}
|
77 |
+
} // function __construct()
|
78 |
+
|
79 |
+
/**
|
80 |
+
* sets the shared secret value for the TEMP_URL
|
81 |
+
*
|
82 |
+
* @param string $secret the shared secret
|
83 |
+
* @return HttpResponse
|
84 |
+
*/
|
85 |
+
public function SetTempUrlSecret($secret) {
|
86 |
+
$resp = $this->Request($this->Url(), 'POST',
|
87 |
+
array('X-Account-Meta-Temp-Url-Key' => $secret));
|
88 |
+
if ($resp->HttpStatus() > 204)
|
89 |
+
throw new \OpenCloud\Base\Exceptions\HttpError(sprintf(
|
90 |
+
Lang::translate('Error in request, status [%d] for URL [%s] [%s]'),
|
91 |
+
$resp->HttpStatus(),
|
92 |
+
$this->Url(),
|
93 |
+
$resp->HttpBody()));
|
94 |
+
return $resp;
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* returns the CDN object
|
99 |
+
*/
|
100 |
+
public function CDN() {
|
101 |
+
return $this->cdn;
|
102 |
+
}
|
103 |
+
}
|
sdk/OpenCloud/OpenCloud/OpenStack.php
ADDED
@@ -0,0 +1,744 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* The OpenStack connection/cloud class
|
4 |
+
*
|
5 |
+
* @copyright 2012-2013 Rackspace Hosting, Inc.
|
6 |
+
* See COPYING for licensing information
|
7 |
+
*
|
8 |
+
* @package phpOpenCloud
|
9 |
+
* @version 1.0
|
10 |
+
* @author Glen Campbell <glen.campbell@rackspace.com>
|
11 |
+
*/
|
12 |
+
|
13 |
+
namespace OpenCloud;
|
14 |
+
|
15 |
+
require_once dirname(__FILE__).'/Globals.php';
|
16 |
+
|
17 |
+
/**
|
18 |
+
* The OpenStack class represents a relationship (or "connection")
|
19 |
+
* between a user and a service.
|
20 |
+
*
|
21 |
+
* This is the primary entry point into an OpenStack system, and the only one
|
22 |
+
* where the developer is required to know and provide the endpoint URL (in
|
23 |
+
* all other cases, the endpoint is derived from the Service Catalog provided
|
24 |
+
* by the authentication system).
|
25 |
+
*
|
26 |
+
* Since various providers have different mechanisms for authentication, users
|
27 |
+
* will often use a subclass of OpenStack. For example, the Rackspace
|
28 |
+
* class is provided for users of Rackspace's cloud services, and other cloud
|
29 |
+
* providers are welcome to add their own subclasses as well.
|
30 |
+
*
|
31 |
+
* General usage example:
|
32 |
+
* <code>
|
33 |
+
* $username = 'My Username';
|
34 |
+
* $secret = 'My Secret';
|
35 |
+
* $connection = new OpenCloud\OpenStack($username, $secret);
|
36 |
+
* // having established the connection, we can set some defaults
|
37 |
+
* // this sets the default name and region of the Compute service
|
38 |
+
* $connection->SetDefaults('Compute', 'cloudServersOpenStack', 'ORD');
|
39 |
+
* // access a Compute service
|
40 |
+
* $chicago = $connection->Compute();
|
41 |
+
* // if we want to access a different service, we can:
|
42 |
+
* $dallas = $connection->Compute('cloudServersOpenStack', 'DFW');
|
43 |
+
* </code>
|
44 |
+
*
|
45 |
+
* @author Glen Campbell <glen.campbell@rackspace.com>
|
46 |
+
* @version 1.0
|
47 |
+
*/
|
48 |
+
class OpenStack extends Base\Base {
|
49 |
+
|
50 |
+
/**
|
51 |
+
* This holds the HTTP User-Agent: used for all requests to the
|
52 |
+
* services. It is public so that, if necessary, it can be entirely
|
53 |
+
* overridden by the developer. However, it's strongly recomended
|
54 |
+
* that you use the OpenStack::AppendUserAgent() method to APPEND
|
55 |
+
* your own User Agent identifier to the end of this string; the
|
56 |
+
* user agent information can be very valuable to service providers
|
57 |
+
* to track who is using their service.
|
58 |
+
*/
|
59 |
+
public $useragent = RAXSDK_USER_AGENT;
|
60 |
+
|
61 |
+
protected
|
62 |
+
$url,
|
63 |
+
$secret=array(),
|
64 |
+
$token,
|
65 |
+
$expiration=0,
|
66 |
+
$tenant,
|
67 |
+
$catalog,
|
68 |
+
/**
|
69 |
+
* This associative array holds default values used to identify each
|
70 |
+
* service (and to select it from the Service Catalog). Use the
|
71 |
+
* Compute::SetDefaults() method to change the default values, or
|
72 |
+
* define the global constants (for example, RAXSDK_COMPUTE_NAME)
|
73 |
+
* BEFORE loading the OpenCloud library:
|
74 |
+
*
|
75 |
+
* <code>
|
76 |
+
* define('RAXSDK_COMPUTE_NAME', 'cloudServersOpenStack');
|
77 |
+
* include('openstack.php');
|
78 |
+
* </code>
|
79 |
+
*/
|
80 |
+
$defaults=array(
|
81 |
+
'Compute' => array(
|
82 |
+
'name' => RAXSDK_COMPUTE_NAME,
|
83 |
+
'region' => RAXSDK_COMPUTE_REGION,
|
84 |
+
'urltype' => RAXSDK_COMPUTE_URLTYPE
|
85 |
+
),
|
86 |
+
'ObjectStore' => array(
|
87 |
+
'name' => RAXSDK_OBJSTORE_NAME,
|
88 |
+
'region' => RAXSDK_OBJSTORE_REGION,
|
89 |
+
'urltype' => RAXSDK_OBJSTORE_URLTYPE
|
90 |
+
),
|
91 |
+
'Database' => array(
|
92 |
+
'name' => RAXSDK_DATABASE_NAME,
|
93 |
+
'region' => RAXSDK_DATABASE_REGION,
|
94 |
+
'urltype' => RAXSDK_DATABASE_URLTYPE
|
95 |
+
),
|
96 |
+
'Volume' => array(
|
97 |
+
'name' => RAXSDK_VOLUME_NAME,
|
98 |
+
'region' => RAXSDK_VOLUME_REGION,
|
99 |
+
'urltype' => RAXSDK_VOLUME_URLTYPE
|
100 |
+
),
|
101 |
+
'LoadBalancer' => array(
|
102 |
+
'name' => RAXSDK_LBSERVICE_NAME,
|
103 |
+
'region' => RAXSDK_LBSERVICE_REGION,
|
104 |
+
'urltype' => RAXSDK_LBSERVICE_URLTYPE
|
105 |
+
),
|
106 |
+
'DNS' => array(
|
107 |
+
'name' => RAXSDK_DNS_NAME,
|
108 |
+
'region' => RAXSDK_DNS_REGION,
|
109 |
+
'urltype' => RAXSDK_DNS_URLTYPE
|
110 |
+
)
|
111 |
+
),
|
112 |
+
$connect_timeout=RAXSDK_CONNECTTIMEOUT,
|
113 |
+
$http_timeout=RAXSDK_TIMEOUT,
|
114 |
+
$overlimit_timeout=RAXSDK_OVERLIMIT_TIMEOUT;
|
115 |
+
|
116 |
+
private
|
117 |
+
$_user_write_progress_callback_func,
|
118 |
+
$_user_read_progress_callback_func,
|
119 |
+
/**
|
120 |
+
* Tracks file descriptors used by streaming downloads
|
121 |
+
*
|
122 |
+
* This will permit multiple simultaneous streaming downloads; the
|
123 |
+
* key is the URL of the object, and the value is its file descriptor.
|
124 |
+
*
|
125 |
+
* To prevent memory overflows, each array element is deleted when
|
126 |
+
* the end of the file is reached.
|
127 |
+
*/
|
128 |
+
$_file_descriptors = array(),
|
129 |
+
/**
|
130 |
+
* array of options to pass to the CURL request object
|
131 |
+
*/
|
132 |
+
$curl_options=array(),
|
133 |
+
/**
|
134 |
+
* list of attributes to export/import
|
135 |
+
*/
|
136 |
+
$export_items = array('token', 'expiration', 'tenant', 'catalog');
|
137 |
+
|
138 |
+
/**
|
139 |
+
* Creates a new OpenStack object
|
140 |
+
*
|
141 |
+
* The OpenStack object needs two bits of information: the URL to
|
142 |
+
* authenticate against, and a "secret", which is an associative array
|
143 |
+
* of name/value pairs. Usually, the secret will be a username and a
|
144 |
+
* password, but other values may be required by different authentication
|
145 |
+
* systems. For example, OpenStack Keystone requires a username and
|
146 |
+
* password, but Rackspace uses a username, tenant ID, and API key.
|
147 |
+
* (See OpenCloud\Rackspace for that.)
|
148 |
+
*
|
149 |
+
* @param string $url - the authentication endpoint URL
|
150 |
+
* @param array $secret - an associative array of auth information:
|
151 |
+
* * username
|
152 |
+
* * password
|
153 |
+
* @param array $options - CURL options to pass to the HttpRequest object
|
154 |
+
*/
|
155 |
+
public function __construct($url, $secret, $options=array()) {
|
156 |
+
$this->debug(Base\Lang::translate('initializing'));
|
157 |
+
$this->url = $url;
|
158 |
+
|
159 |
+
if (!is_array($secret))
|
160 |
+
throw new \OpenCloud\Base\Exceptions\DomainError(Base\Lang::translate('[secret] must be an array'));
|
161 |
+
$this->secret = $secret;
|
162 |
+
|
163 |
+
if (!is_array($options))
|
164 |
+
throw new \OpenCloud\Base\Exceptions\DomainError(Base\Lang::translate('[options] must be an array'));
|
165 |
+
$this->curl_options = $options;
|
166 |
+
}
|
167 |
+
|
168 |
+
/**
|
169 |
+
* Returns the URL of this object
|
170 |
+
*
|
171 |
+
* @api
|
172 |
+
* @return string
|
173 |
+
*/
|
174 |
+
public function Url() {
|
175 |
+
return Base\Lang::noslash($this->url) . '/tokens';
|
176 |
+
}
|
177 |
+
|
178 |
+
/**
|
179 |
+
* Returns the stored secret
|
180 |
+
*
|
181 |
+
* @return array
|
182 |
+
*/
|
183 |
+
public function Secret() {
|
184 |
+
return $this->secret;
|
185 |
+
}
|
186 |
+
|
187 |
+
/**
|
188 |
+
* Returns the cached token; if it has expired, then it re-authenticates
|
189 |
+
*
|
190 |
+
* @api
|
191 |
+
* @return string
|
192 |
+
*/
|
193 |
+
public function Token() {
|
194 |
+
if (time() > ($this->expiration-RAXSDK_FUDGE))
|
195 |
+
$this->Authenticate();
|
196 |
+
return $this->token;
|
197 |
+
}
|
198 |
+
|
199 |
+
/**
|
200 |
+
* Returns the cached expiration time;
|
201 |
+
* if it has expired, then it re-authenticates
|
202 |
+
*
|
203 |
+
* @api
|
204 |
+
* @return string
|
205 |
+
*/
|
206 |
+
public function Expiration() {
|
207 |
+
if (time() > ($this->expiration-RAXSDK_FUDGE))
|
208 |
+
$this->Authenticate();
|
209 |
+
return $this->expiration;
|
210 |
+
}
|
211 |
+
|
212 |
+
/**
|
213 |
+
* Returns the tenant ID, re-authenticating if necessary
|
214 |
+
*
|
215 |
+
* @api
|
216 |
+
* @return string
|
217 |
+
*/
|
218 |
+
public function Tenant() {
|
219 |
+
if (time() > ($this->expiration-RAXSDK_FUDGE))
|
220 |
+
$this->Authenticate();
|
221 |
+
return $this->tenant;
|
222 |
+
}
|
223 |
+
|
224 |
+
/**
|
225 |
+
* Returns the service catalog object from the auth service
|
226 |
+
*
|
227 |
+
* @return \stdClass
|
228 |
+
*/
|
229 |
+
public function ServiceCatalog() {
|
230 |
+
if (time() > ($this->expiration-RAXSDK_FUDGE))
|
231 |
+
$this->Authenticate();
|
232 |
+
return $this->catalog;
|
233 |
+
}
|
234 |
+
|
235 |
+
/**
|
236 |
+
* Returns a Collection of objects with information on services
|
237 |
+
*
|
238 |
+
* Note that these are informational (read-only) and are not actually
|
239 |
+
* 'Service'-class objects.
|
240 |
+
*/
|
241 |
+
public function ServiceList() {
|
242 |
+
return new \OpenCloud\AbstractClass\Collection(
|
243 |
+
$this, 'ServiceCatalogItem', $this->ServiceCatalog());
|
244 |
+
}
|
245 |
+
|
246 |
+
/**
|
247 |
+
* Creates and returns the formatted credentials to POST to the auth
|
248 |
+
* service.
|
249 |
+
*
|
250 |
+
* @return string
|
251 |
+
*/
|
252 |
+
public function Credentials() {
|
253 |
+
if (isset($this->secret['username'])
|
254 |
+
&& isset($this->secret['password'])
|
255 |
+
) {
|
256 |
+
$credentials =
|
257 |
+
array( 'auth' =>
|
258 |
+
array( 'passwordCredentials' =>
|
259 |
+
array(
|
260 |
+
'username' => $this->secret['username'],
|
261 |
+
'password'=>$this->secret['password']
|
262 |
+
)
|
263 |
+
)
|
264 |
+
);
|
265 |
+
|
266 |
+
if (isset($this->secret['tenantName']))
|
267 |
+
{
|
268 |
+
$credentials['auth']['tenantName'] =
|
269 |
+
$this->secret['tenantName'];
|
270 |
+
}
|
271 |
+
|
272 |
+
return json_encode($credentials);
|
273 |
+
}
|
274 |
+
else
|
275 |
+
throw new \OpenCloud\Base\Exceptions\CredentialError(
|
276 |
+
Base\Lang::translate('Unrecognized credential secret'));
|
277 |
+
}
|
278 |
+
|
279 |
+
/**
|
280 |
+
* Authenticates using the supplied credentials
|
281 |
+
*
|
282 |
+
* @api
|
283 |
+
* @return void
|
284 |
+
* @throws AuthenticationError
|
285 |
+
*/
|
286 |
+
public function Authenticate() {
|
287 |
+
// try to auth
|
288 |
+
$response = $this->Request(
|
289 |
+
$this->Url(),
|
290 |
+
'POST',
|
291 |
+
array('Content-Type'=>'application/json'),
|
292 |
+
$this->Credentials()
|
293 |
+
);
|
294 |
+
$json = $response->HttpBody();
|
295 |
+
|
296 |
+
// check for errors
|
297 |
+
if ($response->HttpStatus() >= 400) {
|
298 |
+
throw new \OpenCloud\Base\Exceptions\AuthenticationError(
|
299 |
+
sprintf(Base\Lang::translate('Authentication failure, status [%d], response [%s]'),
|
300 |
+
$response->HttpStatus(), $json));
|
301 |
+
}
|
302 |
+
|
303 |
+
// save the token information as well as the ServiceCatalog
|
304 |
+
$resp = json_decode($json);
|
305 |
+
if ($this->CheckJsonError())
|
306 |
+
return FALSE;
|
307 |
+
$this->token = $resp->access->token->id;
|
308 |
+
$this->expiration = strtotime($resp->access->token->expires);
|
309 |
+
/**
|
310 |
+
* In some cases, the tenant name/id is not returned
|
311 |
+
* as part of the auth token, so we check for it before
|
312 |
+
* we set it. This occurs with pure Keystone, but not
|
313 |
+
* with the Rackspace auth.
|
314 |
+
*/
|
315 |
+
if (isset($resp->access->token->tenant))
|
316 |
+
$this->tenant = $resp->access->token->tenant->id;
|
317 |
+
/**
|
318 |
+
* Note the different capitalization; I'm trying to use CamelCase
|
319 |
+
* consistently in these bindings, but the actual serviceCatalog is
|
320 |
+
* how OpenStack returns it.
|
321 |
+
*/
|
322 |
+
$this->catalog = $resp->access->serviceCatalog;
|
323 |
+
}
|
324 |
+
|
325 |
+
/**
|
326 |
+
* Performs a single HTTP request
|
327 |
+
*
|
328 |
+
* The request() method is one of the most frequently-used in the entire
|
329 |
+
* library. It performs an HTTP request using the specified URL, method,
|
330 |
+
* and with the supplied headers and body. It handles error and
|
331 |
+
* exceptions for the request.
|
332 |
+
*
|
333 |
+
* @api
|
334 |
+
* @param string url - the URL of the request
|
335 |
+
* @param string method - the HTTP method (defaults to GET)
|
336 |
+
* @param array headers - an associative array of headers
|
337 |
+
* @param string data - either a string or a resource (file pointer) to
|
338 |
+
* use as the
|
339 |
+
* request body (for PUT or POST)
|
340 |
+
* @return HttpResponse object
|
341 |
+
* @throws HttpOverLimitError, HttpUnauthorizedError, HttpForbiddenError
|
342 |
+
*/
|
343 |
+
public function Request($url,$method='GET',$headers=array(),$data=NULL) {
|
344 |
+
$this->debug(Base\Lang::translate('Resource [%s] method [%s] body [%s]'),
|
345 |
+
$url, $method, $data);
|
346 |
+
|
347 |
+
// get the request object
|
348 |
+
$http = $this->GetHttpRequestObject($url, $method, $this->curl_options);
|
349 |
+
|
350 |
+
// set various options
|
351 |
+
$this->debug(Base\Lang::translate('Headers: [%s]'), print_r($headers,TRUE));
|
352 |
+
$http->setheaders($headers);
|
353 |
+
$http->SetHttpTimeout($this->http_timeout);
|
354 |
+
$http->SetConnectTimeout($this->connect_timeout);
|
355 |
+
$http->SetOption(CURLOPT_USERAGENT, $this->useragent);
|
356 |
+
|
357 |
+
// data can be either a resource or a string
|
358 |
+
if (is_resource($data)) { // loading from or writing to a file
|
359 |
+
// set the appropriate callback functions
|
360 |
+
switch($method) {
|
361 |
+
case 'GET':
|
362 |
+
// need to save the file descriptor
|
363 |
+
$this->_file_descriptors[$url] = $data;
|
364 |
+
// set the CURL options
|
365 |
+
$http->SetOption(CURLOPT_FILE, $data);
|
366 |
+
$http->SetOption(CURLOPT_WRITEFUNCTION,
|
367 |
+
array($this, '_write_cb'));
|
368 |
+
break;
|
369 |
+
case 'PUT':
|
370 |
+
case 'POST':
|
371 |
+
// need to save the file descriptor
|
372 |
+
$this->_file_descriptors[$url] = $data;
|
373 |
+
if (!isset($headers['Content-Length']))
|
374 |
+
throw new \OpenCloud\Base\Exceptions\HttpError(
|
375 |
+
Base\Lang::translate('The Content-Length: header must be specified '.
|
376 |
+
'for file uploads'));
|
377 |
+
$http->SetOption(CURLOPT_UPLOAD, TRUE);
|
378 |
+
$http->SetOption(CURLOPT_INFILE, $data);
|
379 |
+
$http->SetOption(CURLOPT_INFILESIZE,
|
380 |
+
$headers['Content-Length']);
|
381 |
+
$http->SetOption(CURLOPT_READFUNCTION,
|
382 |
+
array($this, '_read_cb'));
|
383 |
+
break;
|
384 |
+
default:
|
385 |
+
// do nothing
|
386 |
+
}
|
387 |
+
}
|
388 |
+
elseif (is_string($data))
|
389 |
+
$http->SetOption(CURLOPT_POSTFIELDS, $data);
|
390 |
+
elseif (isset($data))
|
391 |
+
throw new \OpenCloud\Base\Exceptions\HttpError(
|
392 |
+
Base\Lang::translate('Unrecognized data type for PUT/POST body, '.
|
393 |
+
'must be string or resource'));
|
394 |
+
|
395 |
+
// perform the HTTP request; returns an HttpResult object
|
396 |
+
$response = $http->Execute();
|
397 |
+
|
398 |
+
// handle and retry on overlimit errors
|
399 |
+
if ($response->HttpStatus() == 413) {
|
400 |
+
$obj = json_decode($response->HttpBody());
|
401 |
+
if (!$this->CheckJsonError()) {
|
402 |
+
if (isset($obj->overLimit)) {
|
403 |
+
/**
|
404 |
+
* @TODO(glen) - The documentation says "retryAt", but
|
405 |
+
* the field returned is "retryAfter". If the doc changes,
|
406 |
+
* then there's no problem, but we'll need to fix this if
|
407 |
+
* they change the code to match the docs.
|
408 |
+
*/
|
409 |
+
$retry_s = $obj->overLimit->retryAfter;
|
410 |
+
$retry_t = strtotime($retry_s);
|
411 |
+
$sleep_interval = $retry_t - time();
|
412 |
+
if ($sleep_interval <= $this->overlimit_timeout) {
|
413 |
+
sleep($sleep_interval);
|
414 |
+
$response = $http->Execute();
|
415 |
+
}
|
416 |
+
else {
|
417 |
+
throw new \OpenCloud\Base\Exceptions\HttpOverLimitError(
|
418 |
+
sprintf(Base\Lang::translate('Over limit; next available request '.
|
419 |
+
'[%s][%s] is not '.
|
420 |
+
'for [%d] seconds at [%s]'),
|
421 |
+
$method,
|
422 |
+
$url,
|
423 |
+
$sleep_interval,
|
424 |
+
$retry_s));
|
425 |
+
}
|
426 |
+
}
|
427 |
+
}
|
428 |
+
}
|
429 |
+
|
430 |
+
// do some common error checking
|
431 |
+
switch($response->HttpStatus()) {
|
432 |
+
case 401:
|
433 |
+
throw new \OpenCloud\Base\Exceptions\HttpUnauthorizedError(
|
434 |
+
sprintf(Base\Lang::translate('401 Unauthorized for [%s] [%s]'),
|
435 |
+
$url, $response->HttpBody()));
|
436 |
+
break;
|
437 |
+
case 403:
|
438 |
+
throw new \OpenCloud\Base\Exceptions\HttpForbiddenError(
|
439 |
+
sprintf(Base\Lang::translate('403 Forbidden for [%s] [%s]'),
|
440 |
+
$url, $response->HttpBody()));
|
441 |
+
break;
|
442 |
+
case 413: // limit
|
443 |
+
throw new \OpenCloud\Base\Exceptions\HttpOverLimitError(
|
444 |
+
sprintf(Base\Lang::translate('413 Over limit for [%s] [%s]'),
|
445 |
+
$url, $response->HttpBody()));
|
446 |
+
break;
|
447 |
+
default:
|
448 |
+
// everything is fine here, we're fine, how are you?
|
449 |
+
}
|
450 |
+
|
451 |
+
// free the handle
|
452 |
+
$http->close();
|
453 |
+
|
454 |
+
// return the HttpResponse object
|
455 |
+
$this->debug(Base\Lang::translate('HTTP STATUS [%s]'), $response->HttpStatus());
|
456 |
+
return $response;
|
457 |
+
}
|
458 |
+
|
459 |
+
/**
|
460 |
+
* Allows the user to append a user agent string
|
461 |
+
*
|
462 |
+
* Programs that are using these bindings are encouraged to add their
|
463 |
+
* user agent to the one supplied by this SDK. This will permit cloud
|
464 |
+
* providers to track users so that they can provide better service.
|
465 |
+
*
|
466 |
+
* @api
|
467 |
+
* @param string $agent an arbitrary user-agent string; e.g. "My Cloud App"
|
468 |
+
* @return void
|
469 |
+
*/
|
470 |
+
public function AppendUserAgent($agent) {
|
471 |
+
$this->useragent .= ';'.$agent;
|
472 |
+
}
|
473 |
+
|
474 |
+
/**
|
475 |
+
* Sets default values for name, region, URL type for a service
|
476 |
+
*
|
477 |
+
* Once these are set (and they can also be set by defining global
|
478 |
+
* constants), then you do not need to specify these values when
|
479 |
+
* creating new service objects.
|
480 |
+
*
|
481 |
+
* @api
|
482 |
+
* @param string $service the name of a supported service; e.g. 'Compute'
|
483 |
+
* @param string $name the service name; e.g., 'cloudServersOpenStack'
|
484 |
+
* @param string $region the region name; e.g., 'LON'
|
485 |
+
* @param string $urltype the type of URL to use; e.g., 'internalURL'
|
486 |
+
* @return void
|
487 |
+
* @throws UnrecognizedServiceError
|
488 |
+
*/
|
489 |
+
public function SetDefaults($service,
|
490 |
+
$name=NULL, $region=NULL, $urltype=NULL) {
|
491 |
+
|
492 |
+
if (!isset($this->defaults[$service]))
|
493 |
+
throw new \OpenCloud\Base\Exceptions\UnrecognizedServiceError(sprintf(
|
494 |
+
Base\Lang::translate('Service [%s] is not recognized'), $service));
|
495 |
+
|
496 |
+
if (isset($name))
|
497 |
+
$this->defaults[$service]['name'] = $name;
|
498 |
+
if (isset($region))
|
499 |
+
$this->defaults[$service]['region'] = $region;
|
500 |
+
if (isset($urltype))
|
501 |
+
$this->defaults[$service]['urltype'] = $urltype;
|
502 |
+
}
|
503 |
+
|
504 |
+
/**
|
505 |
+
* Sets the timeouts for the current connection
|
506 |
+
*
|
507 |
+
* @api
|
508 |
+
* @param integer $t_http the HTTP timeout value (the max period that
|
509 |
+
* the OpenStack object will wait for any HTTP request to complete).
|
510 |
+
* Value is in seconds.
|
511 |
+
* @param integer $t_conn the Connect timeout value (the max period
|
512 |
+
* that the OpenStack object will wait to establish an HTTP
|
513 |
+
* connection). Value is in seconds.
|
514 |
+
* @param integer $t_overlimit the overlimit timeout value (the max period
|
515 |
+
* that the OpenStack object will wait to retry on an overlimit
|
516 |
+
* condition). Value is in seconds.
|
517 |
+
* @return void
|
518 |
+
*/
|
519 |
+
public function SetTimeouts($t_http, $t_conn=NULL, $t_overlimit=NULL) {
|
520 |
+
$this->http_timeout = $t_http;
|
521 |
+
if (isset($t_conn))
|
522 |
+
$this->connect_timeout = $t_conn;
|
523 |
+
if (isset($t_overlimit))
|
524 |
+
$this->overlimit_timeout = $t_overlimit;
|
525 |
+
}
|
526 |
+
|
527 |
+
/**
|
528 |
+
* Allows the user to define a function for tracking uploads
|
529 |
+
*
|
530 |
+
* This can be used to implement a progress bar or similar function. The
|
531 |
+
* callback function is called with a single parameter, the length of the
|
532 |
+
* data that is being uploaded on this call.
|
533 |
+
*
|
534 |
+
* @param callable $callback the name of a global callback function, or an
|
535 |
+
* array($object, $functionname)
|
536 |
+
* @return void
|
537 |
+
*/
|
538 |
+
public function SetUploadProgressCallback($callback) {
|
539 |
+
$this->_user_write_progress_callback_func = $callback;
|
540 |
+
}
|
541 |
+
|
542 |
+
/**
|
543 |
+
* Allows the user to define a function for tracking downloads
|
544 |
+
*
|
545 |
+
* This can be used to implement a progress bar or similar function. The
|
546 |
+
* callback function is called with a single parameter, the length of the
|
547 |
+
* data that is being downloaded on this call.
|
548 |
+
*
|
549 |
+
* @param callable $callback the name of a global callback function, or an
|
550 |
+
* array($object, $functionname)
|
551 |
+
* @return void
|
552 |
+
*/
|
553 |
+
public function SetDownloadProgressCallback($callback) {
|
554 |
+
$this->_user_read_progress_callback_func = $callback;
|
555 |
+
}
|
556 |
+
|
557 |
+
/**
|
558 |
+
* Callback function to handle reads for file uploads
|
559 |
+
*
|
560 |
+
* Internal function for handling file uploads. Note that, although this
|
561 |
+
* function's visibility is public, this is only because it must be called
|
562 |
+
* from the HttpRequest interface. This should NOT be called by users
|
563 |
+
* directly.
|
564 |
+
*
|
565 |
+
* @param resource $ch a CURL handle
|
566 |
+
* @param resource $fd a file descriptor
|
567 |
+
* @param integer $length the amount of data to read
|
568 |
+
* @return string the data read
|
569 |
+
*/
|
570 |
+
public function _read_cb($ch, $fd, $length)
|
571 |
+
{
|
572 |
+
$data = fread($fd, $length);
|
573 |
+
$len = strlen($data);
|
574 |
+
if (isset($this->_user_write_progress_callback_func)) {
|
575 |
+
call_user_func($this->_user_write_progress_callback_func, $len);
|
576 |
+
}
|
577 |
+
return $data;
|
578 |
+
}
|
579 |
+
|
580 |
+
/**
|
581 |
+
* Callback function to handle writes for file downloads
|
582 |
+
*
|
583 |
+
* Internal function for handling file downloads. Note that, although this
|
584 |
+
* function's visibility is public, this is only because it must be called
|
585 |
+
* via the HttpRequest interface. This should NOT be called by users
|
586 |
+
* directly.
|
587 |
+
*
|
588 |
+
* @param resource $ch a CURL handle
|
589 |
+
* @param string $data the data to be written to a file
|
590 |
+
* @return integer the number of bytes written
|
591 |
+
*/
|
592 |
+
public function _write_cb($ch, $data)
|
593 |
+
{
|
594 |
+
$url = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
|
595 |
+
if (!isset($this->_file_descriptors[$url]))
|
596 |
+
throw new \OpenCloud\Base\Exceptions\HttpUrlError(sprintf(
|
597 |
+
Base\Lang::translate('Cannot find file descriptor for URL [%s]'), $url));
|
598 |
+
$fp = $this->_file_descriptors[$url];
|
599 |
+
$dlen = strlen($data);
|
600 |
+
fwrite($fp, $data, $dlen);
|
601 |
+
|
602 |
+
// call used callback function
|
603 |
+
if (isset($this->_user_read_progress_callback_func)) {
|
604 |
+
call_user_func($this->_user_read_progress_callback_func, $dlen);
|
605 |
+
}
|
606 |
+
|
607 |
+
// MUST return the length to CURL
|
608 |
+
return $dlen;
|
609 |
+
}
|
610 |
+
|
611 |
+
/**
|
612 |
+
* exports saved token, expiration, tenant, and service catalog as an array
|
613 |
+
*
|
614 |
+
* This could be stored in a cache (APC or disk file) and reloaded using
|
615 |
+
* ImportCredentials()
|
616 |
+
*
|
617 |
+
* @return array
|
618 |
+
*/
|
619 |
+
public function ExportCredentials() {
|
620 |
+
$arr = array();
|
621 |
+
foreach($this->export_items as $item)
|
622 |
+
$arr[$item] = $this->$item;
|
623 |
+
return $arr;
|
624 |
+
}
|
625 |
+
|
626 |
+
/**
|
627 |
+
* imports credentials from an array
|
628 |
+
*
|
629 |
+
* Takes the same values as ExportCredentials() and reuses them.
|
630 |
+
*
|
631 |
+
* @return void
|
632 |
+
*/
|
633 |
+
public function ImportCredentials($values) {
|
634 |
+
if (!is_array($values))
|
635 |
+
throw new \OpenCloud\Base\Exceptions\DomainError(Base\Lang::translate('ImportCredentials() requires an array'));
|
636 |
+
foreach($this->export_items as $item)
|
637 |
+
$this->$item = $values[$item];
|
638 |
+
}
|
639 |
+
|
640 |
+
/********** FACTORY METHODS **********/
|
641 |
+
|
642 |
+
/**
|
643 |
+
* These methods are provided to permit easy creation of services
|
644 |
+
* (for example, Nova or Swift) from a connection object. As new
|
645 |
+
* services are supported, factory methods should be provided here.
|
646 |
+
*/
|
647 |
+
|
648 |
+
/**
|
649 |
+
* Creates a new ObjectStore object (Swift/Cloud Files)
|
650 |
+
*
|
651 |
+
* @api
|
652 |
+
* @param string $name the name of the Object Storage service to attach to
|
653 |
+
* @param string $region the name of the region to use
|
654 |
+
* @param string $urltype the URL type (normally "publicURL")
|
655 |
+
* @return ObjectStore
|
656 |
+
*/
|
657 |
+
public function ObjectStore($name=NULL, $region=NULL, $urltype=NULL) {
|
658 |
+
return $this->Service('ObjectStore', $name, $region, $urltype);
|
659 |
+
}
|
660 |
+
|
661 |
+
/**
|
662 |
+
* Creates a new Compute object (Nova/Cloud Servers)
|
663 |
+
*
|
664 |
+
* @api
|
665 |
+
* @param string $name the name of the Compute service to attach to
|
666 |
+
* @param string $region the name of the region to use
|
667 |
+
* @param string $urltype the URL type (normally "publicURL")
|
668 |
+
* @return ObjectStore
|
669 |
+
*/
|
670 |
+
public function Compute($name=NULL, $region=NULL, $urltype=NULL) {
|
671 |
+
return $this->Service('Compute', $name, $region, $urltype);
|
672 |
+
}
|
673 |
+
|
674 |
+
/**
|
675 |
+
* Creates a new VolumeService (cinder) service object
|
676 |
+
*
|
677 |
+
* This is a factory method that is Rackspace-only (NOT part of OpenStack).
|
678 |
+
*
|
679 |
+
* @param string $name the name of the service (e.g., 'cloudBlockStorage')
|
680 |
+
* @param string $region the region (e.g., 'DFW')
|
681 |
+
* @param string $urltype the type of URL (e.g., 'publicURL');
|
682 |
+
*/
|
683 |
+
public function VolumeService($name=NULL, $region=NULL, $urltype=NULL) {
|
684 |
+
return $this->Service('Volume', $name, $region, $urltype);
|
685 |
+
}
|
686 |
+
|
687 |
+
/********** PROTECTED METHODS **********/
|
688 |
+
|
689 |
+
/**
|
690 |
+
* Generic Service factory method
|
691 |
+
*
|
692 |
+
* Contains code reused by the other service factory methods.
|
693 |
+
*
|
694 |
+
* @param string $class the name of the Service class to produce
|
695 |
+
* @param string $name the name of the Compute service to attach to
|
696 |
+
* @param string $region the name of the region to use
|
697 |
+
* @param string $urltype the URL type (normally "publicURL")
|
698 |
+
* @return Service (or subclass such as Compute, ObjectStore)
|
699 |
+
* @throws ServiceValueError
|
700 |
+
*/
|
701 |
+
public function Service($class,
|
702 |
+
$name=NULL, $region=NULL, $urltype=NULL) {
|
703 |
+
// debug message
|
704 |
+
$this->debug('Factory for class [%s] [%s/%s/%s]',
|
705 |
+
$class, $name, $region, $urltype);
|
706 |
+
|
707 |
+
if (strpos($class, '\OpenCloud\\') === 0) $class = str_replace('\OpenCloud\\', '', $class);
|
708 |
+
|
709 |
+
// check for defaults
|
710 |
+
if (!isset($name))
|
711 |
+
$name = $this->defaults[$class]['name'];
|
712 |
+
if (!isset($region))
|
713 |
+
$region = $this->defaults[$class]['region'];
|
714 |
+
if (!isset($urltype))
|
715 |
+
$urltype = $this->defaults[$class]['urltype'];
|
716 |
+
|
717 |
+
// report errors
|
718 |
+
if (!$name)
|
719 |
+
throw new \OpenCloud\Base\Exceptions\ServiceValueError(Base\Lang::translate('No value for '.$class.' name'));
|
720 |
+
if (!$region)
|
721 |
+
throw new \OpenCloud\Base\Exceptions\ServiceValueError(Base\Lang::translate('No value for '.$class.' region'));
|
722 |
+
if (!$urltype)
|
723 |
+
throw new \OpenCloud\Base\Exceptions\ServiceValueError(Base\Lang::translate('No value for '.$class.' URL type'));
|
724 |
+
|
725 |
+
// return the object
|
726 |
+
$fullclass = '\OpenCloud\\' . $class . '\\Service';
|
727 |
+
return new $fullclass(
|
728 |
+
$this,
|
729 |
+
$name,
|
730 |
+
$region,
|
731 |
+
$urltype
|
732 |
+
);
|
733 |
+
}
|
734 |
+
|
735 |
+
/**
|
736 |
+
* returns a service catalog item
|
737 |
+
*
|
738 |
+
* This is a helper function used to list service catalog items easily
|
739 |
+
*/
|
740 |
+
public function ServiceCatalogItem($info=array()) {
|
741 |
+
return new Base\ServiceCatalogItem($info);
|
742 |
+
}
|
743 |
+
|
744 |
+
} // class OpenStack
|
sdk/OpenCloud/OpenCloud/Rackspace.php
ADDED
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* The Rackspace cloud/connection class (which uses different authentication
|
4 |
+
* than the pure OpenStack class)
|
5 |
+
*
|
6 |
+
* @copyright 2012-2013 Rackspace Hosting, Inc.
|
7 |
+
* See COPYING for licensing information
|
8 |
+
*
|
9 |
+
* @package phpOpenCloud
|
10 |
+
* @version 1.0
|
11 |
+
* @author Glen Campbell <glen.campbell@rackspace.com>
|
12 |
+
*/
|
13 |
+
|
14 |
+
namespace OpenCloud;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Rackspace extends the OpenStack class with support for Rackspace's
|
18 |
+
* API key and tenant requirements.
|
19 |
+
*
|
20 |
+
* The only difference between Rackspace and OpenStack is that the
|
21 |
+
* Rackspace class generates credentials using the username
|
22 |
+
* and API key, as required by the Rackspace authentication
|
23 |
+
* service.
|
24 |
+
*
|
25 |
+
* Example:
|
26 |
+
* <code>
|
27 |
+
* $username = 'FRED';
|
28 |
+
* $apiKey = '0900af093093788912388fc09dde090ffee09';
|
29 |
+
* $conn = new Rackspace(
|
30 |
+
* 'https://identity.api.rackspacecloud.com/v2.0/',
|
31 |
+
* array(
|
32 |
+
* 'username' => $username,
|
33 |
+
* 'apiKey' => $apiKey
|
34 |
+
* ));
|
35 |
+
* </code>
|
36 |
+
*/
|
37 |
+
class Rackspace extends OpenStack {
|
38 |
+
|
39 |
+
//this is the JSON string for our new credentials
|
40 |
+
const APIKEYTEMPLATE = <<<ENDCRED
|
41 |
+
{ "auth": { "RAX-KSKEY:apiKeyCredentials": { "username": "%s",
|
42 |
+
"apiKey": "%s"
|
43 |
+
}
|
44 |
+
}
|
45 |
+
}
|
46 |
+
ENDCRED;
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Generates Rackspace API key credentials
|
50 |
+
*
|
51 |
+
* @return string
|
52 |
+
*/
|
53 |
+
public function Credentials() {
|
54 |
+
$sec = $this->Secret();
|
55 |
+
if (isset($sec['username']) &&
|
56 |
+
isset($sec['apiKey']))
|
57 |
+
return sprintf(
|
58 |
+
self::APIKEYTEMPLATE,
|
59 |
+
$sec['username'],
|
60 |
+
$sec['apiKey']
|
61 |
+
);
|
62 |
+
else
|
63 |
+
return parent::Credentials();
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Creates a new DbService (Database as a Service) object
|
68 |
+
*
|
69 |
+
* This is a factory method that is Rackspace-only (NOT part of OpenStack).
|
70 |
+
*
|
71 |
+
* @param string $name the name of the service (e.g., 'Cloud Databases')
|
72 |
+
* @param string $region the region (e.g., 'DFW')
|
73 |
+
* @param string $urltype the type of URL (e.g., 'publicURL');
|
74 |
+
*/
|
75 |
+
public function DbService($name=NULL, $region=NULL, $urltype=NULL) {
|
76 |
+
return $this->Service('Database', $name, $region, $urltype);
|
77 |
+
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* Creates a new LoadBalancerService object
|
81 |
+
*
|
82 |
+
* This is a factory method that is Rackspace-only (NOT part of OpenStack).
|
83 |
+
*
|
84 |
+
* @param string $name the name of the service
|
85 |
+
* (e.g., 'Cloud Load Balancers')
|
86 |
+
* @param string $region the region (e.g., 'DFW')
|
87 |
+
* @param string $urltype the type of URL (e.g., 'publicURL');
|
88 |
+
*/
|
89 |
+
public function LoadBalancerService($name=NULL,$region=NULL,$urltype=NULL) {
|
90 |
+
return $this->Service('LoadBalancer', $name, $region, $urltype);
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* creates a new DNS service object
|
95 |
+
*
|
96 |
+
* This is a factory method that is currently Rackspace-only
|
97 |
+
* (not available via the OpenStack class)
|
98 |
+
*/
|
99 |
+
public function DNS($name=NULL, $region=NULL, $urltype=NULL) {
|
100 |
+
return $this->Service('DNS', $name, $region, $urltype);
|
101 |
+
}
|
102 |
+
|
103 |
+
} // end class Rackspace
|
sdk/OpenCloud/{volumeservice.php → OpenCloud/Volume/Service.php}
RENAMED
@@ -10,19 +10,14 @@
|
|
10 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
11 |
*/
|
12 |
|
13 |
-
namespace OpenCloud;
|
14 |
|
15 |
-
|
16 |
-
require_once(__DIR__.'/volume.php');
|
17 |
-
require_once(__DIR__.'/volumetype.php');
|
18 |
-
require_once(__DIR__.'/snapshot.php');
|
19 |
-
|
20 |
-
class VolumeService extends Nova {
|
21 |
|
22 |
/**
|
23 |
* creates the VolumeService object
|
24 |
*/
|
25 |
-
public function __construct(OpenStack $conn, $name, $region, $urltype) {
|
26 |
parent::__construct($conn, 'volume', $name, $region, $urltype);
|
27 |
}
|
28 |
|
@@ -34,7 +29,7 @@ class VolumeService extends Nova {
|
|
34 |
* @return VolumeService\Volume
|
35 |
*/
|
36 |
public function Volume($id=NULL) {
|
37 |
-
return new
|
38 |
}
|
39 |
|
40 |
/**
|
@@ -46,9 +41,9 @@ class VolumeService extends Nova {
|
|
46 |
* @return Collection
|
47 |
*/
|
48 |
public function VolumeList($details=TRUE, $filter=array()) {
|
49 |
-
$url = $this->Url(
|
50 |
($details ? '/detail' : '');
|
51 |
-
return $this->Collection('\OpenCloud\
|
52 |
}
|
53 |
|
54 |
/**
|
@@ -59,7 +54,7 @@ class VolumeService extends Nova {
|
|
59 |
* @return VolumeService\Volume
|
60 |
*/
|
61 |
public function VolumeType($id=NULL) {
|
62 |
-
return new
|
63 |
}
|
64 |
|
65 |
/**
|
@@ -70,7 +65,7 @@ class VolumeService extends Nova {
|
|
70 |
* @return Collection
|
71 |
*/
|
72 |
public function VolumeTypeList($filter=array()) {
|
73 |
-
return $this->Collection('\OpenCloud\
|
74 |
}
|
75 |
|
76 |
/**
|
@@ -79,7 +74,7 @@ class VolumeService extends Nova {
|
|
79 |
* @return Snapshot
|
80 |
*/
|
81 |
public function Snapshot($id=NULL) {
|
82 |
-
return new
|
83 |
}
|
84 |
|
85 |
/**
|
@@ -91,7 +86,7 @@ class VolumeService extends Nova {
|
|
91 |
* @return Collection
|
92 |
*/
|
93 |
public function SnapshotList($filter=array()) {
|
94 |
-
return $this->Collection('\OpenCloud\
|
95 |
}
|
96 |
|
97 |
}
|
10 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
11 |
*/
|
12 |
|
13 |
+
namespace OpenCloud\Volume;
|
14 |
|
15 |
+
class Service extends \OpenCloud\AbstractClass\Nova {
|
|
|
|
|
|
|
|
|
|
|
16 |
|
17 |
/**
|
18 |
* creates the VolumeService object
|
19 |
*/
|
20 |
+
public function __construct(\OpenCloud\OpenStack $conn, $name, $region, $urltype) {
|
21 |
parent::__construct($conn, 'volume', $name, $region, $urltype);
|
22 |
}
|
23 |
|
29 |
* @return VolumeService\Volume
|
30 |
*/
|
31 |
public function Volume($id=NULL) {
|
32 |
+
return new Volume($this, $id);
|
33 |
}
|
34 |
|
35 |
/**
|
41 |
* @return Collection
|
42 |
*/
|
43 |
public function VolumeList($details=TRUE, $filter=array()) {
|
44 |
+
$url = $this->Url(Volume::ResourceName()) .
|
45 |
($details ? '/detail' : '');
|
46 |
+
return $this->Collection('\OpenCloud\Volume\Volume', $url);
|
47 |
}
|
48 |
|
49 |
/**
|
54 |
* @return VolumeService\Volume
|
55 |
*/
|
56 |
public function VolumeType($id=NULL) {
|
57 |
+
return new VolumeType($this, $id);
|
58 |
}
|
59 |
|
60 |
/**
|
65 |
* @return Collection
|
66 |
*/
|
67 |
public function VolumeTypeList($filter=array()) {
|
68 |
+
return $this->Collection('\OpenCloud\Volume\VolumeType');
|
69 |
}
|
70 |
|
71 |
/**
|
74 |
* @return Snapshot
|
75 |
*/
|
76 |
public function Snapshot($id=NULL) {
|
77 |
+
return new Snapshot($this, $id);
|
78 |
}
|
79 |
|
80 |
/**
|
86 |
* @return Collection
|
87 |
*/
|
88 |
public function SnapshotList($filter=array()) {
|
89 |
+
return $this->Collection('\OpenCloud\Volume\Snapshot');
|
90 |
}
|
91 |
|
92 |
}
|
sdk/OpenCloud/{snapshot.php → OpenCloud/Volume/Snapshot.php}
RENAMED
@@ -10,10 +10,7 @@
|
|
10 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
11 |
*/
|
12 |
|
13 |
-
namespace OpenCloud\
|
14 |
-
|
15 |
-
require_once(__DIR__.'/persistentobject.php');
|
16 |
-
require_once(__DIR__.'/metadata.php');
|
17 |
|
18 |
/**
|
19 |
* The Snapshot class represents a single block storage snapshot
|
@@ -21,7 +18,7 @@ require_once(__DIR__.'/metadata.php');
|
|
21 |
* @api
|
22 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
23 |
*/
|
24 |
-
class Snapshot extends \OpenCloud\PersistentObject {
|
25 |
|
26 |
public
|
27 |
$id,
|
@@ -49,8 +46,8 @@ class Snapshot extends \OpenCloud\PersistentObject {
|
|
49 |
* @throws OpenCloud\UpdateError always
|
50 |
*/
|
51 |
public function Update($params=array()) {
|
52 |
-
throw new \OpenCloud\UpdateError(
|
53 |
-
|
54 |
}
|
55 |
|
56 |
/**
|
10 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
11 |
*/
|
12 |
|
13 |
+
namespace OpenCloud\Volume;
|
|
|
|
|
|
|
14 |
|
15 |
/**
|
16 |
* The Snapshot class represents a single block storage snapshot
|
18 |
* @api
|
19 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
20 |
*/
|
21 |
+
class Snapshot extends \OpenCloud\AbstractClass\PersistentObject {
|
22 |
|
23 |
public
|
24 |
$id,
|
46 |
* @throws OpenCloud\UpdateError always
|
47 |
*/
|
48 |
public function Update($params=array()) {
|
49 |
+
throw new \OpenCloud\Base\Exceptions\UpdateError(
|
50 |
+
\OpenCloud\Base\Lang::translate('VolumeType cannot be updated'));
|
51 |
}
|
52 |
|
53 |
/**
|
sdk/OpenCloud/{volume.php → OpenCloud/Volume/Volume.php}
RENAMED
@@ -10,10 +10,7 @@
|
|
10 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
11 |
*/
|
12 |
|
13 |
-
namespace OpenCloud\
|
14 |
-
|
15 |
-
require_once(__DIR__.'/persistentobject.php');
|
16 |
-
require_once(__DIR__.'/metadata.php');
|
17 |
|
18 |
/**
|
19 |
* The Volume class represents a single block storage volume
|
@@ -21,7 +18,7 @@ require_once(__DIR__.'/metadata.php');
|
|
21 |
* @api
|
22 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
23 |
*/
|
24 |
-
class Volume extends \OpenCloud\PersistentObject {
|
25 |
|
26 |
public
|
27 |
$id,
|
@@ -56,8 +53,8 @@ class Volume extends \OpenCloud\PersistentObject {
|
|
56 |
* @throws OpenCloud\UpdateError always
|
57 |
*/
|
58 |
public function Update($params=array()) {
|
59 |
-
throw new \OpenCloud\UpdateError(
|
60 |
-
|
61 |
}
|
62 |
|
63 |
/**
|
10 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
11 |
*/
|
12 |
|
13 |
+
namespace OpenCloud\Volume;
|
|
|
|
|
|
|
14 |
|
15 |
/**
|
16 |
* The Volume class represents a single block storage volume
|
18 |
* @api
|
19 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
20 |
*/
|
21 |
+
class Volume extends \OpenCloud\AbstractClass\PersistentObject {
|
22 |
|
23 |
public
|
24 |
$id,
|
53 |
* @throws OpenCloud\UpdateError always
|
54 |
*/
|
55 |
public function Update($params=array()) {
|
56 |
+
throw new \OpenCloud\Base\Exceptions\UpdateError(
|
57 |
+
\OpenCloud\Base\Lang::translate('Block storage volumes cannot be updated'));
|
58 |
}
|
59 |
|
60 |
/**
|
sdk/OpenCloud/{volumetype.php → OpenCloud/Volume/VolumeType.php}
RENAMED
@@ -10,10 +10,7 @@
|
|
10 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
11 |
*/
|
12 |
|
13 |
-
namespace OpenCloud\
|
14 |
-
|
15 |
-
require_once(__DIR__.'/persistentobject.php');
|
16 |
-
require_once(__DIR__.'/metadata.php');
|
17 |
|
18 |
/**
|
19 |
* The VolumeType class represents a single block storage volume type
|
@@ -21,13 +18,13 @@ require_once(__DIR__.'/metadata.php');
|
|
21 |
* @api
|
22 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
23 |
*/
|
24 |
-
class VolumeType extends \OpenCloud\PersistentObject {
|
25 |
|
26 |
public
|
27 |
$id,
|
28 |
$name,
|
29 |
$extra_specs;
|
30 |
-
|
31 |
protected static
|
32 |
$json_name = 'volume_type',
|
33 |
$url_resource = 'types';
|
@@ -38,8 +35,8 @@ class VolumeType extends \OpenCloud\PersistentObject {
|
|
38 |
* @throws OpenCloud\CreateError always
|
39 |
*/
|
40 |
public function Create($params=array()) {
|
41 |
-
throw new \OpenCloud\CreateError(
|
42 |
-
|
43 |
}
|
44 |
|
45 |
/**
|
@@ -48,8 +45,8 @@ class VolumeType extends \OpenCloud\PersistentObject {
|
|
48 |
* @throws OpenCloud\UpdateError always
|
49 |
*/
|
50 |
public function Update($params=array()) {
|
51 |
-
throw new \OpenCloud\UpdateError(
|
52 |
-
|
53 |
}
|
54 |
|
55 |
/**
|
@@ -58,8 +55,8 @@ class VolumeType extends \OpenCloud\PersistentObject {
|
|
58 |
* @throws OpenCloud\DeleteError
|
59 |
*/
|
60 |
public function Delete() {
|
61 |
-
throw new \OpenCloud\DeleteError(
|
62 |
-
|
63 |
}
|
64 |
|
65 |
}
|
10 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
11 |
*/
|
12 |
|
13 |
+
namespace OpenCloud\Volume;
|
|
|
|
|
|
|
14 |
|
15 |
/**
|
16 |
* The VolumeType class represents a single block storage volume type
|
18 |
* @api
|
19 |
* @author Glen Campbell <glen.campbell@rackspace.com>
|
20 |
*/
|
21 |
+
class VolumeType extends \OpenCloud\AbstractClass\PersistentObject {
|
22 |
|
23 |
public
|
24 |
$id,
|
25 |
$name,
|
26 |
$extra_specs;
|
27 |
+
|
28 |
protected static
|
29 |
$json_name = 'volume_type',
|
30 |
$url_resource = 'types';
|
35 |
* @throws OpenCloud\CreateError always
|
36 |
*/
|
37 |
public function Create($params=array()) {
|
38 |
+
throw new \OpenCloud\Base\Exceptions\CreateError(
|
39 |
+
\OpenCloud\Base\Lang::translate('VolumeType cannot be created'));
|
40 |
}
|
41 |
|
42 |
/**
|
45 |
* @throws OpenCloud\UpdateError always
|
46 |
*/
|
47 |
public function Update($params=array()) {
|
48 |
+
throw new \OpenCloud\Base\Exceptions\UpdateError(
|
49 |
+
\OpenCloud\Base\Lang::translate('VolumeType cannot be updated'));
|
50 |
}
|
51 |
|
52 |
/**
|
55 |
* @throws OpenCloud\DeleteError
|
56 |
*/
|
57 |
public function Delete() {
|
58 |
+
throw new \OpenCloud\Base\Exceptions\DeleteError(
|
59 |
+
\OpenCloud\Base\Lang::translate('VolumeType cannot be deleted'));
|
60 |
}
|
61 |
|
62 |
}
|
sdk/OpenCloud/cloud.php
DELETED
@@ -1,30 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* A convenience file that loads all the other components
|
4 |
-
*
|
5 |
-
* @copyright 2012-2013 Rackspace Hosting, Inc.
|
6 |
-
* See COPYING for licensing information
|
7 |
-
*
|
8 |
-
* @package phpOpenCloud
|
9 |
-
* @version 1.0
|
10 |
-
* @author Glen Campbell <glen.campbell@rackspace.com>
|
11 |
-
*/
|
12 |
-
|
13 |
-
/**
|
14 |
-
* This file is provided as a convenience in case you want to use multiple
|
15 |
-
* cloud services. Instead of including each service file individually, this
|
16 |
-
* file loads them all at once.
|
17 |
-
*
|
18 |
-
* Example:
|
19 |
-
* <code>
|
20 |
-
* require('cloud.php');
|
21 |
-
* </code>
|
22 |
-
*
|
23 |
-
* Since Rackspace is a subclass of OpenStack, you can use either class
|
24 |
-
* for your connection object.
|
25 |
-
*/
|
26 |
-
|
27 |
-
require_once(__DIR__.'/rackspace.php');
|
28 |
-
require_once(__DIR__.'/compute.php');
|
29 |
-
require_once(__DIR__.'/objectstore.php');
|
30 |
-
require_once(__DIR__.'/dbservice.php');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sdk/OpenCloud/container.php
DELETED
@@ -1,512 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Containers for OpenStack Object Storage (Swift) and Rackspace Cloud Files
|
4 |
-
*
|
5 |
-
* @copyright 2012-2013 Rackspace Hosting, Inc.
|
6 |
-
* See COPYING for licensing information
|
7 |
-
*
|
8 |
-
* @package phpOpenCloud
|
9 |
-
* @version 1.0
|
10 |
-
* @author Glen Campbell <glen.campbell@rackspace.com>
|
11 |
-
*/
|
12 |
-
|
13 |
-
namespace OpenCloud\ObjectStore;
|
14 |
-
|
15 |
-
require_once(__DIR__.'/dataobject.php');
|
16 |
-
require_once(__DIR__.'/objstorebase.php');
|
17 |
-
|
18 |
-
/**
|
19 |
-
* A simple container for the CDN Service
|
20 |
-
*
|
21 |
-
* @author Glen Campbell <glen.campbell@rackspace.com>
|
22 |
-
*/
|
23 |
-
class CDNContainer extends ObjStoreBase {
|
24 |
-
public
|
25 |
-
$name,
|
26 |
-
$count=0,
|
27 |
-
$bytes=0;
|
28 |
-
private
|
29 |
-
$service,
|
30 |
-
$container_url,
|
31 |
-
$_cdn;
|
32 |
-
|
33 |
-
/**
|
34 |
-
* Creates the container object
|
35 |
-
*
|
36 |
-
* Creates a new container object or, if the $cdata object is a string,
|
37 |
-
* retrieves the named container from the object store. If $cdata is an
|
38 |
-
* array or an object, then its values are used to set this object.
|
39 |
-
*
|
40 |
-
* @param OpenCloud\ObjectStore $service - the ObjectStore service
|
41 |
-
* @param mixed $cdata - if supplied, the name of the object
|
42 |
-
*/
|
43 |
-
public function __construct(\OpenCloud\Service $service, $cdata=NULL) {
|
44 |
-
$this->debug(_('Initializing Container...'));
|
45 |
-
parent::__construct();
|
46 |
-
$this->service = $service;
|
47 |
-
|
48 |
-
// set values from an object (via containerlist)
|
49 |
-
if (is_object($cdata)) {
|
50 |
-
foreach($cdata as $name => $value)
|
51 |
-
if ($name == 'metadata')
|
52 |
-
$this->metadata->SetArray($value);
|
53 |
-
else
|
54 |
-
$this->$name = $value;
|
55 |
-
}
|
56 |
-
// or, if it's a string, retrieve the object with that name
|
57 |
-
else if ($cdata) {
|
58 |
-
$this->debug(_('Getting container [%s]'), $cdata);
|
59 |
-
$this->name = $cdata;
|
60 |
-
$this->Refresh();
|
61 |
-
}
|
62 |
-
} // __construct()
|
63 |
-
|
64 |
-
/**
|
65 |
-
* Returns the URL of the container
|
66 |
-
*
|
67 |
-
* @return string
|
68 |
-
* @throws NoNameError
|
69 |
-
*/
|
70 |
-
public function Url() {
|
71 |
-
if (!$this->name)
|
72 |
-
throw new NoNameError(_('Container does not have an identifier'));
|
73 |
-
return noslash($this->Service()->Url()).'/'.$this->name;
|
74 |
-
}
|
75 |
-
|
76 |
-
/**
|
77 |
-
* Creates a new container with the specified attributes
|
78 |
-
*
|
79 |
-
* @param array $params array of parameters
|
80 |
-
* @return boolean TRUE on success; FALSE on failure
|
81 |
-
* @throws ContainerCreateError
|
82 |
-
*/
|
83 |
-
public function Create($params=array()) {
|
84 |
-
foreach($params as $name => $value) {
|
85 |
-
switch($name) {
|
86 |
-
case 'name':
|
87 |
-
if ($this->is_valid_name($value))
|
88 |
-
$this->name = $value;
|
89 |
-
break;
|
90 |
-
default:
|
91 |
-
$this->$name = $value;
|
92 |
-
}
|
93 |
-
}
|
94 |
-
$this->container_url = $this->Url();
|
95 |
-
$headers = $this->MetadataHeaders();
|
96 |
-
$response = $this->Service()->Request(
|
97 |
-
$this->Url(),
|
98 |
-
'PUT',
|
99 |
-
$headers
|
100 |
-
);
|
101 |
-
|
102 |
-
// check return code
|
103 |
-
if ($response->HttpStatus() > 202) {
|
104 |
-
throw new ContainerCreateError(
|
105 |
-
sprintf(_('Problem creating container [%s] status [%d] '.
|
106 |
-
'response [%s]'),
|
107 |
-
$this->Url(),
|
108 |
-
$response->HttpStatus(),
|
109 |
-
$response->HttpBody()));
|
110 |
-
return FALSE;
|
111 |
-
}
|
112 |
-
return TRUE;
|
113 |
-
}
|
114 |
-
|
115 |
-
/**
|
116 |
-
* Updates the metadata for a container
|
117 |
-
*
|
118 |
-
* @return boolean TRUE on success; FALSE on failure
|
119 |
-
* @throws ContainerCreateError
|
120 |
-
*/
|
121 |
-
public function Update() {
|
122 |
-
$headers = $this->MetadataHeaders();
|
123 |
-
$response = $this->Service()->Request(
|
124 |
-
$this->Url(),
|
125 |
-
'POST',
|
126 |
-
$headers
|
127 |
-
);
|
128 |
-
|
129 |
-
// check return code
|
130 |
-
if ($response->HttpStatus() > 204) {
|
131 |
-
throw new ContainerCreateError(
|
132 |
-
sprintf(_('Problem updating container [%s] status [%d] '.
|
133 |
-
'response [%s]'),
|
134 |
-
$this->Url(),
|
135 |
-
$response->HttpStatus(),
|
136 |
-
$response->HttpBody()));
|
137 |
-
return FALSE;
|
138 |
-
}
|
139 |
-
return TRUE;
|
140 |
-
}
|
141 |
-
|
142 |
-
/**
|
143 |
-
* Deletes the specified container
|
144 |
-
*
|
145 |
-
* @return boolean TRUE on success; FALSE on failure
|
146 |
-
* @throws ContainerDeleteError
|
147 |
-
*/
|
148 |
-
public function Delete() {
|
149 |
-
$response = $this->Service()->Request(
|
150 |
-
$this->Url(),
|
151 |
-
'DELETE'
|
152 |
-
);
|
153 |
-
|
154 |
-
// validate the response code
|
155 |
-
if ($response->HttpStatus() == 404)
|
156 |
-
throw new ContainerNotFoundError(sprintf(
|
157 |
-
_('Container [%s] not found'), $this->name));
|
158 |
-
|
159 |
-
if ($response->HttpStatus() == 409)
|
160 |
-
throw new ContainerNotEmptyError(sprintf(
|
161 |
-
_('Container [%s] must be empty before deleting'),
|
162 |
-
$this->name));
|
163 |
-
|
164 |
-
if ($response->HttpStatus() >= 300) {
|
165 |
-
throw new ContainerDeleteError(
|
166 |
-
sprintf(_('Problem deleting container [%s] status [%d] '.
|
167 |
-
'response [%s]'),
|
168 |
-
$this->Url(),
|
169 |
-
$response->HttpStatus(),
|
170 |
-
$response->HttpBody()));
|
171 |
-
return FALSE;
|
172 |
-
}
|
173 |
-
return TRUE;
|
174 |
-
}
|
175 |
-
|
176 |
-
/**
|
177 |
-
* Creates a Collection of objects in the container
|
178 |
-
*
|
179 |
-
* @param array $params associative array of parameter values.
|
180 |
-
* * account/tenant - The unique identifier of the account/tenant.
|
181 |
-
* * container- The unique identifier of the container.
|
182 |
-
* * limit (Optional) - The number limit of results.
|
183 |
-
* * marker (Optional) - Value of the marker, that the object names
|
184 |
-
* greater in value than are returned.
|
185 |
-
* * end_marker (Optional) - Value of the marker, that the object names
|
186 |
-
* less in value than are returned.
|
187 |
-
* * prefix (Optional) - Value of the prefix, which the returned object
|
188 |
-
* names begin with.
|
189 |
-
* * format (Optional) - Value of the serialized response format, either
|
190 |
-
* json or xml.
|
191 |
-
* * delimiter (Optional) - Value of the delimiter, that all the object
|
192 |
-
* names nested in the container are returned.
|
193 |
-
* @link http://api.openstack.org for a list of possible parameter
|
194 |
-
* names and values
|
195 |
-
* @return OpenCloud\Collection
|
196 |
-
* @throws ObjFetchError
|
197 |
-
*/
|
198 |
-
public function ObjectList($params=array()) {
|
199 |
-
// construct a query string out of the parameters
|
200 |
-
$params['format'] = 'json';
|
201 |
-
$qstring = $this->MakeQueryString($params);
|
202 |
-
|
203 |
-
// append the query string to the URL
|
204 |
-
$url = $this->Url();
|
205 |
-
if (strlen($qstring) > 0)
|
206 |
-
$url .= '?' . $qstring;
|
207 |
-
|
208 |
-
// fetch it
|
209 |
-
return $this->Service()->Collection(
|
210 |
-
'\OpenCloud\ObjectStore\DataObject', $url, $this);
|
211 |
-
} // object_list()
|
212 |
-
|
213 |
-
/**
|
214 |
-
* Returns a new DataObject associated with this container
|
215 |
-
*
|
216 |
-
* @param string $name if supplied, the name of the object to return
|
217 |
-
* @return DataObject
|
218 |
-
*/
|
219 |
-
public function DataObject($name=NULL) {
|
220 |
-
return new DataObject($this, $name);
|
221 |
-
}
|
222 |
-
|
223 |
-
/**
|
224 |
-
* Returns the Service associated with the Container
|
225 |
-
*/
|
226 |
-
public function Service() {
|
227 |
-
return $this->service;
|
228 |
-
}
|
229 |
-
|
230 |
-
/********** PRIVATE METHODS **********/
|
231 |
-
|
232 |
-
/**
|
233 |
-
* Loads the object from the service
|
234 |
-
*
|
235 |
-
* @return void
|
236 |
-
*/
|
237 |
-
protected function Refresh() {
|
238 |
-
$response = $this->Service()->Request(
|
239 |
-
$this->Url(), 'HEAD', array('Accept'=>'*/*'));
|
240 |
-
|
241 |
-
// validate the response code
|
242 |
-
if ($response->HttpStatus() == 404)
|
243 |
-
throw new ContainerNotFoundError(sprintf(
|
244 |
-
_('Container [%s] not found'), $this->name));
|
245 |
-
|
246 |
-
if ($response->HttpStatus() >= 300)
|
247 |
-
throw new \OpenCloud\HttpError(
|
248 |
-
sprintf(
|
249 |
-
_('Error retrieving Container, status [%d]'.
|
250 |
-
' response [%s]'),
|
251 |
-
$response->HttpStatus(),
|
252 |
-
$response->HttpBody()));
|
253 |
-
|
254 |
-
// parse the returned object
|
255 |
-
$this->GetMetadata($response);
|
256 |
-
}
|
257 |
-
|
258 |
-
/**
|
259 |
-
* Validates that the container name is acceptable
|
260 |
-
*
|
261 |
-
* @param string $name the container name to validate
|
262 |
-
* @return boolean TRUE if ok; throws an exception if not
|
263 |
-
* @throws ContainerNameError
|
264 |
-
*/
|
265 |
-
private function is_valid_name($name) {
|
266 |
-
if (($name == NULL) || ($name == ''))
|
267 |
-
throw new ContainerNameError(
|
268 |
-
_('Container name cannot be blank'));
|
269 |
-
if ($name == '0')
|
270 |
-
throw new ContainerNameError(
|
271 |
-
_('"0" is not a valid container name'));
|
272 |
-
if (strpos($name, '/') !== FALSE)
|
273 |
-
throw new ContainerNameError(
|
274 |
-
_('Container name cannot contain "/"'));
|
275 |
-
if (strlen($name) > \OpenCloud\ObjectStore::MAX_CONTAINER_NAME_LEN)
|
276 |
-
throw new ContainerNameError(
|
277 |
-
_('Container name is too long'));
|
278 |
-
return TRUE;
|
279 |
-
}
|
280 |
-
|
281 |
-
} // class CDNContainer
|
282 |
-
|
283 |
-
/**
|
284 |
-
* A regular container with a (potentially) CDN container
|
285 |
-
*
|
286 |
-
* This is the main entry point; CDN containers should only be used internally.
|
287 |
-
*/
|
288 |
-
class Container extends CDNContainer {
|
289 |
-
|
290 |
-
private
|
291 |
-
$_cdn; // holds the related CDN container (if any)
|
292 |
-
|
293 |
-
/**
|
294 |
-
* Makes the container public via the CDN
|
295 |
-
*
|
296 |
-
* @api
|
297 |
-
* @param integer $TTL the Time-To-Live for the CDN container; if NULL,
|
298 |
-
* then the cloud's default value will be used for caching.
|
299 |
-
* @throws CDNNotAvailableError if CDN services are not available
|
300 |
-
* @return CDNContainer
|
301 |
-
*/
|
302 |
-
public function EnableCDN($TTL=NULL) {
|
303 |
-
$url = $this->Service()->CDN()->Url().'/'.$this->name;
|
304 |
-
$headers = $this->MetadataHeaders();
|
305 |
-
if ($TTL && !is_integer($TTL))
|
306 |
-
throw new CdnTtlError(sprintf(
|
307 |
-
_('TTL value [%s] must be an integer'), $TTL));
|
308 |
-
if ($TTL)
|
309 |
-
$headers['X-TTL'] = $TTL;
|
310 |
-
$headers['X-Log-Retention'] = 'True';
|
311 |
-
$headers['X-CDN-Enabled'] = 'True';
|
312 |
-
|
313 |
-
// PUT to the CDN container
|
314 |
-
$response = $this->Service()->Request($url, 'PUT', $headers);
|
315 |
-
|
316 |
-
// check the response status
|
317 |
-
if ($response->HttpStatus() > 202)
|
318 |
-
throw new CdnHttpError(sprintf(
|
319 |
-
_('HTTP error publishing to CDN, status [%d] response [%s]'),
|
320 |
-
$response->HttpStatus(), $response->HttpBody()));
|
321 |
-
|
322 |
-
// refresh the data
|
323 |
-
$this->Refresh();
|
324 |
-
|
325 |
-
// return the CDN container object
|
326 |
-
$this->_cdn = new CDNContainer($this->Service()->CDN(), $this->name);
|
327 |
-
return $this->CDN();
|
328 |
-
}
|
329 |
-
|
330 |
-
/**
|
331 |
-
* a synonym for PublishToCDN for backwards-compatibility
|
332 |
-
*
|
333 |
-
* @api
|
334 |
-
*/
|
335 |
-
public function PublishToCDN($TTL=NULL) {
|
336 |
-
return $this->EnableCDN($TTL);
|
337 |
-
}
|
338 |
-
|
339 |
-
/**
|
340 |
-
* Disables the containers CDN function.
|
341 |
-
*
|
342 |
-
* Note that the container will still be available on the CDN until
|
343 |
-
* its TTL expires.
|
344 |
-
*
|
345 |
-
* @api
|
346 |
-
* @return void
|
347 |
-
*/
|
348 |
-
public function DisableCDN() {
|
349 |
-
$headers['X-Log-Retention'] = 'False';
|
350 |
-
$headers['X-CDN-Enabled'] = 'False';
|
351 |
-
|
352 |
-
// PUT it to the CDN service
|
353 |
-
$response = $this->Service()->Request($this->CDNURL(), 'PUT', $headers);
|
354 |
-
|
355 |
-
// check the response status
|
356 |
-
if ($response->HttpStatus() != 201)
|
357 |
-
throw new CdnHttpError(sprintf(
|
358 |
-
_('HTTP error disabling CDN, status [%d] response [%s]'),
|
359 |
-
$response->HttpStatus(), $response->HttpBody()));
|
360 |
-
}
|
361 |
-
|
362 |
-
/**
|
363 |
-
* Creates a static website from the container
|
364 |
-
*
|
365 |
-
* @api
|
366 |
-
* @link http://docs.rackspace.com/files/api/v1/cf-devguide/content/Create_Static_Website-dle4000.html
|
367 |
-
* @param string $index the index page (starting page) of the website
|
368 |
-
* @return \OpenCloud\HttpResponse
|
369 |
-
*/
|
370 |
-
public function CreateStaticSite($index) {
|
371 |
-
$headers = array('X-Container-Meta-Web-Index'=>$index);
|
372 |
-
$response = $this->Service()->Request($this->Url(), 'POST', $headers);
|
373 |
-
|
374 |
-
// check return code
|
375 |
-
if ($response->HttpStatus() > 204)
|
376 |
-
throw new ContainerError(sprintf(
|
377 |
-
_('Error creating static website for [%s], status [%d] response [%s]'),
|
378 |
-
$this->name, $response->HttpStatus(), $response->HttpBody()));
|
379 |
-
|
380 |
-
return $response;
|
381 |
-
}
|
382 |
-
|
383 |
-
/**
|
384 |
-
* Sets the error page(s) for the static website
|
385 |
-
*
|
386 |
-
* @api
|
387 |
-
* @link http://docs.rackspace.com/files/api/v1/cf-devguide/content/Set_Error_Pages_for_Static_Website-dle4005.html
|
388 |
-
* @param string $name the name of the error page
|
389 |
-
* @return \OpenCloud\HttpResponse
|
390 |
-
*/
|
391 |
-
public function StaticSiteErrorPage($name) {
|
392 |
-
$headers = array('X-Container-Meta-Web-Error'=>$name);
|
393 |
-
$response = $this->Service()->Request($this->Url(), 'POST', $headers);
|
394 |
-
|
395 |
-
// check return code
|
396 |
-
if ($response->HttpStatus() > 204)
|
397 |
-
throw new ContainerError(sprintf(
|
398 |
-
_('Error creating static site error page for [%s], '.
|
399 |
-
'status [%d] response [%s]'),
|
400 |
-
$this->name, $response->HttpStatus(), $response->HttpBody()));
|
401 |
-
|
402 |
-
return $response;
|
403 |
-
}
|
404 |
-
|
405 |
-
/**
|
406 |
-
* Returns the CDN service associated with this container.
|
407 |
-
*/
|
408 |
-
public function CDN() {
|
409 |
-
$cdn = $this->_cdn;
|
410 |
-
if (!$cdn)
|
411 |
-
throw new CdnNotAvailableError(_('CDN service is not available'));
|
412 |
-
return $cdn;
|
413 |
-
}
|
414 |
-
|
415 |
-
/**
|
416 |
-
* Returns the CDN URL of the container (if enabled)
|
417 |
-
*
|
418 |
-
* The CDNURL() is used to manage the container. Note that it is different
|
419 |
-
* from the PublicURL() of the container, which is the publicly-accessible
|
420 |
-
* URL on the network.
|
421 |
-
*
|
422 |
-
* @api
|
423 |
-
* @return string
|
424 |
-
*/
|
425 |
-
public function CDNURL() {
|
426 |
-
return $this->CDN()->Url();
|
427 |
-
}
|
428 |
-
|
429 |
-
/**
|
430 |
-
* Returns the Public URL of the container (on the CDN network)
|
431 |
-
*
|
432 |
-
*/
|
433 |
-
public function PublicURL() {
|
434 |
-
// return $this->CDNURI().'/'.$this->name;
|
435 |
-
return $this->CDNURI();
|
436 |
-
}
|
437 |
-
|
438 |
-
/**
|
439 |
-
* Returns the CDN info about the container
|
440 |
-
*
|
441 |
-
* @api
|
442 |
-
* @return stdClass
|
443 |
-
*/
|
444 |
-
public function CDNinfo($prop=NULL) {
|
445 |
-
|
446 |
-
// return NULL if the CDN container is not enabled
|
447 |
-
if (!isset($this->CDN()->metadata->Enabled))
|
448 |
-
return NULL;
|
449 |
-
if (!$this->CDN()->metadata->Enabled)
|
450 |
-
return NULL;
|
451 |
-
|
452 |
-
// check to see if it's set
|
453 |
-
if (isset($this->CDN()->metadata->$prop))
|
454 |
-
return trim($this->CDN()->metadata->$prop);
|
455 |
-
else if (isset($prop))
|
456 |
-
return NULL;
|
457 |
-
|
458 |
-
// otherwise, return the whole metadata object
|
459 |
-
return $this->CDN()->metadata;
|
460 |
-
}
|
461 |
-
|
462 |
-
/**
|
463 |
-
* Returns the CDN container URI prefix
|
464 |
-
*
|
465 |
-
* @api
|
466 |
-
* @return string
|
467 |
-
*/
|
468 |
-
public function CDNURI() {
|
469 |
-
return $this->CDNinfo('Uri');
|
470 |
-
}
|
471 |
-
|
472 |
-
/**
|
473 |
-
* Returns the SSL URI for the container
|
474 |
-
*
|
475 |
-
* @api
|
476 |
-
* @return string
|
477 |
-
*/
|
478 |
-
public function SSLURI() {
|
479 |
-
return $this->CDNinfo('Ssl-Uri');
|
480 |
-
}
|
481 |
-
|
482 |
-
/**
|
483 |
-
* Returns the streaming URI for the container
|
484 |
-
*
|
485 |
-
* @api
|
486 |
-
* @return string
|
487 |
-
*/
|
488 |
-
public function StreamingURI() {
|
489 |
-
return $this->CDNinfo('Streaming-Uri');
|
490 |
-
}
|
491 |
-
|
492 |
-
/**
|
493 |
-
* Refreshes, then associates the CDN container
|
494 |
-
*/
|
495 |
-
protected function Refresh() {
|
496 |
-
parent::Refresh();
|
497 |
-
|
498 |
-
// find the CDN object
|
499 |
-
$cdn = $this->Service()->CDN();
|
500 |
-
if (isset($cdn)) {
|
501 |
-
try {
|
502 |
-
$this->_cdn = new CDNContainer(
|
503 |
-
$this->Service()->CDN(),
|
504 |
-
$this->name
|
505 |
-
);
|
506 |
-
} catch (ContainerNotFoundError $e) {
|
507 |
-
$this->_cdn = new CDNContainer($cdn);
|
508 |
-
$this->_cdn->name = $this->name;
|
509 |
-
}
|
510 |
-
}
|
511 |
-
}
|
512 |
-
} // class Container
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sdk/OpenCloud/exceptions.php
DELETED
@@ -1,166 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* The exceptions used by php-opencloud
|
4 |
-
*
|
5 |
-
* @copyright 2012-2013 Rackspace Hosting, Inc.
|
6 |
-
* See COPYING for licensing information
|
7 |
-
*
|
8 |
-
* @package phpOpenCloud
|
9 |
-
* @version 1.0
|
10 |
-
* @author Glen Campbell <glen.campbell@rackspace.com>
|
11 |
-
*/
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Top-level exceptions used by shared code
|
15 |
-
*/
|
16 |
-
namespace OpenCloud {
|
17 |
-
|
18 |
-
/**
|
19 |
-
* General Exceptions
|
20 |
-
*/
|
21 |
-
class AttributeError extends \Exception {}
|
22 |
-
class AuthenticationError extends \Exception {}
|
23 |
-
class CollectionError extends \Exception {}
|
24 |
-
class CredentialError extends \Exception {}
|
25 |
-
class DocumentError extends \Exception {}
|
26 |
-
class DomainError extends \Exception {}
|
27 |
-
class EmptyResponseError extends \Exception {}
|
28 |
-
class EndpointError extends \Exception {}
|
29 |
-
class HttpError extends \Exception {}
|
30 |
-
class HttpUnauthorizedError extends \Exception {}
|
31 |
-
class HttpForbiddenError extends \Exception {}
|
32 |
-
class HttpRetryError extends \Exception {}
|
33 |
-
class HttpTimeoutError extends \Exception {}
|
34 |
-
class HttpUrlError extends \Exception {}
|
35 |
-
class HttpOverLimitError extends \Exception {}
|
36 |
-
class IdRequiredError extends \Exception {}
|
37 |
-
class InstanceNotFound extends \Exception {}
|
38 |
-
class InvalidArgumentError extends \Exception {}
|
39 |
-
class JsonError extends \Exception {}
|
40 |
-
class ServerActionError extends \Exception {}
|
41 |
-
class ServiceValueError extends \Exception {}
|
42 |
-
class UnrecognizedServiceError extends \Exception {}
|
43 |
-
class UrlError extends \Exception {}
|
44 |
-
// used by PersistentObject
|
45 |
-
class CreateError extends \Exception {}
|
46 |
-
class DeleteError extends \Exception {}
|
47 |
-
class UpdateError extends \Exception {}
|
48 |
-
class NameError extends \Exception {}
|
49 |
-
class UnsupportedExtensionError extends \Exception {}
|
50 |
-
|
51 |
-
/**
|
52 |
-
* catch-all
|
53 |
-
*/
|
54 |
-
class UnknownError extends \Exception {}
|
55 |
-
|
56 |
-
}
|
57 |
-
|
58 |
-
/**
|
59 |
-
* Exceptions used by the Compute service
|
60 |
-
*/
|
61 |
-
namespace OpenCloud\Compute {
|
62 |
-
|
63 |
-
class ImageError extends \Exception {}
|
64 |
-
class InvalidArgumentError extends \Exception {}
|
65 |
-
class FlavorError extends \Exception {}
|
66 |
-
class InvalidRequestError extends \Exception {}
|
67 |
-
class InvalidParameterError extends \Exception {}
|
68 |
-
class InvalidIpTypeError extends \Exception {}
|
69 |
-
class MetadataError extends \Exception {}
|
70 |
-
class MetadataKeyError extends \Exception {}
|
71 |
-
class MetadataJsonError extends \Exception {}
|
72 |
-
class MetadataCreateError extends \Exception {}
|
73 |
-
class MetadataUpdateError extends \Exception {}
|
74 |
-
class MetadataDeleteError extends \Exception {}
|
75 |
-
class NetworkError extends \Exception {}
|
76 |
-
class NetworkUrlError extends \Exception {}
|
77 |
-
class NetworkCreateError extends \Exception {}
|
78 |
-
class NetworkUpdateError extends \Exception {}
|
79 |
-
class NetworkDeleteError extends \Exception {}
|
80 |
-
class ServerCreateError extends \Exception {}
|
81 |
-
class ServerUpdateError extends \Exception {}
|
82 |
-
class ServerDeleteError extends \Exception {}
|
83 |
-
class ServerIpsError extends \Exception {}
|
84 |
-
class ServerUrlError extends \Exception {}
|
85 |
-
class ServerJsonError extends \Exception {}
|
86 |
-
class UnsupportedFeatureExtension extends \Exception {}
|
87 |
-
class UnsupportedVersionError extends \Exception {}
|
88 |
-
class VolumeError extends \Exception {}
|
89 |
-
|
90 |
-
}
|
91 |
-
|
92 |
-
/**
|
93 |
-
* Exceptions used by the Object Storage service
|
94 |
-
*/
|
95 |
-
namespace OpenCloud\ObjectStore {
|
96 |
-
class CdnError extends \Exception {}
|
97 |
-
class CdnNotAvailableError extends \Exception {}
|
98 |
-
class CdnHttpError extends \Exception {}
|
99 |
-
class CdnTtlError extends \Exception {}
|
100 |
-
class CreateUpdateError extends \Exception {}
|
101 |
-
class ContainerCreateError extends \Exception {}
|
102 |
-
class ContainerDeleteError extends \Exception {}
|
103 |
-
class ContainerError extends \Exception {}
|
104 |
-
class ContainerNameError extends \Exception {}
|
105 |
-
class ContainerNotFoundError extends \Exception {}
|
106 |
-
class ContainerNotEmptyError extends \Exception {}
|
107 |
-
class DeleteError extends \Exception {}
|
108 |
-
class IOError extends \Exception {}
|
109 |
-
class MetadataPrefixError extends \Exception {}
|
110 |
-
class MisMatchedChecksumError extends \Exception {}
|
111 |
-
class NoNameError extends \Exception {}
|
112 |
-
class NoContentTypeError extends \Exception {}
|
113 |
-
class ObjectError extends \Exception {} // SyntaxException
|
114 |
-
class ObjectCopyError extends \Exception {}
|
115 |
-
class ObjFetchError extends \Exception {}
|
116 |
-
class TempUrlMethodError extends \Exception {}
|
117 |
-
class UnknownParameterError extends \Exception {}
|
118 |
-
}
|
119 |
-
|
120 |
-
/**
|
121 |
-
* Exceptions used by the Cloud Databases service
|
122 |
-
*/
|
123 |
-
namespace OpenCloud\DbService {
|
124 |
-
class DatabaseCreateError extends \Exception {}
|
125 |
-
class DatabaseDeleteError extends \Exception {}
|
126 |
-
class DatabaseListError extends \Exception {}
|
127 |
-
class DatabaseUpdateError extends \Exception {}
|
128 |
-
class DatabaseNameError extends \Exception {}
|
129 |
-
class InstanceCreateError extends \Exception {}
|
130 |
-
class InstanceDeleteError extends \Exception {}
|
131 |
-
class InstanceUpdateError extends \Exception {}
|
132 |
-
class InstanceError extends \Exception {}
|
133 |
-
class InstanceFlavorError extends \Exception {}
|
134 |
-
class InvalidIdTypeError extends \Exception {}
|
135 |
-
class UserCreateError extends \Exception {}
|
136 |
-
class UserDeleteError extends \Exception {}
|
137 |
-
class UserListError extends \Exception {}
|
138 |
-
class UserUpdateError extends \Exception {}
|
139 |
-
class UserNameError extends \Exception {}
|
140 |
-
}
|
141 |
-
|
142 |
-
/**
|
143 |
-
* Exceptions used by the Cloud Block Storage (CBS) service
|
144 |
-
*/
|
145 |
-
namespace OpenCloud\VolumeService {
|
146 |
-
class SnapshotError extends \Exception {}
|
147 |
-
class VolumeError extends \Exception {}
|
148 |
-
class VolumeTypeError extends \Exception {}
|
149 |
-
}
|
150 |
-
|
151 |
-
/**
|
152 |
-
* Exceptions used by the LoadBalancerService
|
153 |
-
*/
|
154 |
-
namespace OpenCloud\LoadBalancerService {
|
155 |
-
class MissingValueError extends \Exception {}
|
156 |
-
}
|
157 |
-
|
158 |
-
/**
|
159 |
-
* Exceptions used by the DNS service
|
160 |
-
*/
|
161 |
-
namespace OpenCloud\DNS {
|
162 |
-
class AsyncHttpError extends \Exception {}
|
163 |
-
class AsyncError extends \Exception {}
|
164 |
-
class AsyncTimeoutError extends \Exception {}
|
165 |
-
class RecordTypeError extends \Exception {}
|
166 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sdk/OpenCloud/lbresources.php
DELETED
@@ -1,551 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Defines a a number of classes that are child resources of LoadBalancer
|
4 |
-
*
|
5 |
-
* @copyright 2012-2013 Rackspace Hosting, Inc.
|
6 |
-
* See COPYING for licensing information
|
7 |
-
*
|
8 |
-
* @package phpOpenCloud
|
9 |
-
* @version 1.0
|
10 |
-
* @author Glen Campbell <glen.campbell@rackspace.com>
|
11 |
-
*/
|
12 |
-
|
13 |
-
namespace OpenCloud\LoadBalancerService;
|
14 |
-
|
15 |
-
require_once(__DIR__.'/persistentobject.php');
|
16 |
-
|
17 |
-
/**
|
18 |
-
* SubResource is an abstract class that handles subresources of a
|
19 |
-
* LoadBalancer object; for example, the
|
20 |
-
* `/loadbalancers/{id}/errorpage`. Since most of the subresources are
|
21 |
-
* handled in a similar manner, this consolidates the functions.
|
22 |
-
*
|
23 |
-
* There are really four pieces of data that define a subresource:
|
24 |
-
* * `$url_resource` - the actual name of the url component
|
25 |
-
* * `$json_name` - the name of the JSON object holding the data
|
26 |
-
* * `$json_collection_name` - if the collection is not simply
|
27 |
-
* `$json_name . 's'`, this defines the collectio name.
|
28 |
-
* * `$json_collection_element` - if the object in a collection is not
|
29 |
-
* anonymous, this defines the name of the element holding the object.
|
30 |
-
* Of these, only the `$json_name` and `$url_resource` are required.
|
31 |
-
*/
|
32 |
-
abstract class SubResource extends \OpenCloud\PersistentObject {
|
33 |
-
private
|
34 |
-
$parent; // holds the parent load balancer
|
35 |
-
|
36 |
-
/**
|
37 |
-
* constructs the SubResource's object
|
38 |
-
*
|
39 |
-
* @param mixed $obj the parent object
|
40 |
-
* @param mixed $value the ID or array of values for the object
|
41 |
-
*/
|
42 |
-
public function __construct($obj, $value=NULL) {
|
43 |
-
$this->parent = $obj;
|
44 |
-
parent::__construct($obj->Service(), $value);
|
45 |
-
/**
|
46 |
-
* Note that, since these sub-resources do not have an ID, we must
|
47 |
-
* fake out the `Refresh` method.
|
48 |
-
*/
|
49 |
-
if (isset($this->id))
|
50 |
-
$this->Refresh();
|
51 |
-
else
|
52 |
-
$this->Refresh('<no-id>');
|
53 |
-
}
|
54 |
-
|
55 |
-
/**
|
56 |
-
* returns the URL of the SubResource
|
57 |
-
*
|
58 |
-
* @api
|
59 |
-
* @param string $subresource the subresource of the parent
|
60 |
-
* @param array $qstr an array of key/value pairs to be converted to
|
61 |
-
* query string parameters for the subresource
|
62 |
-
* @return string
|
63 |
-
*/
|
64 |
-
public function Url($subresource=NULL, $qstr=array()) {
|
65 |
-
return $this->Parent()->Url($this->ResourceName());
|
66 |
-
}
|
67 |
-
|
68 |
-
/**
|
69 |
-
* returns the JSON document's object for creating the subresource
|
70 |
-
*
|
71 |
-
* The value `$_create_keys` should be an array of names of data items
|
72 |
-
* that can be used in the creation of the object.
|
73 |
-
*
|
74 |
-
* @return \stdClass;
|
75 |
-
*/
|
76 |
-
protected function CreateJson() {
|
77 |
-
$obj = new \stdClass();
|
78 |
-
$top = $this->JsonName();
|
79 |
-
if ($top) {
|
80 |
-
$obj->$top = new \stdClass();
|
81 |
-
foreach($this->_create_keys as $item)
|
82 |
-
$obj->$top->$item = $this->$item;
|
83 |
-
}
|
84 |
-
else {
|
85 |
-
foreach($this->_create_keys as $item)
|
86 |
-
$obj->$item = $this->$item;
|
87 |
-
}
|
88 |
-
return $obj;
|
89 |
-
}
|
90 |
-
|
91 |
-
/**
|
92 |
-
* returns the JSON for the update (same as create)
|
93 |
-
*
|
94 |
-
* For these subresources, the update JSON is the same as the Create JSON
|
95 |
-
* @return \stdClass
|
96 |
-
*/
|
97 |
-
protected function UpdateJson($params = array()) {
|
98 |
-
return $this->CreateJson();
|
99 |
-
}
|
100 |
-
|
101 |
-
/**
|
102 |
-
* returns the Parent object (usually a LoadBalancer, but sometimes another
|
103 |
-
* SubResource)
|
104 |
-
*
|
105 |
-
* @return mixed
|
106 |
-
*/
|
107 |
-
public function Parent() {
|
108 |
-
return $this->parent;
|
109 |
-
}
|
110 |
-
|
111 |
-
/**
|
112 |
-
* returns a (default) name of the object
|
113 |
-
*
|
114 |
-
* The name is constructed by the object class and the object's ID.
|
115 |
-
*
|
116 |
-
* @api
|
117 |
-
* @return string
|
118 |
-
*/
|
119 |
-
public function Name() {
|
120 |
-
return sprintf(_('%s-%s'),
|
121 |
-
get_class($this), $this->Parent()->Id());
|
122 |
-
}
|
123 |
-
} // end SubResource
|
124 |
-
|
125 |
-
/**
|
126 |
-
* This defines a read-only SubResource - one that cannot be created, updated,
|
127 |
-
* or deleted. Many subresources are like this, and this simplifies their
|
128 |
-
* class definitions.
|
129 |
-
*/
|
130 |
-
abstract class ReadonlySubResource extends SubResource {
|
131 |
-
/**
|
132 |
-
* no Create
|
133 |
-
*/
|
134 |
-
public function Create($params=array()) { $this->NoCreate(); }
|
135 |
-
/**
|
136 |
-
* no Update
|
137 |
-
*/
|
138 |
-
public function Update($params=array()) { $this->NoUpdate(); }
|
139 |
-
/**
|
140 |
-
* no Delete
|
141 |
-
*/
|
142 |
-
public function Delete() { $this->NoDelete(); }
|
143 |
-
} // end class ReadonlySubResource
|
144 |
-
|
145 |
-
/**
|
146 |
-
* The /loadbalancer/{id}/errorpage manages the error page for the load
|
147 |
-
* balancer.
|
148 |
-
*/
|
149 |
-
class ErrorPage extends SubResource {
|
150 |
-
public
|
151 |
-
$content;
|
152 |
-
protected static
|
153 |
-
$json_name = 'errorpage',
|
154 |
-
$url_resource = 'errorpage';
|
155 |
-
protected
|
156 |
-
$_create_keys = array('content');
|
157 |
-
/**
|
158 |
-
* creates a new error page
|
159 |
-
*
|
160 |
-
* This calls the Update() method, since it requires a PUT to create
|
161 |
-
* a new error page. A POST request is not supported, since the URL
|
162 |
-
* resource is already defined.
|
163 |
-
*
|
164 |
-
* @param array $parm array of parameters
|
165 |
-
*/
|
166 |
-
public function Create($parm=array()) { $this->Update($parm); }
|
167 |
-
} // end ErrorPage
|
168 |
-
|
169 |
-
/**
|
170 |
-
* Stats returns statistics about the load balancer
|
171 |
-
*/
|
172 |
-
class Stats extends ReadonlySubResource {
|
173 |
-
public
|
174 |
-
$connectTimeOut,
|
175 |
-
$connectError,
|
176 |
-
$connectFailure,
|
177 |
-
$dataTimedOut,
|
178 |
-
$keepAliveTimedOut,
|
179 |
-
$maxConn;
|
180 |
-
protected static
|
181 |
-
$json_name = FALSE,
|
182 |
-
$url_resource = 'stats';
|
183 |
-
}
|
184 |
-
|
185 |
-
/**
|
186 |
-
* information on a single node in the load balancer
|
187 |
-
*
|
188 |
-
* This extends `PersistentObject` because it has an ID, unlike most other
|
189 |
-
* sub-resources.
|
190 |
-
*/
|
191 |
-
class Node extends \OpenCloud\PersistentObject {
|
192 |
-
public
|
193 |
-
$id,
|
194 |
-
$address,
|
195 |
-
$port,
|
196 |
-
$condition,
|
197 |
-
$status,
|
198 |
-
$weight,
|
199 |
-
$type;
|
200 |
-
protected static
|
201 |
-
$json_name = FALSE,
|
202 |
-
$json_collection_name = 'nodes',
|
203 |
-
$url_resource = 'nodes';
|
204 |
-
private
|
205 |
-
$_create_keys = array(
|
206 |
-
'address',
|
207 |
-
'port',
|
208 |
-
'condition',
|
209 |
-
'type',
|
210 |
-
'weight'
|
211 |
-
),
|
212 |
-
$_lb;
|
213 |
-
/**
|
214 |
-
* builds a new Node object
|
215 |
-
*
|
216 |
-
* @param LoadBalancer $lb the parent LB object
|
217 |
-
* @param mixed $info either an ID or an array of values
|
218 |
-
* @returns void
|
219 |
-
*/
|
220 |
-
public function __construct(LoadBalancer $lb, $info=NULL) {
|
221 |
-
$this->_lb = $lb;
|
222 |
-
parent::__construct($lb->Service(), $info);
|
223 |
-
}
|
224 |
-
/**
|
225 |
-
* returns the parent LoadBalancer object
|
226 |
-
*
|
227 |
-
* @return LoadBalancer
|
228 |
-
*/
|
229 |
-
public function Parent() {
|
230 |
-
return $this->_lb;
|
231 |
-
}
|
232 |
-
/**
|
233 |
-
* returns the Node name
|
234 |
-
*
|
235 |
-
* @return string
|
236 |
-
*/
|
237 |
-
public function Name() {
|
238 |
-
return get_class().'['.$this->Id().']';
|
239 |
-
}
|
240 |
-
/**
|
241 |
-
* returns the object for the Create JSON
|
242 |
-
*
|
243 |
-
* @return \stdClass
|
244 |
-
*/
|
245 |
-
protected function CreateJson() {
|
246 |
-
$obj = new \stdClass();
|
247 |
-
$obj->nodes = array();
|
248 |
-
$node = new \stdClass();
|
249 |
-
$node->node = new \stdClass();
|
250 |
-
foreach($this->_create_keys as $key) {
|
251 |
-
$node->node->$key = $this->$key;
|
252 |
-
}
|
253 |
-
$obj->nodes[] = $node;
|
254 |
-
return $obj;
|
255 |
-
}
|
256 |
-
|
257 |
-
/**
|
258 |
-
* factory method to create a new Metadata child of the Node
|
259 |
-
*
|
260 |
-
* @api
|
261 |
-
* @return Metadata
|
262 |
-
*/
|
263 |
-
public function Metadata($data=NULL) {
|
264 |
-
return new Metadata($this, $data);
|
265 |
-
}
|
266 |
-
|
267 |
-
/**
|
268 |
-
* factory method to create a Collection of Metadata object
|
269 |
-
*
|
270 |
-
* Note that these are metadata children of the Node, not of the
|
271 |
-
* LoadBalancer.
|
272 |
-
*
|
273 |
-
* @api
|
274 |
-
* @return Collection of Metadata
|
275 |
-
*/
|
276 |
-
public function MetadataList() {
|
277 |
-
return $this->Service()->Collection(
|
278 |
-
'\OpenCloud\LoadBalancerService\Metadata', NULL, $this);
|
279 |
-
}
|
280 |
-
}
|
281 |
-
|
282 |
-
/**
|
283 |
-
* a single node event, usually called as part of a Collection
|
284 |
-
*
|
285 |
-
* This is a read-only subresource.
|
286 |
-
*/
|
287 |
-
class NodeEvent extends ReadonlySubResource {
|
288 |
-
public
|
289 |
-
$detailedMessage,
|
290 |
-
$nodeId,
|
291 |
-
$id,
|
292 |
-
$type,
|
293 |
-
$description,
|
294 |
-
$category,
|
295 |
-
$severity,
|
296 |
-
$relativeUri,
|
297 |
-
$accountId,
|
298 |
-
$loadbalancerId,
|
299 |
-
$title,
|
300 |
-
$author,
|
301 |
-
$created;
|
302 |
-
protected static
|
303 |
-
$json_name = 'nodeServiceEvent',
|
304 |
-
$url_resource = 'nodes/events';
|
305 |
-
}
|
306 |
-
|
307 |
-
/**
|
308 |
-
* sub-resource to manage allowed domains
|
309 |
-
*
|
310 |
-
* Note that this is actually a sub-resource of the load balancers service,
|
311 |
-
* and not of the load balancer object. It's included here for convenience,
|
312 |
-
* since it matches the pattern of the other LB subresources.
|
313 |
-
*
|
314 |
-
* @api
|
315 |
-
*/
|
316 |
-
class AllowedDomain extends \OpenCloud\PersistentObject {
|
317 |
-
public
|
318 |
-
$name;
|
319 |
-
protected static
|
320 |
-
$json_name = 'allowedDomain',
|
321 |
-
$json_collection_name = 'allowedDomains',
|
322 |
-
$json_collection_element = 'allowedDomain',
|
323 |
-
$url_resource = 'loadbalancers/alloweddomains';
|
324 |
-
public function Create($params=array()) { $this->NoCreate(); }
|
325 |
-
public function Update($params=array()) { $this->NoUpdate(); }
|
326 |
-
public function Delete() { $this->NoDelete(); }
|
327 |
-
}
|
328 |
-
|
329 |
-
/**
|
330 |
-
* VirtualIp represents a single virtual IP (usually returned in a Collection)
|
331 |
-
*
|
332 |
-
* Virtual IPs can be added to a load balancer when it is created; however,
|
333 |
-
* this subresource allows the user to add or update them one at a time.
|
334 |
-
*
|
335 |
-
* @api
|
336 |
-
*/
|
337 |
-
class VirtualIp extends SubResource {
|
338 |
-
public
|
339 |
-
$id,
|
340 |
-
$address,
|
341 |
-
$type,
|
342 |
-
$ipVersion;
|
343 |
-
protected static
|
344 |
-
$json_collection_name = 'virtualIps',
|
345 |
-
$json_name = FALSE,
|
346 |
-
$url_resource = 'virtualips';
|
347 |
-
protected
|
348 |
-
$_create_keys = array('type', 'ipVersion');
|
349 |
-
public function Update($params=array()) { $this->NoUpdate(); }
|
350 |
-
}
|
351 |
-
|
352 |
-
/**
|
353 |
-
* used to get usage data for a load balancer
|
354 |
-
*/
|
355 |
-
class Usage extends ReadonlySubResource {
|
356 |
-
public
|
357 |
-
$id,
|
358 |
-
$averageNumConnections,
|
359 |
-
$incomingTransfer,
|
360 |
-
$outgoingTransfer,
|
361 |
-
$averageNumConnectionsSsl,
|
362 |
-
$incomingTransferSsl,
|
363 |
-
$outgoingTransferSsl,
|
364 |
-
$numVips,
|
365 |
-
$numPolls,
|
366 |
-
$startTime,
|
367 |
-
$endTime,
|
368 |
-
$vipType,
|
369 |
-
$sslMode,
|
370 |
-
$eventType;
|
371 |
-
protected static
|
372 |
-
$json_name = 'loadBalancerUsageRecord',
|
373 |
-
$url_resource = 'usage';
|
374 |
-
} // end Usage
|
375 |
-
|
376 |
-
/**
|
377 |
-
* sub-resource to manage access lists
|
378 |
-
*
|
379 |
-
* @api
|
380 |
-
*/
|
381 |
-
class Access extends SubResource {
|
382 |
-
public
|
383 |
-
$id,
|
384 |
-
$type,
|
385 |
-
$address;
|
386 |
-
protected static
|
387 |
-
$json_name = "accessList",
|
388 |
-
$url_resource = "accesslist";
|
389 |
-
protected
|
390 |
-
$_create_keys = array('type', 'address');
|
391 |
-
public function Update($params=array()) { $this->NoUpdate(); }
|
392 |
-
}
|
393 |
-
|
394 |
-
/**
|
395 |
-
* sub-resource to read health monitor info
|
396 |
-
*/
|
397 |
-
class HealthMonitor extends ReadonlySubResource {
|
398 |
-
public
|
399 |
-
$type;
|
400 |
-
protected static
|
401 |
-
$json_name = 'healthMonitor',
|
402 |
-
$url_resource = 'healthmonitor';
|
403 |
-
} // end HealthMonitor
|
404 |
-
|
405 |
-
/**
|
406 |
-
* sub-resource to manage connection throttling
|
407 |
-
*
|
408 |
-
* @api
|
409 |
-
*/
|
410 |
-
class ConnectionThrottle extends SubResource {
|
411 |
-
public
|
412 |
-
$minConnections,
|
413 |
-
$maxConnections,
|
414 |
-
$maxConnectionRate,
|
415 |
-
$rateInterval;
|
416 |
-
protected static
|
417 |
-
$json_name = "connectionThrottle",
|
418 |
-
$url_resource = "connectionthrottle";
|
419 |
-
protected
|
420 |
-
$_create_keys = array(
|
421 |
-
'minConnections',
|
422 |
-
'maxConnections',
|
423 |
-
'maxConnectionRate',
|
424 |
-
'rateInterval'
|
425 |
-
);
|
426 |
-
/**
|
427 |
-
* create uses PUT like Update
|
428 |
-
*/
|
429 |
-
public function Create($parm=array()) { $this->Update($parm); }
|
430 |
-
}
|
431 |
-
|
432 |
-
/**
|
433 |
-
* sub-resource to manage connection logging
|
434 |
-
*
|
435 |
-
* @api
|
436 |
-
*/
|
437 |
-
class ConnectionLogging extends SubResource {
|
438 |
-
public
|
439 |
-
$enabled;
|
440 |
-
protected static
|
441 |
-
$json_name = "connectionLogging",
|
442 |
-
$url_resource = "connectionlogging";
|
443 |
-
protected
|
444 |
-
$_create_keys = array( 'enabled' );
|
445 |
-
public function Create($params=array()) { $this->Update($params); }
|
446 |
-
public function Delete() { $this->NoDelete(); }
|
447 |
-
}
|
448 |
-
|
449 |
-
/**
|
450 |
-
* sub-resource to manage content caching
|
451 |
-
*
|
452 |
-
* @api
|
453 |
-
*/
|
454 |
-
class ContentCaching extends SubResource {
|
455 |
-
public
|
456 |
-
$enabled;
|
457 |
-
protected static
|
458 |
-
$json_name = "contentCaching",
|
459 |
-
$url_resource = "contentcaching";
|
460 |
-
protected
|
461 |
-
$_create_keys = array( 'enabled' );
|
462 |
-
public function Create($parm=array()) { $this->Update($parm); }
|
463 |
-
public function Delete() { $this->NoDelete(); }
|
464 |
-
}
|
465 |
-
|
466 |
-
/**
|
467 |
-
* sub-resource to manage session persistence setting
|
468 |
-
*/
|
469 |
-
class SessionPersistence extends SubResource {
|
470 |
-
public
|
471 |
-
$persistenceType;
|
472 |
-
protected static
|
473 |
-
$json_name = 'sessionPersistence',
|
474 |
-
$url_resource = 'sessionpersistence';
|
475 |
-
private
|
476 |
-
$_create_keys = array('persistenceType');
|
477 |
-
}
|
478 |
-
|
479 |
-
/**
|
480 |
-
* sub-resource to manage protocols (read-only)
|
481 |
-
*/
|
482 |
-
class Protocol extends \OpenCloud\PersistentObject {
|
483 |
-
public
|
484 |
-
$name,
|
485 |
-
$port;
|
486 |
-
protected static
|
487 |
-
$json_name = 'protocol',
|
488 |
-
$url_resource = 'loadbalancers/protocols';
|
489 |
-
public function Create($params=array()) { $this->NoCreate(); }
|
490 |
-
public function Update($params=array()) { $this->NoUpdate(); }
|
491 |
-
public function Delete() { $this->NoDelete(); }
|
492 |
-
}
|
493 |
-
|
494 |
-
/**
|
495 |
-
* sub-resource to manage algorithms (read-only)
|
496 |
-
*/
|
497 |
-
class Algorithm extends \OpenCloud\PersistentObject {
|
498 |
-
public
|
499 |
-
$name;
|
500 |
-
protected static
|
501 |
-
$json_name = 'algorithm',
|
502 |
-
$url_resource = 'loadbalancers/algorithms';
|
503 |
-
public function Create($params=array()) { $this->NoCreate(); }
|
504 |
-
public function Update($params=array()) { $this->NoUpdate(); }
|
505 |
-
public function Delete() { $this->NoDelete(); }
|
506 |
-
}
|
507 |
-
|
508 |
-
/**
|
509 |
-
* sub-resource to manage SSL termination
|
510 |
-
*/
|
511 |
-
class SSLTermination extends SubResource {
|
512 |
-
public
|
513 |
-
$certificate,
|
514 |
-
$enabled,
|
515 |
-
$secureTrafficOnly,
|
516 |
-
$privatekey,
|
517 |
-
$intermediateCertificate,
|
518 |
-
$securePort;
|
519 |
-
protected static
|
520 |
-
$json_name = "sslTermination",
|
521 |
-
$url_resource = "ssltermination";
|
522 |
-
protected
|
523 |
-
$_create_keys = array(
|
524 |
-
'certificate',
|
525 |
-
'enabled',
|
526 |
-
'secureTrafficOnly',
|
527 |
-
'privatekey',
|
528 |
-
'intermediateCertificate',
|
529 |
-
'securePort'
|
530 |
-
);
|
531 |
-
public function Create($params=array()) { $this->Update($params); }
|
532 |
-
}
|
533 |
-
|
534 |
-
/**
|
535 |
-
* sub-resource to manage Metadata
|
536 |
-
*/
|
537 |
-
class Metadata extends SubResource {
|
538 |
-
public
|
539 |
-
$id,
|
540 |
-
$key,
|
541 |
-
$value;
|
542 |
-
protected static
|
543 |
-
$json_name = 'meta',
|
544 |
-
$json_collection_name = 'metadata',
|
545 |
-
$url_resource = 'metadata';
|
546 |
-
protected
|
547 |
-
$_create_keys = array('key', 'value');
|
548 |
-
public function Name() {
|
549 |
-
return $this->key;
|
550 |
-
}
|
551 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sdk/OpenCloud/objectstore.php
DELETED
@@ -1,221 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* The Object Storage service
|
4 |
-
*
|
5 |
-
* @copyright 2012-2013 Rackspace Hosting, Inc.
|
6 |
-
* See COPYING for licensing information
|
7 |
-
*
|
8 |
-
* @package phpOpenCloud
|
9 |
-
* @version 1.0
|
10 |
-
* @author Glen Campbell <glen.campbell@rackspace.com>
|
11 |
-
*/
|
12 |
-
|
13 |
-
namespace OpenCloud;
|
14 |
-
|
15 |
-
require_once(__DIR__.'/service.php');
|
16 |
-
require_once(__DIR__.'/container.php');
|
17 |
-
|
18 |
-
define('SWIFT_MAX_OBJECT_SIZE', 5*1024*1024*1024+1);
|
19 |
-
|
20 |
-
/**
|
21 |
-
* A base class for common code shared between the ObjectStore and
|
22 |
-
* ObjectStoreCDN
|
23 |
-
* objects
|
24 |
-
*
|
25 |
-
* @author Glen Campbell <glen.campbell@rackspace.com>
|
26 |
-
*/
|
27 |
-
class ObjectStoreBase extends Service {
|
28 |
-
|
29 |
-
const
|
30 |
-
MAX_CONTAINER_NAME_LEN = 256,
|
31 |
-
MAX_OBJECT_NAME_LEN = 1024,
|
32 |
-
MAX_OBJECT_SIZE = SWIFT_MAX_OBJECT_SIZE;
|
33 |
-
|
34 |
-
/**
|
35 |
-
* Returns the URL of the service, selected from the connection's
|
36 |
-
* serviceCatalog
|
37 |
-
*/
|
38 |
-
public function Url($param=array()) {
|
39 |
-
return noslash(parent::Url($param));
|
40 |
-
}
|
41 |
-
|
42 |
-
/**
|
43 |
-
* Creates a Container object associated with the ObjectStore
|
44 |
-
*
|
45 |
-
* This is a factory method and should generally be used instead of
|
46 |
-
* calling the Container class directly.
|
47 |
-
*
|
48 |
-
* @param mixed $cdata (optional) the name of the container (if string)
|
49 |
-
* or an object from which to set values
|
50 |
-
* @return ObjectStore\Container
|
51 |
-
*/
|
52 |
-
public function Container($cdata=NULL) {
|
53 |
-
return new ObjectStore\Container($this, $cdata);
|
54 |
-
}
|
55 |
-
|
56 |
-
/**
|
57 |
-
* Returns a Collection of Container objects
|
58 |
-
*
|
59 |
-
* This is a factory method and should generally be used instead of
|
60 |
-
* calling the ContainerList class directly.
|
61 |
-
*
|
62 |
-
* @param array $filter a list of key-value pairs to pass to the
|
63 |
-
* service to filter the results
|
64 |
-
* @return ObjectStore\ContainerList
|
65 |
-
*/
|
66 |
-
public function ContainerList($filter=array()) {
|
67 |
-
$filter['format'] = 'json';
|
68 |
-
return $this->Collection(
|
69 |
-
'\OpenCloud\ObjectStore\Container',
|
70 |
-
$this->Url().'?'.$this->MakeQueryString($filter)
|
71 |
-
);
|
72 |
-
}
|
73 |
-
|
74 |
-
} // class ObjectStoreBase
|
75 |
-
|
76 |
-
/**
|
77 |
-
* ObjectStore - this defines the object-store (Cloud Files) service.
|
78 |
-
*
|
79 |
-
* Usage:
|
80 |
-
* <code>
|
81 |
-
* $conn = new OpenStack('{URL}', '{SECRET}');
|
82 |
-
* $ostore = new OpenCloud\ObjectStore(
|
83 |
-
* $conn,
|
84 |
-
* 'service name',
|
85 |
-
* 'service region',
|
86 |
-
* 'URL type'
|
87 |
-
* );
|
88 |
-
* </code>
|
89 |
-
*
|
90 |
-
* Default values for service name, service region, and urltype can be
|
91 |
-
* provided via the global constants RAXSDK_OBJSTORE_NAME,
|
92 |
-
* RAXSDK_OBJSTORE_REGION, and RAXSDK_OBJSTORE_URLTYPE.
|
93 |
-
*
|
94 |
-
* @author Glen Campbell <glen.campbell@rackspace.com>
|
95 |
-
*/
|
96 |
-
class ObjectStore extends ObjectStoreBase {
|
97 |
-
private
|
98 |
-
/**
|
99 |
-
* This holds the associated CDN object (for Rackspace public cloud)
|
100 |
-
* or is NULL otherwise. The existence of an object here is
|
101 |
-
* indicative that the CDN service is available.
|
102 |
-
*/
|
103 |
-
$cdn;
|
104 |
-
|
105 |
-
/**
|
106 |
-
* creates a new ObjectStore object
|
107 |
-
*
|
108 |
-
* @param OpenCloud\OpenStack $conn a connection object
|
109 |
-
* @param string $serviceName the name of the service to use
|
110 |
-
* @param string $serviceRegion the name of the service region to use
|
111 |
-
* @param string $urltype the type of URL to use (usually "publicURL")
|
112 |
-
*/
|
113 |
-
public function __construct(
|
114 |
-
OpenStack $conn,
|
115 |
-
$serviceName=RAXSDK_OBJSTORE_NAME,
|
116 |
-
$serviceRegion=RAXSDK_OBJSTORE_REGION,
|
117 |
-
$urltype=RAXSDK_OBJSTORE_URLTYPE) {
|
118 |
-
$this->debug(_('initializing ObjectStore...'));
|
119 |
-
|
120 |
-
// call the parent contructor
|
121 |
-
parent::__construct(
|
122 |
-
$conn,
|
123 |
-
'object-store',
|
124 |
-
$serviceName,
|
125 |
-
$serviceRegion,
|
126 |
-
$urltype
|
127 |
-
);
|
128 |
-
|
129 |
-
// establish the CDN container, if available
|
130 |
-
try {
|
131 |
-
$this->cdn = new ObjectStoreCDN(
|
132 |
-
$conn,
|
133 |
-
$serviceName.'CDN', // will work for Rackspace
|
134 |
-
$serviceRegion,
|
135 |
-
$urltype
|
136 |
-
);
|
137 |
-
} catch (\OpenCloud\EndpointError $e) {
|
138 |
-
/**
|
139 |
-
* if we have an endpoint error, then
|
140 |
-
* the CDN functionality is not available
|
141 |
-
* In this case, we silently ignore it.
|
142 |
-
*/
|
143 |
-
$this->cdn = NULL;
|
144 |
-
}
|
145 |
-
} // function __construct()
|
146 |
-
|
147 |
-
/**
|
148 |
-
* sets the shared secret value for the TEMP_URL
|
149 |
-
*
|
150 |
-
* @param string $secret the shared secret
|
151 |
-
* @return HttpResponse
|
152 |
-
*/
|
153 |
-
public function SetTempUrlSecret($secret) {
|
154 |
-
$resp = $this->Request($this->Url(), 'POST',
|
155 |
-
array('X-Account-Meta-Temp-URL-Key' => $secret));
|
156 |
-
if ($resp->HttpStatus() > 204)
|
157 |
-
throw new \OpenCloud\HttpError(sprintf(
|
158 |
-
_('Error in request, status [%d] for URL [%s] [%s]'),
|
159 |
-
$resp->HttpStatus(),
|
160 |
-
$this->Url(),
|
161 |
-
$resp->HttpBody()));
|
162 |
-
return $resp;
|
163 |
-
}
|
164 |
-
|
165 |
-
/**
|
166 |
-
* returns the CDN object
|
167 |
-
*/
|
168 |
-
public function CDN() {
|
169 |
-
return $this->cdn;
|
170 |
-
}
|
171 |
-
}
|
172 |
-
|
173 |
-
/**
|
174 |
-
* This is the CDN related to the ObjectStore
|
175 |
-
*
|
176 |
-
* This is intended for Rackspace customers, so it almost certainly will
|
177 |
-
* not work for other public clouds.
|
178 |
-
*
|
179 |
-
* @param OpenCloud\OpenStack $conn a connection object
|
180 |
-
* @param string $serviceName the name of the service to use
|
181 |
-
* @param string $serviceRegion the name of the service region to use
|
182 |
-
* @param string $urltype the type of URL to use (usually "publicURL")
|
183 |
-
*/
|
184 |
-
class ObjectStoreCDN extends ObjectStoreBase {
|
185 |
-
|
186 |
-
/**
|
187 |
-
* Creates a new ObjectStoreCDN object
|
188 |
-
*
|
189 |
-
* This is a simple wrapper function around the parent Service construct,
|
190 |
-
* but supplies defaults for the service type.
|
191 |
-
*
|
192 |
-
* @param OpenStack $conn the connection object
|
193 |
-
* @param string $serviceName the name of the service
|
194 |
-
* @param string $serviceRegion the service's region
|
195 |
-
* @param string $urlType the type of URL (normally 'publicURL')
|
196 |
-
*/
|
197 |
-
public function __construct(
|
198 |
-
OpenStack $conn,
|
199 |
-
$serviceName=RAXSDK_OBJSTORE_NAME,
|
200 |
-
$serviceRegion=RAXSDK_OBJSTORE_REGION,
|
201 |
-
$urltype=RAXSDK_OBJSTORE_URLTYPE) {
|
202 |
-
|
203 |
-
// call the parent contructor
|
204 |
-
parent::__construct(
|
205 |
-
$conn,
|
206 |
-
'rax:object-cdn',
|
207 |
-
$serviceName,
|
208 |
-
$serviceRegion,
|
209 |
-
$urltype
|
210 |
-
);
|
211 |
-
}
|
212 |
-
|
213 |
-
/**
|
214 |
-
* Helps catch errors if someone calls the method on the
|
215 |
-
* wrong object
|
216 |
-
*/
|
217 |
-
public function CDN() {
|
218 |
-
throw new ObjectStore\CdnError(
|
219 |
-
_('Invalid method call; no CDN() on the CDN object'));
|
220 |
-
}
|
221 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sdk/OpenCloud/openstack.php
CHANGED
@@ -1,756 +1,5 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
-
*
|
5 |
-
* @copyright 2012-2013 Rackspace Hosting, Inc.
|
6 |
-
* See COPYING for licensing information
|
7 |
-
*
|
8 |
-
* @package phpOpenCloud
|
9 |
-
* @version 1.0
|
10 |
-
* @author Glen Campbell <glen.campbell@rackspace.com>
|
11 |
*/
|
12 |
-
|
13 |
-
namespace OpenCloud;
|
14 |
-
|
15 |
-
require_once(__DIR__.'/base.php');
|
16 |
-
require_once(__DIR__.'/objectstore.php');
|
17 |
-
require_once(__DIR__.'/compute.php');
|
18 |
-
require_once(__DIR__.'/volumeservice.php');
|
19 |
-
|
20 |
-
/**
|
21 |
-
* The OpenStack class represents a relationship (or "connection")
|
22 |
-
* between a user and a service.
|
23 |
-
*
|
24 |
-
* This is the primary entry point into an OpenStack system, and the only one
|
25 |
-
* where the developer is required to know and provide the endpoint URL (in
|
26 |
-
* all other cases, the endpoint is derived from the Service Catalog provided
|
27 |
-
* by the authentication system).
|
28 |
-
*
|
29 |
-
* Since various providers have different mechanisms for authentication, users
|
30 |
-
* will often use a subclass of OpenStack. For example, the Rackspace
|
31 |
-
* class is provided for users of Rackspace's cloud services, and other cloud
|
32 |
-
* providers are welcome to add their own subclasses as well.
|
33 |
-
*
|
34 |
-
* General usage example:
|
35 |
-
* <code>
|
36 |
-
* $username = 'My Username';
|
37 |
-
* $secret = 'My Secret';
|
38 |
-
* $connection = new OpenCloud\OpenStack($username, $secret);
|
39 |
-
* // having established the connection, we can set some defaults
|
40 |
-
* // this sets the default name and region of the Compute service
|
41 |
-
* $connection->SetDefaults('Compute', 'cloudServersOpenStack', 'ORD');
|
42 |
-
* // access a Compute service
|
43 |
-
* $chicago = $connection->Compute();
|
44 |
-
* // if we want to access a different service, we can:
|
45 |
-
* $dallas = $connection->Compute('cloudServersOpenStack', 'DFW');
|
46 |
-
* </code>
|
47 |
-
*
|
48 |
-
* @author Glen Campbell <glen.campbell@rackspace.com>
|
49 |
-
* @version 1.0
|
50 |
-
*/
|
51 |
-
class OpenStack extends \OpenCloud\Base {
|
52 |
-
|
53 |
-
public
|
54 |
-
/**
|
55 |
-
* This holds the HTTP User-Agent: used for all requests to the
|
56 |
-
* services. It is public so that, if necessary, it can be entirely
|
57 |
-
* overridden by the developer. However, it's strongly recomended
|
58 |
-
* that you use the OpenStack::AppendUserAgent() method to APPEND
|
59 |
-
* your own User Agent identifier to the end of this string; the
|
60 |
-
* user agent information can be very valuable to service providers
|
61 |
-
* to track who is using their service.
|
62 |
-
*/
|
63 |
-
$useragent=RAXSDK_USER_AGENT;
|
64 |
-
|
65 |
-
protected
|
66 |
-
$url,
|
67 |
-
$secret=array(),
|
68 |
-
$token,
|
69 |
-
$expiration=0,
|
70 |
-
$tenant,
|
71 |
-
$catalog,
|
72 |
-
/**
|
73 |
-
* This associative array holds default values used to identify each
|
74 |
-
* service (and to select it from the Service Catalog). Use the
|
75 |
-
* Compute::SetDefaults() method to change the default values, or
|
76 |
-
* define the global constants (for example, RAXSDK_COMPUTE_NAME)
|
77 |
-
* BEFORE loading the OpenCloud library:
|
78 |
-
*
|
79 |
-
* <code>
|
80 |
-
* define('RAXSDK_COMPUTE_NAME', 'cloudServersOpenStack');
|
81 |
-
* include('openstack.php');
|
82 |
-
* </code>
|
83 |
-
*/
|
84 |
-
$defaults=array(
|
85 |
-
'Compute' => array(
|
86 |
-
'name' => RAXSDK_COMPUTE_NAME,
|
87 |
-
'region' => RAXSDK_COMPUTE_REGION,
|
88 |
-
'urltype' => RAXSDK_COMPUTE_URLTYPE
|
89 |
-
),
|
90 |
-
'ObjectStore' => array(
|
91 |
-
'name' => RAXSDK_OBJSTORE_NAME,
|
92 |
-
'region' => RAXSDK_OBJSTORE_REGION,
|
93 |
-
'urltype' => RAXSDK_OBJSTORE_URLTYPE
|
94 |
-
),
|
95 |
-
'DbService' => array(
|
96 |
-
'name' => RAXSDK_DATABASE_NAME,
|
97 |
-
'region' => RAXSDK_DATABASE_REGION,
|
98 |
-
'urltype' => RAXSDK_DATABASE_URLTYPE
|
99 |
-
),
|
100 |
-
'VolumeService' => array(
|
101 |
-
'name' => RAXSDK_VOLUME_NAME,
|
102 |
-
'region' => RAXSDK_VOLUME_REGION,
|
103 |
-
'urltype' => RAXSDK_VOLUME_URLTYPE
|
104 |
-
),
|
105 |
-
'LoadBalancerService' => array(
|
106 |
-
'name' => RAXSDK_LBSERVICE_NAME,
|
107 |
-
'region' => RAXSDK_LBSERVICE_REGION,
|
108 |
-
'urltype' => RAXSDK_LBSERVICE_URLTYPE
|
109 |
-
),
|
110 |
-
'DNS' => array(
|
111 |
-
'name' => RAXSDK_DNS_NAME,
|
112 |
-
'region' => RAXSDK_DNS_REGION,
|
113 |
-
'urltype' => RAXSDK_DNS_URLTYPE
|
114 |
-
)
|
115 |
-
),
|
116 |
-
$connect_timeout=RAXSDK_CONNECTTIMEOUT,
|
117 |
-
$http_timeout=RAXSDK_TIMEOUT,
|
118 |
-
$overlimit_timeout=RAXSDK_OVERLIMIT_TIMEOUT;
|
119 |
-
|
120 |
-
private
|
121 |
-
$_user_write_progress_callback_func,
|
122 |
-
$_user_read_progress_callback_func,
|
123 |
-
/**
|
124 |
-
* Tracks file descriptors used by streaming downloads
|
125 |
-
*
|
126 |
-
* This will permit multiple simultaneous streaming downloads; the
|
127 |
-
* key is the URL of the object, and the value is its file descriptor.
|
128 |
-
*
|
129 |
-
* To prevent memory overflows, each array element is deleted when
|
130 |
-
* the end of the file is reached.
|
131 |
-
*/
|
132 |
-
$_file_descriptors = array(),
|
133 |
-
/**
|
134 |
-
* array of options to pass to the CURL request object
|
135 |
-
*/
|
136 |
-
$curl_options=array(),
|
137 |
-
/**
|
138 |
-
* list of attributes to export/import
|
139 |
-
*/
|
140 |
-
$export_items = array('token', 'expiration', 'tenant', 'catalog');
|
141 |
-
|
142 |
-
/**
|
143 |
-
* Creates a new OpenStack object
|
144 |
-
*
|
145 |
-
* The OpenStack object needs two bits of information: the URL to
|
146 |
-
* authenticate against, and a "secret", which is an associative array
|
147 |
-
* of name/value pairs. Usually, the secret will be a username and a
|
148 |
-
* password, but other values may be required by different authentication
|
149 |
-
* systems. For example, OpenStack Keystone requires a username and
|
150 |
-
* password, but Rackspace uses a username, tenant ID, and API key.
|
151 |
-
* (See OpenCloud\Rackspace for that.)
|
152 |
-
*
|
153 |
-
* @param string $url - the authentication endpoint URL
|
154 |
-
* @param array $secret - an associative array of auth information:
|
155 |
-
* * username
|
156 |
-
* * password
|
157 |
-
* @param array $options - CURL options to pass to the HttpRequest object
|
158 |
-
*/
|
159 |
-
public function __construct($url, $secret, $options=array()) {
|
160 |
-
$this->debug(_('initializing'));
|
161 |
-
$this->url = $url;
|
162 |
-
|
163 |
-
if (!is_array($secret))
|
164 |
-
throw new DomainError(_('[secret] must be an array'));
|
165 |
-
$this->secret = $secret;
|
166 |
-
|
167 |
-
if (!is_array($options))
|
168 |
-
throw new DomainError(_('[options] must be an array'));
|
169 |
-
$this->curl_options = $options;
|
170 |
-
}
|
171 |
-
|
172 |
-
/**
|
173 |
-
* Returns the URL of this object
|
174 |
-
*
|
175 |
-
* @api
|
176 |
-
* @return string
|
177 |
-
*/
|
178 |
-
public function Url() {
|
179 |
-
return noslash($this->url) . '/tokens';
|
180 |
-
}
|
181 |
-
|
182 |
-
/**
|
183 |
-
* Returns the stored secret
|
184 |
-
*
|
185 |
-
* @return array
|
186 |
-
*/
|
187 |
-
public function Secret() {
|
188 |
-
return $this->secret;
|
189 |
-
}
|
190 |
-
|
191 |
-
/**
|
192 |
-
* Returns the cached token; if it has expired, then it re-authenticates
|
193 |
-
*
|
194 |
-
* @api
|
195 |
-
* @return string
|
196 |
-
*/
|
197 |
-
public function Token() {
|
198 |
-
if (time() > ($this->expiration-RAXSDK_FUDGE))
|
199 |
-
$this->Authenticate();
|
200 |
-
return $this->token;
|
201 |
-
}
|
202 |
-
|
203 |
-
/**
|
204 |
-
* Returns the cached expiration time;
|
205 |
-
* if it has expired, then it re-authenticates
|
206 |
-
*
|
207 |
-
* @api
|
208 |
-
* @return string
|
209 |
-
*/
|
210 |
-
public function Expiration() {
|
211 |
-
if (time() > ($this->expiration-RAXSDK_FUDGE))
|
212 |
-
$this->Authenticate();
|
213 |
-
return $this->expiration;
|
214 |
-
}
|
215 |
-
|
216 |
-
/**
|
217 |
-
* Returns the tenant ID, re-authenticating if necessary
|
218 |
-
*
|
219 |
-
* @api
|
220 |
-
* @return string
|
221 |
-
*/
|
222 |
-
public function Tenant() {
|
223 |
-
if (time() > ($this->expiration-RAXSDK_FUDGE))
|
224 |
-
$this->Authenticate();
|
225 |
-
return $this->tenant;
|
226 |
-
}
|
227 |
-
|
228 |
-
/**
|
229 |
-
* Returns the service catalog object from the auth service
|
230 |
-
*
|
231 |
-
* @return \stdClass
|
232 |
-
*/
|
233 |
-
public function ServiceCatalog() {
|
234 |
-
if (time() > ($this->expiration-RAXSDK_FUDGE))
|
235 |
-
$this->Authenticate();
|
236 |
-
return $this->catalog;
|
237 |
-
}
|
238 |
-
|
239 |
-
/**
|
240 |
-
* Returns a Collection of objects with information on services
|
241 |
-
*
|
242 |
-
* Note that these are informational (read-only) and are not actually
|
243 |
-
* 'Service'-class objects.
|
244 |
-
*/
|
245 |
-
public function ServiceList() {
|
246 |
-
return new Collection(
|
247 |
-
$this, 'ServiceCatalogItem', $this->ServiceCatalog());
|
248 |
-
}
|
249 |
-
|
250 |
-
/**
|
251 |
-
* Creates and returns the formatted credentials to POST to the auth
|
252 |
-
* service.
|
253 |
-
*
|
254 |
-
* @return string
|
255 |
-
*/
|
256 |
-
public function Credentials() {
|
257 |
-
if (isset($this->secret['username']) &&
|
258 |
-
isset($this->secret['password']))
|
259 |
-
{
|
260 |
-
$credentials =
|
261 |
-
array( 'auth' =>
|
262 |
-
array( 'passwordCredentials' =>
|
263 |
-
array(
|
264 |
-
'username' => $this->secret['username'],
|
265 |
-
'password'=>$this->secret['password']
|
266 |
-
)
|
267 |
-
)
|
268 |
-
);
|
269 |
-
|
270 |
-
if (isset($this->secret['tenantName']))
|
271 |
-
{
|
272 |
-
$credentials['auth']['tenantName'] =
|
273 |
-
$this->secret['tenantName'];
|
274 |
-
}
|
275 |
-
|
276 |
-
return json_encode($credentials);
|
277 |
-
}
|
278 |
-
else
|
279 |
-
throw new CredentialError(
|
280 |
-
_('Unrecognized credential secret'));
|
281 |
-
}
|
282 |
-
|
283 |
-
/**
|
284 |
-
* Authenticates using the supplied credentials
|
285 |
-
*
|
286 |
-
* @api
|
287 |
-
* @return void
|
288 |
-
* @throws AuthenticationError
|
289 |
-
*/
|
290 |
-
public function Authenticate() {
|
291 |
-
// try to auth
|
292 |
-
$response = $this->Request(
|
293 |
-
$this->Url(),
|
294 |
-
'POST',
|
295 |
-
array('Content-Type'=>'application/json'),
|
296 |
-
$this->Credentials()
|
297 |
-
);
|
298 |
-
$json = $response->HttpBody();
|
299 |
-
|
300 |
-
// check for errors
|
301 |
-
if ($response->HttpStatus() >= 400) {
|
302 |
-
throw new AuthenticationError(
|
303 |
-
sprintf(_('Authentication failure, status [%d], response [%s]'),
|
304 |
-
$response->HttpStatus(), $json));
|
305 |
-
}
|
306 |
-
|
307 |
-
// save the token information as well as the ServiceCatalog
|
308 |
-
$resp = json_decode($json);
|
309 |
-
if ($this->CheckJsonError())
|
310 |
-
return FALSE;
|
311 |
-
$this->token = $resp->access->token->id;
|
312 |
-
$this->expiration = strtotime($resp->access->token->expires);
|
313 |
-
/**
|
314 |
-
* In some cases, the tenant name/id is not returned
|
315 |
-
* as part of the auth token, so we check for it before
|
316 |
-
* we set it. This occurs with pure Keystone, but not
|
317 |
-
* with the Rackspace auth.
|
318 |
-
*/
|
319 |
-
if (isset($resp->access->token->tenant))
|
320 |
-
$this->tenant = $resp->access->token->tenant->id;
|
321 |
-
/**
|
322 |
-
* Note the different capitalization; I'm trying to use CamelCase
|
323 |
-
* consistently in these bindings, but the actual serviceCatalog is
|
324 |
-
* how OpenStack returns it.
|
325 |
-
*/
|
326 |
-
$this->catalog = $resp->access->serviceCatalog;
|
327 |
-
}
|
328 |
-
|
329 |
-
/**
|
330 |
-
* Performs a single HTTP request
|
331 |
-
*
|
332 |
-
* The request() method is one of the most frequently-used in the entire
|
333 |
-
* library. It performs an HTTP request using the specified URL, method,
|
334 |
-
* and with the supplied headers and body. It handles error and
|
335 |
-
* exceptions for the request.
|
336 |
-
*
|
337 |
-
* @api
|
338 |
-
* @param string url - the URL of the request
|
339 |
-
* @param string method - the HTTP method (defaults to GET)
|
340 |
-
* @param array headers - an associative array of headers
|
341 |
-
* @param string data - either a string or a resource (file pointer) to
|
342 |
-
* use as the
|
343 |
-
* request body (for PUT or POST)
|
344 |
-
* @return HttpResponse object
|
345 |
-
* @throws HttpOverLimitError, HttpUnauthorizedError, HttpForbiddenError
|
346 |
-
*/
|
347 |
-
public function Request($url,$method='GET',$headers=array(),$data=NULL) {
|
348 |
-
$this->debug(_('Resource [%s] method [%s] body [%s]'),
|
349 |
-
$url, $method, $data);
|
350 |
-
|
351 |
-
// get the request object
|
352 |
-
$http = $this->GetHttpRequestObject($url, $method, $this->curl_options);
|
353 |
-
|
354 |
-
// set various options
|
355 |
-
$this->debug(_('Headers: [%s]'), print_r($headers,TRUE));
|
356 |
-
$http->setheaders($headers);
|
357 |
-
$http->SetHttpTimeout($this->http_timeout);
|
358 |
-
$http->SetConnectTimeout($this->connect_timeout);
|
359 |
-
$http->SetOption(CURLOPT_USERAGENT, $this->useragent);
|
360 |
-
|
361 |
-
// data can be either a resource or a string
|
362 |
-
if (is_resource($data)) { // loading from or writing to a file
|
363 |
-
// set the appropriate callback functions
|
364 |
-
switch($method) {
|
365 |
-
case 'GET':
|
366 |
-
// need to save the file descriptor
|
367 |
-
$this->_file_descriptors[$url] = $data;
|
368 |
-
// set the CURL options
|
369 |
-
$http->SetOption(CURLOPT_FILE, $data);
|
370 |
-
$http->SetOption(CURLOPT_WRITEFUNCTION,
|
371 |
-
array($this, '_write_cb'));
|
372 |
-
break;
|
373 |
-
case 'PUT':
|
374 |
-
case 'POST':
|
375 |
-
// need to save the file descriptor
|
376 |
-
$this->_file_descriptors[$url] = $data;
|
377 |
-
if (!isset($headers['Content-Length']))
|
378 |
-
throw new HttpError(
|
379 |
-
_('The Content-Length: header must be specified '.
|
380 |
-
'for file uploads'));
|
381 |
-
$http->SetOption(CURLOPT_UPLOAD, TRUE);
|
382 |
-
$http->SetOption(CURLOPT_INFILE, $data);
|
383 |
-
$http->SetOption(CURLOPT_INFILESIZE,
|
384 |
-
$headers['Content-Length']);
|
385 |
-
$http->SetOption(CURLOPT_READFUNCTION,
|
386 |
-
array($this, '_read_cb'));
|
387 |
-
break;
|
388 |
-
default:
|
389 |
-
// do nothing
|
390 |
-
}
|
391 |
-
}
|
392 |
-
elseif (is_string($data))
|
393 |
-
$http->SetOption(CURLOPT_POSTFIELDS, $data);
|
394 |
-
elseif (isset($data))
|
395 |
-
throw new HttpError(
|
396 |
-
_('Unrecognized data type for PUT/POST body, '.
|
397 |
-
'must be string or resource'));
|
398 |
-
|
399 |
-
// perform the HTTP request; returns an HttpResult object
|
400 |
-
$response = $http->Execute();
|
401 |
-
|
402 |
-
// handle and retry on overlimit errors
|
403 |
-
if ($response->HttpStatus() == 413) {
|
404 |
-
$obj = json_decode($response->HttpBody());
|
405 |
-
if (!$this->CheckJsonError()) {
|
406 |
-
if (isset($obj->overLimit)) {
|
407 |
-
/**
|
408 |
-
* @TODO(glen) - The documentation says "retryAt", but
|
409 |
-
* the field returned is "retryAfter". If the doc changes,
|
410 |
-
* then there's no problem, but we'll need to fix this if
|
411 |
-
* they change the code to match the docs.
|
412 |
-
*/
|
413 |
-
$retry_s = $obj->overLimit->retryAfter;
|
414 |
-
$retry_t = strtotime($retry_s);
|
415 |
-
$sleep_interval = $retry_t - time();
|
416 |
-
if ($sleep_interval <= $this->overlimit_timeout) {
|
417 |
-
sleep($sleep_interval);
|
418 |
-
$response = $http->Execute();
|
419 |
-
}
|
420 |
-
else {
|
421 |
-
throw new HttpOverlimitError(
|
422 |
-
sprintf(_('Over limit; next available request '.
|
423 |
-
'[%s][%s] is not '.
|
424 |
-
'for [%d] seconds at [%s]'),
|
425 |
-
$method,
|
426 |
-
$url,
|
427 |
-
$sleep_interval,
|
428 |
-
$retry_s));
|
429 |
-
}
|
430 |
-
}
|
431 |
-
}
|
432 |
-
}
|
433 |
-
|
434 |
-
// do some common error checking
|
435 |
-
switch($response->HttpStatus()) {
|
436 |
-
case 401:
|
437 |
-
throw new HttpUnauthorizedError(
|
438 |
-
sprintf(_('401 Unauthorized for [%s] [%s]'),
|
439 |
-
$url, $response->HttpBody()));
|
440 |
-
break;
|
441 |
-
case 403:
|
442 |
-
throw new HttpForbiddenError(
|
443 |
-
sprintf(_('403 Forbidden for [%s] [%s]'),
|
444 |
-
$url, $response->HttpBody()));
|
445 |
-
break;
|
446 |
-
case 413: // limit
|
447 |
-
throw new HttpOverlimitError(
|
448 |
-
sprintf(_('413 Over limit for [%s] [%s]'),
|
449 |
-
$url, $response->HttpBody()));
|
450 |
-
break;
|
451 |
-
default:
|
452 |
-
// everything is fine here, we're fine, how are you?
|
453 |
-
}
|
454 |
-
|
455 |
-
// free the handle
|
456 |
-
$http->close();
|
457 |
-
|
458 |
-
// return the HttpResponse object
|
459 |
-
$this->debug(_('HTTP STATUS [%s]'), $response->HttpStatus());
|
460 |
-
return $response;
|
461 |
-
}
|
462 |
-
|
463 |
-
/**
|
464 |
-
* Allows the user to append a user agent string
|
465 |
-
*
|
466 |
-
* Programs that are using these bindings are encouraged to add their
|
467 |
-
* user agent to the one supplied by this SDK. This will permit cloud
|
468 |
-
* providers to track users so that they can provide better service.
|
469 |
-
*
|
470 |
-
* @api
|
471 |
-
* @param string $agent an arbitrary user-agent string; e.g. "My Cloud App"
|
472 |
-
* @return void
|
473 |
-
*/
|
474 |
-
public function AppendUserAgent($agent) {
|
475 |
-
$this->useragent .= ';'.$agent;
|
476 |
-
}
|
477 |
-
|
478 |
-
/**
|
479 |
-
* Sets default values for name, region, URL type for a service
|
480 |
-
*
|
481 |
-
* Once these are set (and they can also be set by defining global
|
482 |
-
* constants), then you do not need to specify these values when
|
483 |
-
* creating new service objects.
|
484 |
-
*
|
485 |
-
* @api
|
486 |
-
* @param string $service the name of a supported service; e.g. 'Compute'
|
487 |
-
* @param string $name the service name; e.g., 'cloudServersOpenStack'
|
488 |
-
* @param string $region the region name; e.g., 'LON'
|
489 |
-
* @param string $urltype the type of URL to use; e.g., 'internalURL'
|
490 |
-
* @return void
|
491 |
-
* @throws UnrecognizedServiceError
|
492 |
-
*/
|
493 |
-
public function SetDefaults($service,
|
494 |
-
$name=NULL, $region=NULL, $urltype=NULL) {
|
495 |
-
|
496 |
-
if (!isset($this->defaults[$service]))
|
497 |
-
throw new UnrecognizedServiceError(sprintf(
|
498 |
-
_('Service [%s] is not recognized'), $service));
|
499 |
-
|
500 |
-
if (isset($name))
|
501 |
-
$this->defaults[$service]['name'] = $name;
|
502 |
-
if (isset($region))
|
503 |
-
$this->defaults[$service]['region'] = $region;
|
504 |
-
if (isset($urltype))
|
505 |
-
$this->defaults[$service]['urltype'] = $urltype;
|
506 |
-
}
|
507 |
-
|
508 |
-
/**
|
509 |
-
* Sets the timeouts for the current connection
|
510 |
-
*
|
511 |
-
* @api
|
512 |
-
* @param integer $t_http the HTTP timeout value (the max period that
|
513 |
-
* the OpenStack object will wait for any HTTP request to complete).
|
514 |
-
* Value is in seconds.
|
515 |
-
* @param integer $t_conn the Connect timeout value (the max period
|
516 |
-
* that the OpenStack object will wait to establish an HTTP
|
517 |
-
* connection). Value is in seconds.
|
518 |
-
* @param integer $t_overlimit the overlimit timeout value (the max period
|
519 |
-
* that the OpenStack object will wait to retry on an overlimit
|
520 |
-
* condition). Value is in seconds.
|
521 |
-
* @return void
|
522 |
-
*/
|
523 |
-
public function SetTimeouts($t_http, $t_conn=NULL, $t_overlimit=NULL) {
|
524 |
-
$this->http_timeout = $t_http;
|
525 |
-
if (isset($t_conn))
|
526 |
-
$this->connect_timeout = $t_conn;
|
527 |
-
if (isset($t_overlimit))
|
528 |
-
$this->overlimit_timeout = $t_overlimit;
|
529 |
-
}
|
530 |
-
|
531 |
-
/**
|
532 |
-
* Allows the user to define a function for tracking uploads
|
533 |
-
*
|
534 |
-
* This can be used to implement a progress bar or similar function. The
|
535 |
-
* callback function is called with a single parameter, the length of the
|
536 |
-
* data that is being uploaded on this call.
|
537 |
-
*
|
538 |
-
* @param callable $callback the name of a global callback function, or an
|
539 |
-
* array($object, $functionname)
|
540 |
-
* @return void
|
541 |
-
*/
|
542 |
-
public function SetUploadProgressCallback($callback) {
|
543 |
-
$this->_user_write_progress_callback_func = $callback;
|
544 |
-
}
|
545 |
-
|
546 |
-
/**
|
547 |
-
* Allows the user to define a function for tracking downloads
|
548 |
-
*
|
549 |
-
* This can be used to implement a progress bar or similar function. The
|
550 |
-
* callback function is called with a single parameter, the length of the
|
551 |
-
* data that is being downloaded on this call.
|
552 |
-
*
|
553 |
-
* @param callable $callback the name of a global callback function, or an
|
554 |
-
* array($object, $functionname)
|
555 |
-
* @return void
|
556 |
-
*/
|
557 |
-
public function SetDownloadProgressCallback($callback) {
|
558 |
-
$this->_user_read_progress_callback_func = $callback;
|
559 |
-
}
|
560 |
-
|
561 |
-
/**
|
562 |
-
* Callback function to handle reads for file uploads
|
563 |
-
*
|
564 |
-
* Internal function for handling file uploads. Note that, although this
|
565 |
-
* function's visibility is public, this is only because it must be called
|
566 |
-
* from the HttpRequest interface. This should NOT be called by users
|
567 |
-
* directly.
|
568 |
-
*
|
569 |
-
* @param resource $ch a CURL handle
|
570 |
-
* @param resource $fd a file descriptor
|
571 |
-
* @param integer $length the amount of data to read
|
572 |
-
* @return string the data read
|
573 |
-
*/
|
574 |
-
public function _read_cb($ch, $fd, $length)
|
575 |
-
{
|
576 |
-
$data = fread($fd, $length);
|
577 |
-
$len = strlen($data);
|
578 |
-
if (isset($this->_user_write_progress_callback_func)) {
|
579 |
-
call_user_func($this->_user_write_progress_callback_func, $len);
|
580 |
-
}
|
581 |
-
return $data;
|
582 |
-
}
|
583 |
-
|
584 |
-
/**
|
585 |
-
* Callback function to handle writes for file downloads
|
586 |
-
*
|
587 |
-
* Internal function for handling file downloads. Note that, although this
|
588 |
-
* function's visibility is public, this is only because it must be called
|
589 |
-
* via the HttpRequest interface. This should NOT be called by users
|
590 |
-
* directly.
|
591 |
-
*
|
592 |
-
* @param resource $ch a CURL handle
|
593 |
-
* @param string $data the data to be written to a file
|
594 |
-
* @return integer the number of bytes written
|
595 |
-
*/
|
596 |
-
public function _write_cb($ch, $data)
|
597 |
-
{
|
598 |
-
$url = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
|
599 |
-
if (!isset($this->_file_descriptors[$url]))
|
600 |
-
throw new HttpUrlError(sprintf(
|
601 |
-
_('Cannot find file descriptor for URL [%s]'), $url));
|
602 |
-
$fp = $this->_file_descriptors[$url];
|
603 |
-
$dlen = strlen($data);
|
604 |
-
fwrite($fp, $data, $dlen);
|
605 |
-
|
606 |
-
// call used callback function
|
607 |
-
if (isset($this->_user_read_progress_callback_func)) {
|
608 |
-
call_user_func($this->_user_read_progress_callback_func, $dlen);
|
609 |
-
}
|
610 |
-
|
611 |
-
// MUST return the length to CURL
|
612 |
-
return $dlen;
|
613 |
-
}
|
614 |
-
|
615 |
-
/**
|
616 |
-
* exports saved token, expiration, tenant, and service catalog as an array
|
617 |
-
*
|
618 |
-
* This could be stored in a cache (APC or disk file) and reloaded using
|
619 |
-
* ImportCredentials()
|
620 |
-
*
|
621 |
-
* @return array
|
622 |
-
*/
|
623 |
-
public function ExportCredentials() {
|
624 |
-
$arr = array();
|
625 |
-
foreach($this->export_items as $item)
|
626 |
-
$arr[$item] = $this->$item;
|
627 |
-
return $arr;
|
628 |
-
}
|
629 |
-
|
630 |
-
/**
|
631 |
-
* imports credentials from an array
|
632 |
-
*
|
633 |
-
* Takes the same values as ExportCredentials() and reuses them.
|
634 |
-
*
|
635 |
-
* @return void
|
636 |
-
*/
|
637 |
-
public function ImportCredentials($values) {
|
638 |
-
if (!is_array($values))
|
639 |
-
throw new DomainError(_('ImportCredentials() requires an array'));
|
640 |
-
foreach($this->export_items as $item)
|
641 |
-
$this->$item = $values[$item];
|
642 |
-
}
|
643 |
-
|
644 |
-
/********** FACTORY METHODS **********/
|
645 |
-
|
646 |
-
/**
|
647 |
-
* These methods are provided to permit easy creation of services
|
648 |
-
* (for example, Nova or Swift) from a connection object. As new
|
649 |
-
* services are supported, factory methods should be provided here.
|
650 |
-
*/
|
651 |
-
|
652 |
-
/**
|
653 |
-
* Creates a new ObjectStore object (Swift/Cloud Files)
|
654 |
-
*
|
655 |
-
* @api
|
656 |
-
* @param string $name the name of the Object Storage service to attach to
|
657 |
-
* @param string $region the name of the region to use
|
658 |
-
* @param string $urltype the URL type (normally "publicURL")
|
659 |
-
* @return ObjectStore
|
660 |
-
*/
|
661 |
-
public function ObjectStore($name=NULL, $region=NULL, $urltype=NULL) {
|
662 |
-
return $this->Service('ObjectStore', $name, $region, $urltype);
|
663 |
-
}
|
664 |
-
|
665 |
-
/**
|
666 |
-
* Creates a new Compute object (Nova/Cloud Servers)
|
667 |
-
*
|
668 |
-
* @api
|
669 |
-
* @param string $name the name of the Compute service to attach to
|
670 |
-
* @param string $region the name of the region to use
|
671 |
-
* @param string $urltype the URL type (normally "publicURL")
|
672 |
-
* @return ObjectStore
|
673 |
-
*/
|
674 |
-
public function Compute($name=NULL, $region=NULL, $urltype=NULL) {
|
675 |
-
return $this->Service('Compute', $name, $region, $urltype);
|
676 |
-
}
|
677 |
-
|
678 |
-
/**
|
679 |
-
* Creates a new VolumeService (cinder) service object
|
680 |
-
*
|
681 |
-
* This is a factory method that is Rackspace-only (NOT part of OpenStack).
|
682 |
-
*
|
683 |
-
* @param string $name the name of the service (e.g., 'cloudBlockStorage')
|
684 |
-
* @param string $region the region (e.g., 'DFW')
|
685 |
-
* @param string $urltype the type of URL (e.g., 'publicURL');
|
686 |
-
*/
|
687 |
-
public function VolumeService($name=NULL, $region=NULL, $urltype=NULL) {
|
688 |
-
return $this->Service('VolumeService', $name, $region, $urltype);
|
689 |
-
}
|
690 |
-
|
691 |
-
/********** PROTECTED METHODS **********/
|
692 |
-
|
693 |
-
/**
|
694 |
-
* Generic Service factory method
|
695 |
-
*
|
696 |
-
* Contains code reused by the other service factory methods.
|
697 |
-
*
|
698 |
-
* @param string $class the name of the Service class to produce
|
699 |
-
* @param string $name the name of the Compute service to attach to
|
700 |
-
* @param string $region the name of the region to use
|
701 |
-
* @param string $urltype the URL type (normally "publicURL")
|
702 |
-
* @return Service (or subclass such as Compute, ObjectStore)
|
703 |
-
* @throws ServiceValueError
|
704 |
-
*/
|
705 |
-
protected function Service($class,
|
706 |
-
$name=NULL, $region=NULL, $urltype=NULL) {
|
707 |
-
// debug message
|
708 |
-
$this->debug('Factory for class [%s] [%s/%s/%s]',
|
709 |
-
$class, $name, $region, $urltype);
|
710 |
-
|
711 |
-
// check for defaults
|
712 |
-
if (!isset($name))
|
713 |
-
$name = $this->defaults[$class]['name'];
|
714 |
-
if (!isset($region))
|
715 |
-
$region = $this->defaults[$class]['region'];
|
716 |
-
if (!isset($urltype))
|
717 |
-
$urltype = $this->defaults[$class]['urltype'];
|
718 |
-
|
719 |
-
// report errors
|
720 |
-
if (!$name)
|
721 |
-
throw new ServiceValueError(_('No value for '.$class.' name'));
|
722 |
-
if (!$region)
|
723 |
-
throw new ServiceValueError(_('No value for '.$class.' region'));
|
724 |
-
if (!$urltype)
|
725 |
-
throw new ServiceValueError(_('No value for '.$class.' URL type'));
|
726 |
-
|
727 |
-
// return the object
|
728 |
-
$fullclass = 'OpenCloud\\'.$class;
|
729 |
-
return new $fullclass(
|
730 |
-
$this,
|
731 |
-
$name,
|
732 |
-
$region,
|
733 |
-
$urltype
|
734 |
-
);
|
735 |
-
}
|
736 |
-
|
737 |
-
/**
|
738 |
-
* returns a service catalog item
|
739 |
-
*
|
740 |
-
* This is a helper function used to list service catalog items easily
|
741 |
-
*/
|
742 |
-
public function ServiceCatalogItem($info=array()) {
|
743 |
-
return new ServiceCatalogItem($info);
|
744 |
-
}
|
745 |
-
|
746 |
-
} // class OpenStack
|
747 |
-
|
748 |
-
/**
|
749 |
-
* Holds information on a single service from the Service Catalog
|
750 |
-
*/
|
751 |
-
class ServiceCatalogItem {
|
752 |
-
public function __construct($info=array()) {
|
753 |
-
foreach($info as $key => $value)
|
754 |
-
$this->$key = $value;
|
755 |
-
}
|
756 |
-
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* provided for backwards compatibility
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
*/
|
5 |
+
require_once dirname(__FILE__).'/php-opencloud.php';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sdk/OpenCloud/php-opencloud.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* entry point for PHP-OpenCloud library
|
4 |
+
*/
|
5 |
+
require_once(dirname(__FILE__) . '/Autoload.php');
|
6 |
+
require_once(dirname(__FILE__) . '/OpenCloud/Globals.php');
|
7 |
+
$classLoader = new SplClassLoader('OpenCloud', dirname(__FILE__));
|
8 |
+
$classLoader->register();
|
sdk/OpenCloud/rackspace.php
CHANGED
@@ -1,107 +1,5 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
-
* than the pure OpenStack class)
|
5 |
-
*
|
6 |
-
* @copyright 2012-2013 Rackspace Hosting, Inc.
|
7 |
-
* See COPYING for licensing information
|
8 |
-
*
|
9 |
-
* @package phpOpenCloud
|
10 |
-
* @version 1.0
|
11 |
-
* @author Glen Campbell <glen.campbell@rackspace.com>
|
12 |
*/
|
13 |
-
|
14 |
-
namespace OpenCloud;
|
15 |
-
|
16 |
-
require_once(__DIR__.'/openstack.php');
|
17 |
-
require_once(__DIR__.'/dbservice.php');
|
18 |
-
require_once(__DIR__.'/lbservice.php');
|
19 |
-
require_once(__DIR__.'/dns.php');
|
20 |
-
|
21 |
-
/**
|
22 |
-
* Rackspace extends the OpenStack class with support for Rackspace's
|
23 |
-
* API key and tenant requirements.
|
24 |
-
*
|
25 |
-
* The only difference between Rackspace and OpenStack is that the
|
26 |
-
* Rackspace class generates credentials using the username
|
27 |
-
* and API key, as required by the Rackspace authentication
|
28 |
-
* service.
|
29 |
-
*
|
30 |
-
* Example:
|
31 |
-
* <code>
|
32 |
-
* $username = 'FRED';
|
33 |
-
* $apiKey = '0900af093093788912388fc09dde090ffee09';
|
34 |
-
* $conn = new Rackspace(
|
35 |
-
* 'https://identity.api.rackspacecloud.com/v2.0/',
|
36 |
-
* array(
|
37 |
-
* 'username' => $username,
|
38 |
-
* 'apiKey' => $apiKey
|
39 |
-
* ));
|
40 |
-
* </code>
|
41 |
-
*/
|
42 |
-
class Rackspace extends OpenStack {
|
43 |
-
//this is the JSON string for our new credentials
|
44 |
-
const APIKEYTEMPLATE = <<<ENDCRED
|
45 |
-
{ "auth": { "RAX-KSKEY:apiKeyCredentials": { "username": "%s",
|
46 |
-
"apiKey": "%s"
|
47 |
-
}
|
48 |
-
}
|
49 |
-
}
|
50 |
-
ENDCRED;
|
51 |
-
|
52 |
-
/**
|
53 |
-
* Generates Rackspace API key credentials
|
54 |
-
*
|
55 |
-
* @return string
|
56 |
-
*/
|
57 |
-
public function Credentials() {
|
58 |
-
$sec = $this->Secret();
|
59 |
-
if (isset($sec['username']) &&
|
60 |
-
isset($sec['apiKey']))
|
61 |
-
return sprintf(
|
62 |
-
self::APIKEYTEMPLATE,
|
63 |
-
$sec['username'],
|
64 |
-
$sec['apiKey']
|
65 |
-
);
|
66 |
-
else
|
67 |
-
return parent::Credentials();
|
68 |
-
}
|
69 |
-
|
70 |
-
/**
|
71 |
-
* Creates a new DbService (Database as a Service) object
|
72 |
-
*
|
73 |
-
* This is a factory method that is Rackspace-only (NOT part of OpenStack).
|
74 |
-
*
|
75 |
-
* @param string $name the name of the service (e.g., 'Cloud Databases')
|
76 |
-
* @param string $region the region (e.g., 'DFW')
|
77 |
-
* @param string $urltype the type of URL (e.g., 'publicURL');
|
78 |
-
*/
|
79 |
-
public function DbService($name=NULL, $region=NULL, $urltype=NULL) {
|
80 |
-
return $this->Service('DbService', $name, $region, $urltype);
|
81 |
-
}
|
82 |
-
|
83 |
-
/**
|
84 |
-
* Creates a new LoadBalancerService object
|
85 |
-
*
|
86 |
-
* This is a factory method that is Rackspace-only (NOT part of OpenStack).
|
87 |
-
*
|
88 |
-
* @param string $name the name of the service
|
89 |
-
* (e.g., 'Cloud Load Balancers')
|
90 |
-
* @param string $region the region (e.g., 'DFW')
|
91 |
-
* @param string $urltype the type of URL (e.g., 'publicURL');
|
92 |
-
*/
|
93 |
-
public function LoadBalancerService($name=NULL,$region=NULL,$urltype=NULL) {
|
94 |
-
return $this->Service('LoadBalancerService', $name, $region, $urltype);
|
95 |
-
}
|
96 |
-
|
97 |
-
/**
|
98 |
-
* creates a new DNS service object
|
99 |
-
*
|
100 |
-
* This is a factory method that is currently Rackspace-only
|
101 |
-
* (not available via the OpenStack class)
|
102 |
-
*/
|
103 |
-
public function DNS($name=NULL, $region=NULL, $urltype=NULL) {
|
104 |
-
return $this->Service('DNS', $name, $region, $urltype);
|
105 |
-
}
|
106 |
-
|
107 |
-
} // end class Rackspace
|
1 |
<?php
|
2 |
/**
|
3 |
+
* provided for backwards compatibility
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
*/
|
5 |
+
require_once dirname(__FILE__).'/php-opencloud.php';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uninstall.php
CHANGED
@@ -4,9 +4,27 @@ if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) )
|
|
4 |
die();
|
5 |
|
6 |
global $wpdb;
|
|
|
7 |
|
8 |
//only uninstall if no BackWPup Version active
|
9 |
if ( ! class_exists( 'BackWPup' ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
//delete log folder and logs
|
11 |
$log_folder = get_site_option( 'backwpup_cfg_logfolder' );
|
12 |
if ( $dir = opendir( $log_folder ) ) {
|
4 |
die();
|
5 |
|
6 |
global $wpdb;
|
7 |
+
/* @var wpdb $wpdb */
|
8 |
|
9 |
//only uninstall if no BackWPup Version active
|
10 |
if ( ! class_exists( 'BackWPup' ) ) {
|
11 |
+
//remove roles from user
|
12 |
+
/* @var WP_User $user */
|
13 |
+
$users = get_users( array( 'role' => 'backwpup_admin' ) );
|
14 |
+
foreach ( $users as $user ) {
|
15 |
+
$user->remove_role( 'backwpup_admin' );
|
16 |
+
}
|
17 |
+
remove_role( 'backwpup_admin' );
|
18 |
+
$users = get_users( array( 'role' => 'backwpup_helper' ) );
|
19 |
+
foreach ( $users as $user ) {
|
20 |
+
$user->remove_role( 'backwpup_helper' );
|
21 |
+
}
|
22 |
+
remove_role( 'backwpup_helper' );
|
23 |
+
$users = get_users( array( 'role' => 'backwpup_check' ) );
|
24 |
+
foreach ( $users as $user ) {
|
25 |
+
$user->remove_role( 'backwpup_check' );
|
26 |
+
}
|
27 |
+
remove_role( 'backwpup_check' );
|
28 |
//delete log folder and logs
|
29 |
$log_folder = get_site_option( 'backwpup_cfg_logfolder' );
|
30 |
if ( $dir = opendir( $log_folder ) ) {
|