Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
services
t3o sites
extensions.typo3.org
extensions.typo3.org
Commits
1182348e
Commit
1182348e
authored
Jun 10, 2017
by
Jens Jacobsen
Browse files
Fix Exception class usage in namespaced class files
parent
c54df7ed
Pipeline
#945
failed with stages
in 2 minutes and 15 seconds
Changes
16
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
html/typo3conf/ext/ter_fe2/Classes/Cache/FileCache.php
View file @
1182348e
...
...
@@ -46,7 +46,7 @@ class FileCache implements \TYPO3\CMS\Core\SingletonInterface
public
function
setCacheDirectory
(
$cacheDirectory
)
{
if
(
empty
(
$cacheDirectory
))
{
throw
new
Exception
(
'An empty cache directory is not allowed'
);
throw
new
\
Exception
(
'An empty cache directory is not allowed'
);
}
$this
->
cacheDirectory
=
\
T3o\TerFe2\Utility\File
::
getAbsoluteDirectory
(
$cacheDirectory
);
}
...
...
@@ -171,7 +171,7 @@ class FileCache implements \TYPO3\CMS\Core\SingletonInterface
}
$cacheDirectory
=
$this
->
getCacheDirectory
();
if
(
empty
(
$cacheDirectory
))
{
throw
new
Exception
(
'No cache directory defined'
);
throw
new
\
Exception
(
'No cache directory defined'
);
}
return
$cacheDirectory
.
$filename
;
}
...
...
html/typo3conf/ext/ter_fe2/Classes/Controller/AbstractTerBasedController.php
View file @
1182348e
...
...
@@ -113,7 +113,7 @@ abstract class AbstractTerBasedController extends \T3o\TerFe2\Controller\Abstrac
{
// Check the wsdl uri
if
(
empty
(
$this
->
terSettings
[
'wsdl'
]))
{
throw
new
Exception
(
'No wsdl set to connect to TER server'
);
throw
new
\
Exception
(
'No wsdl set to connect to TER server'
);
}
// Create connection
...
...
html/typo3conf/ext/ter_fe2/Classes/Controller/ExtensionController.php
View file @
1182348e
...
...
@@ -186,7 +186,7 @@ class ExtensionController extends \T3o\TerFe2\Controller\AbstractController
{
if
(
!
empty
(
$extensionKey
))
{
if
(
!
is_string
(
$extensionKey
))
{
throw
new
Exception
(
'No valid extension key given'
);
throw
new
\
Exception
(
'No valid extension key given'
);
}
$extension
=
$this
->
extensionRepository
->
findOneByExtKey
(
$extensionKey
);
}
...
...
@@ -435,7 +435,7 @@ class ExtensionController extends \T3o\TerFe2\Controller\AbstractController
$format
=
't3x'
;
}
if
(
$format
!==
't3x'
&&
$format
!==
'zip'
)
{
throw
new
Exception
(
'A download action for the format "'
.
$format
.
'" is not implemented'
);
throw
new
\
Exception
(
'A download action for the format "'
.
$format
.
'" is not implemented'
);
}
$version
=
$this
->
versionRepository
->
findOneByExtensionAndVersionString
(
$extension
,
$versionString
);
...
...
@@ -569,7 +569,7 @@ class ExtensionController extends \T3o\TerFe2\Controller\AbstractController
$files
=
array
();
try
{
$extensionInfo
=
\
T3o\TerFe2\Utility\Archive
::
getExtensionDetailsFromZipArchive
(
$fileInfo
[
'tmp_name'
],
$files
);
}
catch
(
Exception
$exception
)
{
}
catch
(
\
Exception
$exception
)
{
$this
->
forwardWithError
(
$exception
->
getMessage
(),
'uploadVersion'
);
}
unlink
(
$fileInfo
[
'tmp_name'
]);
...
...
@@ -594,7 +594,7 @@ class ExtensionController extends \T3o\TerFe2\Controller\AbstractController
if
(
$result
)
{
$this
->
redirect
(
'index'
,
'Registerkey'
,
NULL
,
array
(
'uploaded'
=>
TRUE
),
$this
->
settings
[
'pages'
][
'manageKeysPID'
]);
}
}
catch
(
Exception
$exception
)
{
}
catch
(
\
Exception
$exception
)
{
$this
->
forwardWithError
(
$exception
->
getMessage
(),
'uploadVersion'
);
}
$this
->
forwardWithError
(
$this
->
translate
(
'msg.createVersionUploadFailed'
),
'uploadVersion'
);
...
...
html/typo3conf/ext/ter_fe2/Classes/Object/ObjectBuilder.php
View file @
1182348e
...
...
@@ -69,7 +69,7 @@ class ObjectBuilder implements \TYPO3\CMS\Core\SingletonInterface
public
function
create
(
$className
,
array
$attributes
)
{
if
(
empty
(
$className
)
||
empty
(
$attributes
))
{
throw
new
Exception
(
'No valid params given to create an object'
);
throw
new
\
Exception
(
'No valid params given to create an object'
);
}
// Check internal cache first
...
...
@@ -126,7 +126,7 @@ class ObjectBuilder implements \TYPO3\CMS\Core\SingletonInterface
protected
function
getClassSchema
(
$className
)
{
if
(
empty
(
$className
))
{
throw
new
Exception
(
'No valid class name given to create a class schema'
);
throw
new
\
Exception
(
'No valid class name given to create a class schema'
);
}
if
(
empty
(
$this
->
classSchemata
[
$className
]))
{
$this
->
classSchemata
[
$className
]
=
$this
->
reflectionService
->
getClassSchema
(
$className
);
...
...
html/typo3conf/ext/ter_fe2/Classes/Persistence/AbstractPersistence.php
View file @
1182348e
...
...
@@ -135,7 +135,7 @@ abstract class AbstractPersistence implements \T3o\TerFe2\Persistence\Persistenc
public
function
set
(
$key
,
$value
)
{
if
(
empty
(
$key
))
{
throw
new
Exception
(
'Empty keys are not allowed'
);
throw
new
\
Exception
(
'Empty keys are not allowed'
);
}
if
(
!
$this
->
isLoaded
())
{
$this
->
load
();
...
...
html/typo3conf/ext/ter_fe2/Classes/Persistence/Session.php
View file @
1182348e
...
...
@@ -39,7 +39,7 @@ class Session extends \T3o\TerFe2\Persistence\AbstractPersistence
public
function
load
()
{
if
(
empty
(
$GLOBALS
[
'TSFE'
]
->
fe_user
))
{
throw
new
Exception
(
'Could not load session without frontend user'
);
throw
new
\
Exception
(
'Could not load session without frontend user'
);
}
if
(
!
$this
->
isLoaded
)
{
$this
->
content
=
$GLOBALS
[
'TSFE'
]
->
fe_user
->
getKey
(
'ses'
,
$this
->
getName
());
...
...
@@ -56,7 +56,7 @@ class Session extends \T3o\TerFe2\Persistence\AbstractPersistence
public
function
save
()
{
if
(
empty
(
$GLOBALS
[
'TSFE'
]
->
fe_user
))
{
throw
new
Exception
(
'Could not save session without frontend user'
);
throw
new
\
Exception
(
'Could not save session without frontend user'
);
}
$GLOBALS
[
'TSFE'
]
->
fe_user
->
setKey
(
'ses'
,
$this
->
getName
(),
$this
->
content
);
$GLOBALS
[
'TSFE'
]
->
storeSessionData
();
...
...
html/typo3conf/ext/ter_fe2/Classes/Provider/FileProvider.php
View file @
1182348e
...
...
@@ -109,7 +109,7 @@ class FileProvider extends \T3o\TerFe2\Provider\AbstractProvider
// Check if file exists
if
(
!
\
T3o\TerFe2\Utility\File
::
fileExists
(
$filename
))
{
if
(
$fileType
===
't3x'
||
$fileType
===
'zip'
)
{
#throw new Exception('File "' . $filename . '" not found');
#throw new
\
Exception('File "' . $filename . '" not found');
}
\
T3o\TerFe2\Utility\Log
::
addMessage
(
'File "'
.
$filename
.
'" not found'
,
'ter_fe2'
,
2
);
...
...
@@ -185,7 +185,7 @@ class FileProvider extends \T3o\TerFe2\Provider\AbstractProvider
protected
function
getExtensionInfo
(
$extension
,
$version
,
$fileHash
)
{
if
(
empty
(
$extension
)
||
empty
(
$version
)
||
empty
(
$fileHash
))
{
throw
new
Exception
(
'Extension key, version and file hash are required to get extension info'
);
throw
new
\
Exception
(
'Extension key, version and file hash are required to get extension info'
);
}
// Fetch file from extension root path
...
...
html/typo3conf/ext/ter_fe2/Classes/Provider/MirrorProvider.php
View file @
1182348e
...
...
@@ -122,7 +122,7 @@ class MirrorProvider extends \T3o\TerFe2\Provider\FileProvider
protected
function
getExtensionInfo
(
$extension
,
$version
,
$fileHash
)
{
if
(
empty
(
$extension
)
||
empty
(
$version
)
||
empty
(
$fileHash
))
{
throw
new
Exception
(
'Extension key, version and file hash are required to get extension info'
);
throw
new
\
Exception
(
'Extension key, version and file hash are required to get extension info'
);
}
// Fetch file from server
...
...
html/typo3conf/ext/ter_fe2/Classes/Provider/ProviderManager.php
View file @
1182348e
...
...
@@ -61,7 +61,7 @@ class ProviderManager implements \TYPO3\CMS\Core\SingletonInterface
public
function
getProvider
(
$name
)
{
if
(
empty
(
$name
))
{
throw
new
Exception
(
'No empty name allowed for an extension provider'
);
throw
new
\
Exception
(
'No empty name allowed for an extension provider'
);
}
$name
=
strtolower
(
trim
(
$name
));
...
...
@@ -71,17 +71,17 @@ class ProviderManager implements \TYPO3\CMS\Core\SingletonInterface
}
if
(
empty
(
$GLOBALS
[
'TYPO3_CONF_VARS'
][
'SC_OPTIONS'
][
'ter_fe2'
][
'extensionProviders'
][
$name
]))
{
throw
new
Exception
(
'No configuration found for an extension provider with name "'
.
$name
.
'"'
);
throw
new
\
Exception
(
'No configuration found for an extension provider with name "'
.
$name
.
'"'
);
}
$configuration
=
$GLOBALS
[
'TYPO3_CONF_VARS'
][
'SC_OPTIONS'
][
'ter_fe2'
][
'extensionProviders'
][
$name
];
if
(
empty
(
$configuration
[
'class'
]))
{
throw
new
Exception
(
'No class name found in configuration for the extension provider with name "'
.
$name
.
'"'
);
throw
new
\
Exception
(
'No class name found in configuration for the extension provider with name "'
.
$name
.
'"'
);
}
$provider
=
$this
->
objectManager
->
get
(
$configuration
[
'class'
]);
if
(
!
(
$provider
instanceof
\
T3o\TerFe2\Provider\ProviderInterface
))
{
throw
new
Exception
(
'Provider "'
.
$name
.
'" does not implement the interface "\T3o\TerFe2\Provider\ProviderInterface"'
);
throw
new
\
Exception
(
'Provider "'
.
$name
.
'" does not implement the interface "\T3o\TerFe2\Provider\ProviderInterface"'
);
}
if
(
!
empty
(
$configuration
[
'configuration'
])
&&
method_exists
(
$provider
,
'setConfiguration'
))
{
$provider
->
setConfiguration
(
$configuration
[
'configuration'
]);
...
...
html/typo3conf/ext/ter_fe2/Classes/Provider/SoapProvider.php
View file @
1182348e
...
...
@@ -65,7 +65,7 @@ class SoapProvider extends \T3o\TerFe2\Provider\AbstractProvider
public
function
initializeProvider
()
{
if
(
empty
(
$this
->
configuration
[
'wsdlUrl'
]))
{
throw
new
Exception
(
'No wsdl url configured'
);
throw
new
\
Exception
(
'No wsdl url configured'
);
}
$username
=
(
empty
(
$this
->
configuration
[
'username'
])
?
$this
->
configuration
[
'username'
]
:
''
);
...
...
@@ -106,7 +106,7 @@ class SoapProvider extends \T3o\TerFe2\Provider\AbstractProvider
public
function
getExtensions
(
$lastRun
,
$offset
,
$count
)
{
if
(
empty
(
$this
->
getExtensionsFunc
))
{
throw
new
Exception
(
'No configuration for "getExtensionsFunc" found'
);
throw
new
\
Exception
(
'No configuration for "getExtensionsFunc" found'
);
}
$parameters
=
array
(
'lastRun'
=>
(
int
)
$lastRun
,
...
...
@@ -128,7 +128,7 @@ class SoapProvider extends \T3o\TerFe2\Provider\AbstractProvider
public
function
getFileUrl
(
\
T3o\TerFe2\Domain\Model\Version
$version
,
$fileType
)
{
if
(
empty
(
$this
->
getFileUrlFunc
))
{
throw
new
Exception
(
'No configuration for "getFileUrlFunc" found'
);
throw
new
\
Exception
(
'No configuration for "getFileUrlFunc" found'
);
}
$parameters
=
array
(
'extension'
=>
(
string
)
$version
->
getExtension
()
->
getExtKey
(),
...
...
@@ -137,7 +137,7 @@ class SoapProvider extends \T3o\TerFe2\Provider\AbstractProvider
);
$result
=
$this
->
soapService
->
__call
(
$this
->
getFileUrlFunc
,
$parameters
);
if
(
empty
(
$result
[
'url'
]))
{
throw
new
Exception
(
'Could not get url to file from soap server'
);
throw
new
\
Exception
(
'Could not get url to file from soap server'
);
}
return
(
string
)
$result
[
'url'
];
}
...
...
@@ -153,7 +153,7 @@ class SoapProvider extends \T3o\TerFe2\Provider\AbstractProvider
public
function
getFileName
(
\
T3o\TerFe2\Domain\Model\Version
$version
,
$fileType
)
{
if
(
empty
(
$this
->
getFileNameFunc
))
{
throw
new
Exception
(
'No configuration for "getFileNameFunc" found'
);
throw
new
\
Exception
(
'No configuration for "getFileNameFunc" found'
);
}
$parameters
=
array
(
'extension'
=>
(
string
)
$version
->
getExtension
()
->
getExtKey
(),
...
...
@@ -162,7 +162,7 @@ class SoapProvider extends \T3o\TerFe2\Provider\AbstractProvider
);
$result
=
$this
->
soapService
->
__call
(
$this
->
getFileNameFunc
,
$parameters
);
if
(
empty
(
$result
[
'filename'
]))
{
throw
new
Exception
(
'Could not get filename from soap server'
);
throw
new
\
Exception
(
'Could not get filename from soap server'
);
}
return
(
string
)
$result
[
'filename'
];
}
...
...
@@ -177,7 +177,7 @@ class SoapProvider extends \T3o\TerFe2\Provider\AbstractProvider
public
function
getVersionDetails
(
\
T3o\TerFe2\Domain\Model\Version
$version
)
{
if
(
empty
(
$this
->
getVersionDetailsFunc
))
{
throw
new
Exception
(
'No configuration for "getVersionDetailsFunc" found'
);
throw
new
\
Exception
(
'No configuration for "getVersionDetailsFunc" found'
);
}
$parameters
=
array
(
'extension'
=>
(
string
)
$version
->
getExtension
()
->
getExtKey
(),
...
...
@@ -185,7 +185,7 @@ class SoapProvider extends \T3o\TerFe2\Provider\AbstractProvider
);
$result
=
$this
->
soapService
->
__call
(
$this
->
getVersionDetailsFunc
,
$parameters
);
if
(
empty
(
$result
)
||
!
is_array
(
$result
))
{
throw
new
Exception
(
'Could not get version details from soap server'
);
throw
new
\
Exception
(
'Could not get version details from soap server'
);
}
return
$result
;
}
...
...
html/typo3conf/ext/ter_fe2/Classes/Service/Documentation.php
View file @
1182348e
...
...
@@ -77,7 +77,7 @@ class Documentation implements \TYPO3\CMS\Core\SingletonInterface
public
function
getDocumentationLink
(
$extensionKey
,
$versionString
)
{
if
(
empty
(
$extensionKey
)
||
empty
(
$versionString
))
{
throw
new
Exception
(
'Extension key and version string are required to build a documentation url'
);
throw
new
\
Exception
(
'Extension key and version string are required to build a documentation url'
);
}
$manualExists
=
isset
(
$this
->
docsInformation
->
$extensionKey
);
...
...
html/typo3conf/ext/ter_fe2/Classes/Service/Mirror.php
View file @
1182348e
...
...
@@ -164,7 +164,7 @@ class Mirror implements \TYPO3\CMS\Core\SingletonInterface
$mirrors
=
$repositoryUtility
->
getMirrors
(
TRUE
)
->
getMirrors
();
unset
(
$repositoryUtility
);
if
(
!
is_array
(
$mirrors
))
{
throw
new
Exception
(
'No mirrors found'
);
throw
new
\
Exception
(
'No mirrors found'
);
}
}
...
...
@@ -187,7 +187,7 @@ class Mirror implements \TYPO3\CMS\Core\SingletonInterface
public
function
getUrlToFile
(
$filename
)
{
if
(
empty
(
$filename
))
{
throw
new
Exception
(
'No filename given to generate url'
);
throw
new
\
Exception
(
'No filename given to generate url'
);
}
// Get first mirror url
...
...
@@ -199,7 +199,7 @@ class Mirror implements \TYPO3\CMS\Core\SingletonInterface
while
(
!
\
T3o\TerFe2\Utility\File
::
fileExists
(
$mirrorUrl
.
$filename
))
{
$attempts
++
;
if
(
$attempts
>
$maxAttempts
)
{
// throw new Exception('File "' . $filename . '" could not be found on ' . $maxAttempts . ' mirrors, break');
// throw new
\
Exception('File "' . $filename . '" could not be found on ' . $maxAttempts . ' mirrors, break');
// break;
return
''
;
}
...
...
@@ -228,7 +228,7 @@ class Mirror implements \TYPO3\CMS\Core\SingletonInterface
}
if
(
empty
(
$content
))
{
throw
new
Exception
(
'Could not fetch file "'
.
$filename
.
'" from mirror server'
);
throw
new
\
Exception
(
'Could not fetch file "'
.
$filename
.
'" from mirror server'
);
}
return
(
string
)
$content
;
...
...
html/typo3conf/ext/ter_fe2/Classes/Service/Soap.php
View file @
1182348e
...
...
@@ -61,11 +61,11 @@ class Soap implements \TYPO3\CMS\Core\SingletonInterface
{
if
(
empty
(
$wsdlUrl
))
{
throw
new
Exception
(
'No valid wsdl URL given'
);
throw
new
\
Exception
(
'No valid wsdl URL given'
);
}
if
(
!
class_exists
(
'SoapClient'
))
{
throw
new
Exception
(
'PHP SOAP extension not available'
);
throw
new
\
Exception
(
'PHP SOAP extension not available'
);
}
$this
->
wsdlUrl
=
$wsdlUrl
;
...
...
@@ -170,7 +170,7 @@ class Soap implements \TYPO3\CMS\Core\SingletonInterface
// // Check for existing connection
// if (empty($this->soapConnection)) {
// throw new Exception('Create SOAP connection first');
// throw new
\
Exception('Create SOAP connection first');
// }
// Call given method
...
...
@@ -183,7 +183,7 @@ class Soap implements \TYPO3\CMS\Core\SingletonInterface
// Check for errors
if
(
is_soap_fault
(
$response
))
{
throw
new
Exception
(
'Could not call function "'
.
$methodName
.
'" on soap server'
);
throw
new
\
Exception
(
'Could not call function "'
.
$methodName
.
'" on soap server'
);
}
return
$this
->
convertObjectToArray
(
$response
);
...
...
html/typo3conf/ext/ter_fe2/Classes/Task/CreateExtensionFilesTask.php
View file @
1182348e
...
...
@@ -69,7 +69,7 @@ class CreateExtensionFilesTask extends \T3o\TerFe2\Task\AbstractTask
$this
->
persistenceManager
=
$this
->
objectManager
->
get
(
\
TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager
::
class
);
if
(
empty
(
$this
->
setup
[
'settings.'
][
'mediaRootPath'
]))
{
throw
new
Exception
(
'Please configure "plugin.tx_terfe2.settings.mediaRootPath" in TypoScript setup'
);
throw
new
\
Exception
(
'Please configure "plugin.tx_terfe2.settings.mediaRootPath" in TypoScript setup'
);
}
$this
->
mediaRootPath
=
$this
->
setup
[
'settings.'
][
'mediaRootPath'
];
}
...
...
@@ -200,7 +200,7 @@ class CreateExtensionFilesTask extends \T3o\TerFe2\Task\AbstractTask
}
$images
=
\
T3o\TerFe2\Service\Image
::
processImages
(
$imageFiles
,
$this
->
setup
[
'settings.'
][
$imageSize
.
'Image'
]);
if
(
empty
(
$images
))
{
throw
new
Exception
(
'Could not create image files'
);
throw
new
\
Exception
(
'Could not create image files'
);
}
}
...
...
html/typo3conf/ext/ter_fe2/Classes/Task/UpdateExtensionListTask.php
View file @
1182348e
...
...
@@ -103,12 +103,12 @@ class UpdateExtensionListTask extends \T3o\TerFe2\Task\AbstractTask
{
// Check static setup
if
(
empty
(
$this
->
setup
[
'settings.'
]))
{
throw
new
Exception
(
'Please include static setup "TER Frontend - Default Configuration (ter_fe2)" on root page'
);
throw
new
\
Exception
(
'Please include static setup "TER Frontend - Default Configuration (ter_fe2)" on root page'
);
}
// Check storage page
if
(
!
$this
->
storagePageConfigured
())
{
throw
new
Exception
(
'Please configure "plugin.tx_terfe2.persistence.storagePid" in TypoScript setup'
);
throw
new
\
Exception
(
'Please configure "plugin.tx_terfe2.persistence.storagePid" in TypoScript setup'
);
}
// Get extension structure from provider
...
...
html/typo3conf/ext/ter_fe2/Classes/Utility/Archive.php
View file @
1182348e
...
...
@@ -42,7 +42,7 @@ class Archive
public
static
function
createZipArchive
(
$filename
,
array
$files
,
$overwrite
=
FALSE
)
{
if
(
!
class_exists
(
'ZipArchive'
))
{
throw
new
Exception
(
'Please make sure that php zip extension is installed'
);
throw
new
\
Exception
(
'Please make sure that php zip extension is installed'
);
}
// Check if file already exists
...
...
@@ -54,7 +54,7 @@ class Archive
$createMode
=
(
$overwrite
?
ZIPARCHIVE
::
OVERWRITE
:
ZIPARCHIVE
::
CREATE
);
$zipArchive
=
new
ZipArchive
();
if
(
empty
(
$zipArchive
)
||
!
$zipArchive
->
open
(
$filename
,
$createMode
))
{
throw
new
Exception
(
'Could not open ZIP file to write'
);
throw
new
\
Exception
(
'Could not open ZIP file to write'
);
}
// Add files
...
...
@@ -63,13 +63,13 @@ class Archive
continue
;
}
if
(
!
$zipArchive
->
addFromString
(
$path
,
(
string
)
$content
))
{
throw
new
Exception
(
'Could not write file "'
.
$path
.
'" into ZIP file'
);
throw
new
\
Exception
(
'Could not write file "'
.
$path
.
'" into ZIP file'
);
}
}
// Save and close
if
(
!
$zipArchive
->
close
())
{
throw
new
Exception
(
'Could not close ZIP file'
);
throw
new
\
Exception
(
'Could not close ZIP file'
);
}
return
TRUE
;
...
...
@@ -87,34 +87,34 @@ class Archive
public
static
function
extractZipArchive
(
$filename
,
$path
,
$files
=
NULL
)
{
if
(
!
class_exists
(
'ZipArchive'
))
{
throw
new
Exception
(
'Please make sure that php zip extension is installed'
);
throw
new
\
Exception
(
'Please make sure that php zip extension is installed'
);
}
// Check if file exists
if
(
!
\
T3o\TerFe2\Utility\File
::
fileExists
(
$filename
))
{
throw
new
Exception
(
'File "'
.
$filename
.
'" not found to extract'
);
throw
new
\
Exception
(
'File "'
.
$filename
.
'" not found to extract'
);
}
// Check if path is writable
$path
=
\
T3o\TerFe2\Utility\File
::
getAbsoluteDirectory
(
$path
);
if
(
!
is_writable
(
$path
))
{
throw
new
Exception
(
'Path "'
.
$path
.
'" is not writeable'
);
throw
new
\
Exception
(
'Path "'
.
$path
.
'" is not writeable'
);
}
// Load zip archive
$zipArchive
=
new
ZipArchive
();
if
(
empty
(
$zipArchive
)
||
!
$zipArchive
->
open
(
$filename
))
{
throw
new
Exception
(
'Could not open zip file to read'
);
throw
new
\
Exception
(
'Could not open zip file to read'
);
}
// Extract
if
(
!
$zipArchive
->
extractTo
(
$path
,
$files
))
{
throw
new
Exception
(
'Could not extract file "'
.
$filename
.
'" to path "'
.
$path
.
'"'
);
throw
new
\
Exception
(
'Could not extract file "'
.
$filename
.
'" to path "'
.
$path
.
'"'
);
}
// Save and close
if
(
!
$zipArchive
->
close
())
{
throw
new
Exception
(
'Could not close ZIP file'
);
throw
new
\
Exception
(
'Could not close ZIP file'
);
}
return
TRUE
;
...
...
@@ -130,18 +130,18 @@ class Archive
public
static
function
getZipArchiveContent
(
$filename
)
{
if
(
!
class_exists
(
'ZipArchive'
))
{
throw
new
Exception
(
'Please make sure that php zip extension is installed'
);
throw
new
\
Exception
(
'Please make sure that php zip extension is installed'
);
}
// Check if file exists
if
(
!
\
T3o\TerFe2\Utility\File
::
fileExists
(
$filename
))
{
throw
new
Exception
(
'File "'
.
$filename
.
'" not found to extract'
);
throw
new
\
Exception
(
'File "'
.
$filename
.
'" not found to extract'
);
}
// Load zip archive
$zipArchive
=
new
ZipArchive
();
if
(
empty
(
$zipArchive
)
||
!
$zipArchive
->
open
(
$filename
))
{
throw
new
Exception
(
'Could not open zip file to read'
);
throw
new
\
Exception
(
'Could not open zip file to read'
);
}
// Get all files
...
...
@@ -182,10 +182,10 @@ class Archive
public
static
function
convertT3xToZip
(
$t3xFile
,
$zipFile
)
{
if
(
empty
(
$t3xFile
))
{
throw
new
Exception
(
'No valid t3x file given to convert to zip file'
);
throw
new
\
Exception
(
'No valid t3x file given to convert to zip file'
);
}
if
(
empty
(
$zipFile
))
{
throw
new
Exception
(
'No valid zip file given to convert t3x file into'
);
throw
new
\
Exception
(
'No valid zip file given to convert t3x file into'
);
}
// Check if file was cached
...
...
@@ -382,7 +382,7 @@ class Archive
eval
(
$code
);
return
reset
(
$EM_CONF
);
}
catch
(
Exception
$e
)
{
}
catch
(
\
Exception
$e
)
{
return
NULL
;
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment