Page Menu
Home
Mnkras Phabricator
Search
Configure Global Search
Log In
Paste
P4
S3 controller.php
Active
Public
Actions
Authored by
Mnkras
on Apr 22 2015, 11:02 PM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
concrete5
Subscribers
None
<?php
namespace
Concrete\Package\S3Storage
;
defined
(
'C5_EXECUTE'
)
or
die
(
"Access Denied."
);
use
\Concrete\Core\File\StorageLocation\Type\Type
;
use
Illuminate\Filesystem\Filesystem
;
use
Symfony\Component\ClassLoader\Psr4ClassLoader
;
/**
*
* @author Michael Krasnow <mnkras@gmail.com>
*
*/
class
Controller
extends
\Package
{
protected
$pkgHandle
=
's3_storage'
;
protected
$appVersionRequired
=
'5.7.3'
;
protected
$pkgVersion
=
'2.0'
;
public
function
getPackageDescription
()
{
return
t
(
"File storage using Amazon S3."
);
}
public
function
getPackageName
()
{
return
t
(
"S3 Storage"
);
}
public
function
install
()
{
$pkg
=
parent
::
install
();
Type
::
add
(
's3'
,
'Amazon S3'
,
$pkg
);
}
/**
* @throws \Illuminate\Filesystem\FileNotFoundException
*/
public
function
on_start
()
{
$fs
=
new
Filesystem
;
try
{
$fs
->
getRequire
(
__DIR__
.
'/vendor/autoload.php'
);
}
catch
(
\Illuminate\Filesystem\FileNotFoundException
$e
)
{
throw
new
\Exception
(
t
(
'You forgot to run composer :/'
));
}
$loader
=
new
Psr4ClassLoader
();
$loader
->
addPrefix
(
'
\\
S3Storage'
,
__DIR__
.
'/src/S3Storage/'
);
//This is to account for c5 changing autoloading in 5.7.4 >.< (Korvin's fault)
$loader
->
addPrefix
(
'
\\
Concrete
\\
Package
\\
S3Storage
\\
Core
\\
File
\\
StorageLocation
\\
Configuration'
,
__DIR__
.
'/src/S3Storage/'
);
$loader
->
register
();
//This is also needed because c5 won't autoload the class anymore
\Core
::
bind
(
'
\C
oncrete
\P
ackage
\S
3Storage
\C
ore
\F
ile
\S
torageLocation
\C
onfiguration
\S
3Configuration'
,
'S3Storage
\S
3Configuration'
);
}
}
Event Timeline
Mnkras
edited the content of this paste.
(Show Details)
Apr 22 2015, 11:02 PM
2015-04-22 23:02:24 (UTC-4)
Mnkras
changed the title of this paste from untitled to
S3 controller.php
.
Mnkras
updated the paste's language from
autodetect
to
autodetect
.
Mnkras
changed the visibility from "All Users" to "Public (No Login Required)".
Mnkras
added a project:
concrete5
.
Log In to Comment