Merge branch 'storageareas' of github.com:/ConnorTechnology/ZoneMinder into storageareas

pull/2077/head
Isaac Connor 2018-03-23 13:37:43 -04:00
commit 01f159c20e
764 changed files with 14958 additions and 8438 deletions

View File

@ -26,28 +26,30 @@ if [ "$1" = "configure" ]; then
# Ensure zoneminder is stopped # Ensure zoneminder is stopped
deb-systemd-invoke stop zoneminder.service || exit $? deb-systemd-invoke stop zoneminder.service || exit $?
#
# Get mysql started if it isn't running # Get mysql started if it isn't running
# #
$(systemctl status mysql.service >/dev/null 2>&1); MYSQL_STATUS=$?
$(systemctl status mariadb.service >/dev/null 2>&1); MARIADB_STATUS=$?
# 3 = inactive, 4 = nonexistant if [ -e "/lib/systemd/system/mariadb.service" ]; then
if [ "$MARIADB_STATUS" != "4" ]; then
DBSERVICE="mariadb.service" DBSERVICE="mariadb.service"
else else
DBSERVICE="mysql.service" DBSERVICE="mysql.service"
fi fi
if systemctl is-failed --quiet $DBSERVICE; then
echo "$DBSERVICE is in a failed state; it will not be started."
echo "If you have already resolved the problem preventing $DBSERVICE from running,"
echo "run sudo systemctl restart $DBSERVICE then run sudo dpkg-reconfigure zoneminder."
exit 1
fi
if [ "$MYSQL_STATUS" != "0" ] && [ "$MARIADB_STATUS" != "0" ]; then if ! systemctl is-active --quiet mysql.service mariadb.service; then
# 3 = inactive, 4 = nonexistant
# Due to /etc/init.d service autogeneration, mysql.service always returns the status of mariadb.service # Due to /etc/init.d service autogeneration, mysql.service always returns the status of mariadb.service
# However, mariadb.service will not return the status of mysql.service. # However, mariadb.service will not return the status of mysql.service.
deb-systemd-invoke start $DBSERVICE deb-systemd-invoke start $DBSERVICE
fi fi
# Make sure systemctl status exit code is 0; i.e. the DB is running # Make sure systemctl status exit code is 0; i.e. the DB is running
if systemctl status "$DBSERVICE" >/dev/null 2>&1; then if systemctl is-active --quiet "$DBSERVICE"; then
mysqladmin --defaults-file=/etc/mysql/debian.cnf -f reload mysqladmin --defaults-file=/etc/mysql/debian.cnf -f reload
# test if database if already present... # test if database if already present...
if ! $(echo quit | mysql --defaults-file=/etc/mysql/debian.cnf zm > /dev/null 2> /dev/null) ; then if ! $(echo quit | mysql --defaults-file=/etc/mysql/debian.cnf zm > /dev/null 2> /dev/null) ; then

View File

@ -63,20 +63,24 @@ if ( ! defined $interval ) {
$interval = eval($Config{ZM_TELEMETRY_INTERVAL}); $interval = eval($Config{ZM_TELEMETRY_INTERVAL});
} }
if ( $Config{ZM_TELEMETRY_DATA} or $force ) { if ( !($Config{ZM_TELEMETRY_DATA} or $force) ) {
print "Update agent starting at ".strftime( '%y/%m/%d %H:%M:%S', localtime() )."\n"; print "ZoneMinder Telemetry Agent not enabled. Exiting.\n";
exit(0);
}
my $lastCheck = $Config{ZM_TELEMETRY_LAST_UPLOAD}; print 'ZoneMinder Telemetry Agent starting at '.strftime( '%y/%m/%d %H:%M:%S', localtime() )."\n";
while( 1 ) { my $lastCheck = $Config{ZM_TELEMETRY_LAST_UPLOAD};
while( 1 ) {
my $now = time(); my $now = time();
my $since_last_check = $now-$lastCheck; my $since_last_check = $now-$lastCheck;
Debug(" Last Check time (now($now) - lastCheck($lastCheck)) = $since_last_check > interval($interval) or force($force)"); Debug(" Last Check time (now($now) - lastCheck($lastCheck)) = $since_last_check > interval($interval) or force($force)");
if ( $since_last_check < 0 ) { if ( $since_last_check < 0 ) {
Warning( "Seconds since last check is negative! Which means that lastCheck is in the future!" ); Warning( 'Seconds since last check is negative! Which means that lastCheck is in the future!' );
next; next;
} }
if ( ( ($now-$lastCheck) > $interval ) or $force ) { if ( ( ($since_last_check) > $interval ) or $force ) {
print "Collecting data to send to ZoneMinder Telemetry server.\n"; print "Collecting data to send to ZoneMinder Telemetry server.\n";
my $dbh = zmDbConnect(); my $dbh = zmDbConnect();
# Build the telemetry hash # Build the telemetry hash
@ -94,26 +98,25 @@ if ( $Config{ZM_TELEMETRY_DATA} or $force ) {
$telemetry{processor_count} = cpu_count(); $telemetry{processor_count} = cpu_count();
$telemetry{monitors} = getMonitorRef($dbh); $telemetry{monitors} = getMonitorRef($dbh);
Info( 'Sending data to ZoneMinder Telemetry server.' ); Info('Sending data to ZoneMinder Telemetry server.');
my $result = jsonEncode( \%telemetry ); my $result = jsonEncode(\%telemetry);
if ( sendData($result) ) { if ( sendData($result) ) {
my $sql = q`UPDATE Config SET Value = ? WHERE Name = 'ZM_TELEMETRY_LAST_UPLOAD'`; my $sql = q`UPDATE Config SET Value = ? WHERE Name = 'ZM_TELEMETRY_LAST_UPLOAD'`;
my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() ); my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() );
my $res = $sth->execute( $now ) or die( "Can't execute: ".$sth->errstr() ); my $res = $sth->execute($now) or die( "Can't execute: ".$sth->errstr() );
$sth->finish(); $sth->finish();
$Config{ZM_TELEMETRY_LAST_UPLOAD} = $now; $Config{ZM_TELEMETRY_LAST_UPLOAD} = $now;
} }
zmDbDisconnect(); zmDbDisconnect();
} elsif ( -t STDIN ) { } elsif ( -t STDIN ) {
print "Update agent sleeping for 1 hour because ($now-$lastCheck=$since_last_check > $interval\n"; print "ZoneMinder Telemetry Agent sleeping for $interval seconds because ($now-$lastCheck=$since_last_check > $interval\n";
} }
sleep( 3600 ); $lastCheck = $now;
} sleep($interval);
print 'Update agent exiting at '.strftime( '%y/%m/%d %H:%M:%S', localtime() )."\n"; } # end while
} print 'ZoneMinder Telemetry Agent exiting at '.strftime('%y/%m/%d %H:%M:%S', localtime())."\n";
############### ###############
# SUBROUTINES # # SUBROUTINES #
@ -178,7 +181,7 @@ sub sendData {
# Retrieves the UUID from the database. Creates a new UUID if one does not exist. # Retrieves the UUID from the database. Creates a new UUID if one does not exist.
sub getUUID { sub getUUID {
my $dbh = shift; my $dbh = shift;
my $uuid= ""; my $uuid= '';
# Verify the current UUID is valid and not nil # Verify the current UUID is valid and not nil
if (( $Config{ZM_TELEMETRY_UUID} =~ /([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/i ) && ( $Config{ZM_TELEMETRY_UUID} ne '00000000-0000-0000-0000-000000000000' )) { if (( $Config{ZM_TELEMETRY_UUID} =~ /([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/i ) && ( $Config{ZM_TELEMETRY_UUID} ne '00000000-0000-0000-0000-000000000000' )) {

View File

@ -39,26 +39,26 @@ bool zmDbConnect() {
return false; return false;
} }
my_bool reconnect = 1; my_bool reconnect = 1;
if ( mysql_options( &dbconn, MYSQL_OPT_RECONNECT, &reconnect ) ) if ( mysql_options(&dbconn, MYSQL_OPT_RECONNECT, &reconnect) )
Error( "Can't set database auto reconnect option: %s", mysql_error( &dbconn) ); Error("Can't set database auto reconnect option: %s", mysql_error(&dbconn));
if ( !staticConfig.DB_SSL_CA_CERT.empty() ) if ( !staticConfig.DB_SSL_CA_CERT.empty() )
mysql_ssl_set( &dbconn, mysql_ssl_set(&dbconn,
staticConfig.DB_SSL_CLIENT_KEY.c_str(), staticConfig.DB_SSL_CLIENT_KEY.c_str(),
staticConfig.DB_SSL_CLIENT_CERT.c_str(), staticConfig.DB_SSL_CLIENT_CERT.c_str(),
staticConfig.DB_SSL_CA_CERT.c_str(), staticConfig.DB_SSL_CA_CERT.c_str(),
NULL, NULL ); NULL, NULL);
std::string::size_type colonIndex = staticConfig.DB_HOST.find( ":" ); std::string::size_type colonIndex = staticConfig.DB_HOST.find(":");
if ( colonIndex == std::string::npos ) { if ( colonIndex == std::string::npos ) {
if ( !mysql_real_connect( &dbconn, staticConfig.DB_HOST.c_str(), staticConfig.DB_USER.c_str(), staticConfig.DB_PASS.c_str(), NULL, 0, NULL, 0 ) ) { if ( !mysql_real_connect(&dbconn, staticConfig.DB_HOST.c_str(), staticConfig.DB_USER.c_str(), staticConfig.DB_PASS.c_str(), NULL, 0, NULL, 0) ) {
Error( "Can't connect to server: %s", mysql_error( &dbconn ) ); Error( "Can't connect to server: %s", mysql_error(&dbconn));
return false; return false;
} }
} else { } else {
std::string dbHost = staticConfig.DB_HOST.substr( 0, colonIndex ); std::string dbHost = staticConfig.DB_HOST.substr( 0, colonIndex );
std::string dbPortOrSocket = staticConfig.DB_HOST.substr( colonIndex+1 ); std::string dbPortOrSocket = staticConfig.DB_HOST.substr( colonIndex+1 );
if ( dbPortOrSocket[0] == '/' ) { if ( dbPortOrSocket[0] == '/' ) {
if ( !mysql_real_connect( &dbconn, NULL, staticConfig.DB_USER.c_str(), staticConfig.DB_PASS.c_str(), NULL, 0, dbPortOrSocket.c_str(), 0 ) ) { if ( !mysql_real_connect(&dbconn, NULL, staticConfig.DB_USER.c_str(), staticConfig.DB_PASS.c_str(), NULL, 0, dbPortOrSocket.c_str(), 0) ) {
Error( "Can't connect to server: %s", mysql_error( &dbconn ) ); Error("Can't connect to server: %s", mysql_error(&dbconn));
return false; return false;
} }
} else { } else {
@ -70,7 +70,7 @@ bool zmDbConnect() {
} }
if ( mysql_select_db( &dbconn, staticConfig.DB_NAME.c_str() ) ) { if ( mysql_select_db( &dbconn, staticConfig.DB_NAME.c_str() ) ) {
Error( "Can't select database: %s", mysql_error( &dbconn ) ); Error( "Can't select database: %s", mysql_error( &dbconn ) );
exit( mysql_errno( &dbconn ) ); return false;
} }
zmDbConnected = true; zmDbConnected = true;
return zmDbConnected; return zmDbConnected;
@ -78,67 +78,71 @@ bool zmDbConnect() {
void zmDbClose() { void zmDbClose() {
if ( zmDbConnected ) { if ( zmDbConnected ) {
db_mutex.lock();
mysql_close( &dbconn ); mysql_close( &dbconn );
// mysql_init() call implicitly mysql_library_init() but // mysql_init() call implicitly mysql_library_init() but
// mysql_close() does not call mysql_library_end() // mysql_close() does not call mysql_library_end()
mysql_library_end(); mysql_library_end();
zmDbConnected = false; zmDbConnected = false;
db_mutex.unlock();
} }
} }
MYSQL_RES * zmDbFetch( const char * query ) { MYSQL_RES * zmDbFetch(const char * query) {
if ( ! zmDbConnected ) { if ( ! zmDbConnected ) {
Error( "Not connected." ); Error("Not connected.");
return NULL; return NULL;
} }
db_mutex.lock(); db_mutex.lock();
if ( mysql_query( &dbconn, query ) ) { if ( mysql_query(&dbconn, query) ) {
Error( "Can't run query: %s", mysql_error( &dbconn ) ); Error("Can't run query: %s", mysql_error(&dbconn));
db_mutex.unlock();
return NULL; return NULL;
} }
Debug( 4, "Success running query: %s", query ); Debug(4, "Success running query: %s", query);
MYSQL_RES *result = mysql_store_result( &dbconn ); MYSQL_RES *result = mysql_store_result(&dbconn);
if ( !result ) { if ( !result ) {
Error( "Can't use query result: %s for query %s", mysql_error( &dbconn ), query ); Error("Can't use query result: %s for query %s", mysql_error(&dbconn), query);
return NULL;
} }
db_mutex.unlock(); db_mutex.unlock();
return result; return result;
} // end MYSQL_RES * zmDbFetch( const char * query ); } // end MYSQL_RES * zmDbFetch(const char * query);
zmDbRow *zmDbFetchOne( const char *query ) { zmDbRow *zmDbFetchOne(const char *query) {
zmDbRow *row = new zmDbRow(); zmDbRow *row = new zmDbRow();
if ( row->fetch( query ) ) { if ( row->fetch(query) ) {
return row; return row;
} }
delete row; delete row;
return NULL; return NULL;
} }
MYSQL_RES *zmDbRow::fetch( const char *query ) { MYSQL_RES *zmDbRow::fetch(const char *query) {
result_set = zmDbFetch( query ); result_set = zmDbFetch(query);
if ( ! result_set ) return result_set; if ( ! result_set ) return result_set;
int n_rows = mysql_num_rows( result_set ); int n_rows = mysql_num_rows( result_set );
if ( n_rows != 1 ) { if ( n_rows != 1 ) {
Error( "Bogus number of lines return from query, %d returned for query %s.", n_rows, query ); Error("Bogus number of lines return from query, %d returned for query %s.", n_rows, query);
mysql_free_result( result_set ); mysql_free_result(result_set);
result_set = NULL; result_set = NULL;
return result_set; return result_set;
} }
row = mysql_fetch_row( result_set ); row = mysql_fetch_row(result_set);
if ( ! row ) { if ( ! row ) {
mysql_free_result( result_set ); mysql_free_result(result_set);
result_set = NULL; result_set = NULL;
Error("Error getting row from query %s. Error is %s", query, mysql_error( &dbconn ) ); Error("Error getting row from query %s. Error is %s", query, mysql_error(&dbconn));
} else { } else {
Debug(5, "Success"); Debug(5, "Success");
} }
return result_set; return result_set;
} }
zmDbRow::~zmDbRow() { zmDbRow::~zmDbRow() {
if ( result_set ) if ( result_set ) {
mysql_free_result( result_set ); mysql_free_result(result_set);
result_set = NULL;
}
} }

View File

@ -187,7 +187,7 @@ int FfmpegCamera::Capture( Image &image ) {
int frameComplete = false; int frameComplete = false;
while ( !frameComplete ) { while ( !frameComplete ) {
int avResult = av_read_frame( mFormatContext, &packet ); int avResult = av_read_frame(mFormatContext, &packet);
char errbuf[AV_ERROR_MAX_STRING_SIZE]; char errbuf[AV_ERROR_MAX_STRING_SIZE];
if ( avResult < 0 ) { if ( avResult < 0 ) {
av_strerror(avResult, errbuf, AV_ERROR_MAX_STRING_SIZE); av_strerror(avResult, errbuf, AV_ERROR_MAX_STRING_SIZE);
@ -197,15 +197,10 @@ int FfmpegCamera::Capture( Image &image ) {
// Check for Connection failure. // Check for Connection failure.
(avResult == -110) (avResult == -110)
) { ) {
Info( "av_read_frame returned \"%s\". Reopening stream.", errbuf ); Info("Unable to read packet from stream %d: error %d \"%s\".", packet.stream_index, avResult, errbuf);
if ( ReopenFfmpeg() < 0 ) { } else {
// OpenFfmpeg will do enough logging. Error("Unable to read packet from stream %d: error %d \"%s\".", packet.stream_index, avResult, errbuf);
return -1;
} }
continue;
}
Error( "Unable to read packet from stream %d: error %d \"%s\".", packet.stream_index, avResult, errbuf );
return -1; return -1;
} }
@ -707,10 +702,19 @@ int FfmpegCamera::CaptureAndRecord( Image &image, timeval recording, char* event
while ( ! frameComplete ) { while ( ! frameComplete ) {
av_init_packet( &packet ); av_init_packet( &packet );
ret = av_read_frame( mFormatContext, &packet ); ret = av_read_frame(mFormatContext, &packet);
if ( ret < 0 ) { if ( ret < 0 ) {
av_strerror( ret, errbuf, AV_ERROR_MAX_STRING_SIZE ); av_strerror(ret, errbuf, AV_ERROR_MAX_STRING_SIZE);
Error( "Unable to read packet from stream %d: error %d \"%s\".", packet.stream_index, ret, errbuf ); if (
// Check if EOF.
(ret == AVERROR_EOF || (mFormatContext->pb && mFormatContext->pb->eof_reached)) ||
// Check for Connection failure.
(ret == -110)
) {
Info("Unable to read packet from stream %d: error %d \"%s\".", packet.stream_index, ret, errbuf);
} else {
Error("Unable to read packet from stream %d: error %d \"%s\".", packet.stream_index, ret, errbuf);
}
return -1; return -1;
} }

View File

@ -61,22 +61,22 @@ void Logger::usrHandler( int sig ) {
logger->level( logger->level()+1 ); logger->level( logger->level()+1 );
else if ( sig == SIGUSR2 ) else if ( sig == SIGUSR2 )
logger->level( logger->level()-1 ); logger->level( logger->level()-1 );
Info( "Logger - Level changed to %d", logger->level() ); Info("Logger - Level changed to %d", logger->level());
} }
Logger::Logger() : Logger::Logger() :
mLevel( INFO ), mLevel(INFO),
mTerminalLevel( NOLOG ), mTerminalLevel(NOLOG),
mDatabaseLevel( NOLOG ), mDatabaseLevel(NOLOG),
mFileLevel( NOLOG ), mFileLevel(NOLOG),
mSyslogLevel( NOLOG ), mSyslogLevel(NOLOG),
mEffectiveLevel( NOLOG ), mEffectiveLevel(NOLOG),
//mLogPath( staticConfig.PATH_LOGS.c_str() ), //mLogPath( staticConfig.PATH_LOGS.c_str() ),
//mLogFile( mLogPath+"/"+mId+".log" ), //mLogFile( mLogPath+"/"+mId+".log" ),
mDbConnected( false ), mDbConnected(false),
mLogFileFP( NULL ), mLogFileFP(NULL),
mHasTerminal( false ), mHasTerminal(false),
mFlush( false ) { mFlush(false) {
if ( smInstance ) { if ( smInstance ) {
Panic( "Attempt to create second instance of Logger class" ); Panic( "Attempt to create second instance of Logger class" );
@ -124,7 +124,7 @@ Logger::~Logger() {
#endif #endif
} }
void Logger::initialise( const std::string &id, const Options &options ) { void Logger::initialise(const std::string &id, const Options &options) {
char *envPtr; char *envPtr;
if ( !id.empty() ) if ( !id.empty() )
@ -132,7 +132,7 @@ void Logger::initialise( const std::string &id, const Options &options ) {
std::string tempLogFile; std::string tempLogFile;
if ( (envPtr = getTargettedEnv( "LOG_FILE" )) ) if ( (envPtr = getTargettedEnv("LOG_FILE")) )
tempLogFile = envPtr; tempLogFile = envPtr;
else if ( options.mLogFile.size() ) else if ( options.mLogFile.size() )
tempLogFile = options.mLogFile; tempLogFile = options.mLogFile;
@ -171,20 +171,20 @@ void Logger::initialise( const std::string &id, const Options &options ) {
if ( (envPtr = getenv( "LOG_PRINT" )) ) if ( (envPtr = getenv( "LOG_PRINT" )) )
tempTerminalLevel = atoi(envPtr) ? DEBUG9 : NOLOG; tempTerminalLevel = atoi(envPtr) ? DEBUG9 : NOLOG;
if ( (envPtr = getTargettedEnv( "LOG_LEVEL" )) ) if ( (envPtr = getTargettedEnv("LOG_LEVEL")) )
tempLevel = atoi(envPtr); tempLevel = atoi(envPtr);
if ( (envPtr = getTargettedEnv( "LOG_LEVEL_TERM" )) ) if ( (envPtr = getTargettedEnv("LOG_LEVEL_TERM")) )
tempTerminalLevel = atoi(envPtr); tempTerminalLevel = atoi(envPtr);
if ( (envPtr = getTargettedEnv( "LOG_LEVEL_DATABASE" )) ) if ( (envPtr = getTargettedEnv("LOG_LEVEL_DATABASE")) )
tempDatabaseLevel = atoi(envPtr); tempDatabaseLevel = atoi(envPtr);
if ( (envPtr = getTargettedEnv( "LOG_LEVEL_FILE" )) ) if ( (envPtr = getTargettedEnv("LOG_LEVEL_FILE")) )
tempFileLevel = atoi(envPtr); tempFileLevel = atoi(envPtr);
if ( (envPtr = getTargettedEnv( "LOG_LEVEL_SYSLOG" )) ) if ( (envPtr = getTargettedEnv("LOG_LEVEL_SYSLOG")) )
tempSyslogLevel = atoi(envPtr); tempSyslogLevel = atoi(envPtr);
if ( config.log_debug ) { if ( config.log_debug ) {
StringVector targets = split( config.log_debug_target, "|" ); StringVector targets = split(config.log_debug_target, "|");
for ( unsigned int i = 0; i < targets.size(); i++ ) { for ( unsigned int i = 0; i < targets.size(); i++ ) {
const std::string &target = targets[i]; const std::string &target = targets[i];
if ( target == mId || target == "_"+mId || target == "_"+mIdRoot || target == "" ) { if ( target == mId || target == "_"+mId || target == "_"+mIdRoot || target == "" ) {
@ -206,15 +206,14 @@ void Logger::initialise( const std::string &id, const Options &options ) {
if ( tempLevel > INFO ) tempLevel = INFO; if ( tempLevel > INFO ) tempLevel = INFO;
} // end if config.log_debug } // end if config.log_debug
logFile(tempLogFile);
logFile( tempLogFile ); terminalLevel(tempTerminalLevel);
databaseLevel(tempDatabaseLevel);
fileLevel(tempFileLevel);
syslogLevel(tempSyslogLevel);
terminalLevel( tempTerminalLevel ); level(tempLevel);
databaseLevel( tempDatabaseLevel );
fileLevel( tempFileLevel );
syslogLevel( tempSyslogLevel );
level( tempLevel );
mFlush = false; mFlush = false;
if ( (envPtr = getenv("LOG_FLUSH")) ) { if ( (envPtr = getenv("LOG_FLUSH")) ) {
@ -223,24 +222,24 @@ void Logger::initialise( const std::string &id, const Options &options ) {
mFlush = true; mFlush = true;
} }
//mRuntime = (envPtr = getenv( "LOG_RUNTIME")) ? atoi( envPtr ) : false;
{ {
struct sigaction action; struct sigaction action;
memset( &action, 0, sizeof(action) ); memset(&action, 0, sizeof(action));
action.sa_handler = usrHandler; action.sa_handler = usrHandler;
action.sa_flags = SA_RESTART; action.sa_flags = SA_RESTART;
if ( sigaction( SIGUSR1, &action, 0 ) < 0 ) { // Does this REALLY need to be fatal?
Fatal( "sigaction(), error = %s", strerror(errno) ); if ( sigaction(SIGUSR1, &action, 0) < 0 ) {
Fatal("sigaction(), error = %s", strerror(errno));
} }
if ( sigaction( SIGUSR2, &action, 0 ) < 0) { if ( sigaction(SIGUSR2, &action, 0) < 0) {
Fatal( "sigaction(), error = %s", strerror(errno) ); Fatal("sigaction(), error = %s", strerror(errno));
} }
} }
mInitialised = true; mInitialised = true;
Debug( 1, "LogOpts: level=%s/%s, screen=%s, database=%s, logfile=%s->%s, syslog=%s", Debug(1, "LogOpts: level=%s/%s, screen=%s, database=%s, logfile=%s->%s, syslog=%s",
smCodes[mLevel].c_str(), smCodes[mLevel].c_str(),
smCodes[mEffectiveLevel].c_str(), smCodes[mEffectiveLevel].c_str(),
smCodes[mTerminalLevel].c_str(), smCodes[mTerminalLevel].c_str(),
@ -252,7 +251,7 @@ void Logger::initialise( const std::string &id, const Options &options ) {
} }
void Logger::terminate() { void Logger::terminate() {
Debug(1, "Terminating Logger" ); Debug(1, "Terminating Logger");
if ( mFileLevel > NOLOG ) if ( mFileLevel > NOLOG )
closeFile(); closeFile();
@ -264,60 +263,61 @@ void Logger::terminate() {
closeDatabase(); closeDatabase();
} }
bool Logger::boolEnv( const std::string &name, bool defaultValue ) { // These don't belong here, they have nothing to do with logging
const char *envPtr = getenv( name.c_str() ); bool Logger::boolEnv(const std::string &name, bool defaultValue) {
return( envPtr ? atoi( envPtr ) : defaultValue ); const char *envPtr = getenv(name.c_str());
return envPtr ? atoi(envPtr) : defaultValue;
} }
int Logger::intEnv( const std::string &name, bool defaultValue ) { int Logger::intEnv(const std::string &name, bool defaultValue) {
const char *envPtr = getenv( name.c_str() ); const char *envPtr = getenv(name.c_str());
return( envPtr ? atoi( envPtr ) : defaultValue ); return envPtr ? atoi(envPtr) : defaultValue;
} }
std::string Logger::strEnv( const std::string &name, const std::string &defaultValue ) { std::string Logger::strEnv(const std::string &name, const std::string &defaultValue) {
const char *envPtr = getenv( name.c_str() ); const char *envPtr = getenv(name.c_str());
return( envPtr ? envPtr : defaultValue ); return envPtr ? envPtr : defaultValue;
} }
char *Logger::getTargettedEnv( const std::string &name ) { char *Logger::getTargettedEnv(const std::string &name) {
std::string envName; std::string envName;
envName = name+"_"+mId; envName = name+"_"+mId;
char *envPtr = getenv( envName.c_str() ); char *envPtr = getenv(envName.c_str());
if ( !envPtr && mId != mIdRoot ) { if ( !envPtr && mId != mIdRoot ) {
envName = name+"_"+mIdRoot; envName = name+"_"+mIdRoot;
envPtr = getenv( envName.c_str() ); envPtr = getenv(envName.c_str());
} }
if ( !envPtr ) if ( !envPtr )
envPtr = getenv( name.c_str() ); envPtr = getenv(name.c_str());
return( envPtr ); return envPtr;
} }
const std::string &Logger::id( const std::string &id ) { const std::string &Logger::id(const std::string &id) {
std::string tempId = id; std::string tempId = id;
size_t pos; size_t pos;
// Remove whitespace // Remove whitespace
while ( (pos = tempId.find_first_of( " \t" )) != std::string::npos ) { while ( (pos = tempId.find_first_of( " \t" )) != std::string::npos ) {
tempId.replace( pos, 1, "" ); tempId.replace(pos, 1, "");
} }
// Replace non-alphanum with underscore // Replace non-alphanum with underscore
while ( (pos = tempId.find_first_not_of( "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_" )) != std::string::npos ) { while ( (pos = tempId.find_first_not_of("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_")) != std::string::npos ) {
tempId.replace( pos, 1, "_" ); tempId.replace(pos, 1, "_");
} }
if ( mId != tempId ) { if ( mId != tempId ) {
mId = tempId; mId = tempId;
pos = mId.find( '_' ); pos = mId.find('_');
if ( pos != std::string::npos ) { if ( pos != std::string::npos ) {
mIdRoot = mId.substr( 0, pos ); mIdRoot = mId.substr(0, pos);
if ( ++pos < mId.size() ) if ( ++pos < mId.size() )
mIdArgs = mId.substr( pos ); mIdArgs = mId.substr(pos);
} }
} }
return( mId ); return( mId );
} }
Logger::Level Logger::level( Logger::Level level ) { Logger::Level Logger::level(Logger::Level level) {
if ( level > NOOPT ) { if ( level > NOOPT ) {
level = limit(level); level = limit(level);
if ( mLevel != level ) if ( mLevel != level )

View File

@ -173,7 +173,7 @@ int main( int argc, char *argv[] ) {
zm_reload = false; zm_reload = false;
} }
sigprocmask( SIG_UNBLOCK, &block_set, 0 ); sigprocmask( SIG_UNBLOCK, &block_set, 0 );
} } // end while ! zm_terminate
delete monitor; delete monitor;
} else { } else {
fprintf( stderr, "Can't find monitor with id of %d\n", id ); fprintf( stderr, "Can't find monitor with id of %d\n", id );

View File

@ -102,6 +102,9 @@ commonprep () {
git clone https://github.com/packpack/packpack.git packpack git clone https://github.com/packpack/packpack.git packpack
fi fi
# Rpm builds are broken in latest packpack master. Temporarily roll back.
git -C packpack checkout 7cf23ee
# Patch packpack # Patch packpack
patch --dry-run --silent -f -p1 < utils/packpack/packpack-rpm.patch patch --dry-run --silent -f -p1 < utils/packpack/packpack-rpm.patch
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then

View File

@ -4,32 +4,42 @@
* *
* Use it to configure database for ACL * Use it to configure database for ACL
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @package app.Config.Schema * @package app.Config.Schema
* @since CakePHP(tm) v 0.2.9 * @since CakePHP(tm) v 0.2.9
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
/* /**
*
* Using the Schema command line utility * Using the Schema command line utility
* cake schema run create DbAcl * cake schema run create DbAcl
*
*/ */
class DbAclSchema extends CakeSchema { class DbAclSchema extends CakeSchema {
/**
* Before event.
*
* @param array $event The event data.
* @return bool Success
*/
public function before($event = array()) { public function before($event = array()) {
return true; return true;
} }
/**
* After event.
*
* @param array $event The event data.
* @return void
*/
public function after($event = array()) { public function after($event = array()) {
} }
@ -44,7 +54,11 @@ class DbAclSchema extends CakeSchema {
'alias' => array('type' => 'string', 'null' => true), 'alias' => array('type' => 'string', 'null' => true),
'lft' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10), 'lft' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
'rght' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10), 'rght' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1)) 'indexes' => array(
'PRIMARY' => array('column' => 'id', 'unique' => 1),
'idx_acos_lft_rght' => array('column' => array('lft', 'rght'), 'unique' => 0),
'idx_acos_alias' => array('column' => 'alias', 'unique' => 0)
)
); );
/** /**
@ -58,7 +72,11 @@ class DbAclSchema extends CakeSchema {
'alias' => array('type' => 'string', 'null' => true), 'alias' => array('type' => 'string', 'null' => true),
'lft' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10), 'lft' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
'rght' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10), 'rght' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1)) 'indexes' => array(
'PRIMARY' => array('column' => 'id', 'unique' => 1),
'idx_aros_lft_rght' => array('column' => array('lft', 'rght'), 'unique' => 0),
'idx_aros_alias' => array('column' => 'alias', 'unique' => 0)
)
); );
/** /**
@ -73,7 +91,11 @@ class DbAclSchema extends CakeSchema {
'_read' => array('type' => 'string', 'null' => false, 'default' => '0', 'length' => 2), '_read' => array('type' => 'string', 'null' => false, 'default' => '0', 'length' => 2),
'_update' => array('type' => 'string', 'null' => false, 'default' => '0', 'length' => 2), '_update' => array('type' => 'string', 'null' => false, 'default' => '0', 'length' => 2),
'_delete' => array('type' => 'string', 'null' => false, 'default' => '0', 'length' => 2), '_delete' => array('type' => 'string', 'null' => false, 'default' => '0', 'length' => 2),
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1), 'ARO_ACO_KEY' => array('column' => array('aro_id', 'aco_id'), 'unique' => 1)) 'indexes' => array(
'PRIMARY' => array('column' => 'id', 'unique' => 1),
'ARO_ACO_KEY' => array('column' => array('aro_id', 'aco_id'), 'unique' => 1),
'idx_aco_id' => array('column' => 'aco_id', 'unique' => 0)
)
); );
} }

View File

@ -1,11 +1,11 @@
# $Id$ # $Id$
# #
# Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) # Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
# #
# Licensed under The MIT License # Licensed under The MIT License
# For full copyright and license information, please see the LICENSE.txt # For full copyright and license information, please see the LICENSE.txt
# Redistributions of files must retain the above copyright notice. # Redistributions of files must retain the above copyright notice.
# MIT License (http://www.opensource.org/licenses/mit-license.php) # MIT License (https://opensource.org/licenses/mit-license.php)
CREATE TABLE acos ( CREATE TABLE acos (
id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT, id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT,
@ -39,3 +39,14 @@ CREATE TABLE aros (
rght INTEGER(10) DEFAULT NULL, rght INTEGER(10) DEFAULT NULL,
PRIMARY KEY (id) PRIMARY KEY (id)
); );
/* this indexes will improve acl perfomance */
CREATE INDEX idx_acos_lft_rght ON `acos` (`lft`, `rght`);
CREATE INDEX idx_acos_alias ON `acos` (`alias`);
CREATE INDEX idx_aros_lft_rght ON `aros` (`lft`, `rght`);
CREATE INDEX idx_aros_alias ON `aros` (`alias`);
CREATE INDEX idx_aco_id ON `aros_acos` (`aco_id`);

View File

@ -4,22 +4,21 @@
* *
* Use it to configure database for i18n * Use it to configure database for i18n
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @package app.Config.Schema * @package app.Config.Schema
* @since CakePHP(tm) v 0.2.9 * @since CakePHP(tm) v 0.2.9
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
/** /**
*
* Using the Schema command line utility * Using the Schema command line utility
* *
* Use it to configure database for i18n * Use it to configure database for i18n
@ -28,15 +27,37 @@
*/ */
class I18nSchema extends CakeSchema { class I18nSchema extends CakeSchema {
/**
* The name property
*
* @var string
*/
public $name = 'i18n'; public $name = 'i18n';
/**
* Before callback.
*
* @param array $event Schema object properties
* @return bool Should process continue
*/
public function before($event = array()) { public function before($event = array()) {
return true; return true;
} }
/**
* After callback.
*
* @param array $event Schema object properties
* @return void
*/
public function after($event = array()) { public function after($event = array()) {
} }
/**
* The i18n table definition
*
* @var array
*/
public $i18n = array( public $i18n = array(
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'key' => 'primary'), 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'key' => 'primary'),
'locale' => array('type' => 'string', 'null' => false, 'length' => 6, 'key' => 'index'), 'locale' => array('type' => 'string', 'null' => false, 'length' => 6, 'key' => 'index'),

View File

@ -1,11 +1,11 @@
# $Id$ # $Id$
# #
# Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) # Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
# #
# Licensed under The MIT License # Licensed under The MIT License
# For full copyright and license information, please see the LICENSE.txt # For full copyright and license information, please see the LICENSE.txt
# Redistributions of files must retain the above copyright notice. # Redistributions of files must retain the above copyright notice.
# MIT License (http://www.opensource.org/licenses/mit-license.php) # MIT License (https://opensource.org/licenses/mit-license.php)
CREATE TABLE i18n ( CREATE TABLE i18n (
id int(10) NOT NULL auto_increment, id int(10) NOT NULL auto_increment,

View File

@ -1,13 +1,13 @@
# $Id$ # $Id$
# #
# Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) # Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
# 1785 E. Sahara Avenue, Suite 490-204 # 1785 E. Sahara Avenue, Suite 490-204
# Las Vegas, Nevada 89104 # Las Vegas, Nevada 89104
# #
# Licensed under The MIT License # Licensed under The MIT License
# For full copyright and license information, please see the LICENSE.txt # For full copyright and license information, please see the LICENSE.txt
# Redistributions of files must retain the above copyright notice. # Redistributions of files must retain the above copyright notice.
# MIT License (http://www.opensource.org/licenses/mit-license.php) # MIT License (https://opensource.org/licenses/mit-license.php)
CREATE TABLE cake_sessions ( CREATE TABLE cake_sessions (
id varchar(255) NOT NULL default '', id varchar(255) NOT NULL default '',

View File

@ -2,20 +2,20 @@
;/** ;/**
; * ACL Configuration ; * ACL Configuration
; * ; *
; * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) ; * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
; * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) ; * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
; * ; *
; * Licensed under The MIT License ; * Licensed under The MIT License
; * Redistributions of files must retain the above copyright notice. ; * Redistributions of files must retain the above copyright notice.
; * ; *
; * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) ; * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
; * @link http://cakephp.org CakePHP(tm) Project ; * @link https://cakephp.org CakePHP(tm) Project
; * @package app.Config ; * @package app.Config
; * @since CakePHP(tm) v 0.10.0.1076 ; * @since CakePHP(tm) v 0.10.0.1076
; * @license http://www.opensource.org/licenses/mit-license.php MIT License ; * @license https://opensource.org/licenses/mit-license.php MIT License
; */ ; */
; acl.ini.php - Cake ACL Configuration ; acl.ini.php - CakePHP ACL Configuration
; --------------------------------------------------------------------- ; ---------------------------------------------------------------------
; Use this file to specify user permissions. ; Use this file to specify user permissions.
; aco = access control object (something in your application) ; aco = access control object (something in your application)

View File

@ -4,18 +4,18 @@
* *
* Use it to configure access control of your CakePHP application. * Use it to configure access control of your CakePHP application.
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @package app.Config * @package app.Config
* @since CakePHP(tm) v 2.1 * @since CakePHP(tm) v 2.1
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
/** /**
@ -34,32 +34,41 @@
* will ask the configured ACL interface if access is granted. Under the assumptions 1. and 2. this will be * will ask the configured ACL interface if access is granted. Under the assumptions 1. and 2. this will be
* done via a call to Acl->check() with * done via a call to Acl->check() with
* *
* ```
* array('User' => array('username' => 'jeff', 'group_id' => 4, ...)) * array('User' => array('username' => 'jeff', 'group_id' => 4, ...))
* ```
* *
* as ARO and * as ARO and
* *
* ```
* '/controllers/invoices/delete' * '/controllers/invoices/delete'
* ```
* *
* as ACO. * as ACO.
* *
* If the configured map looks like * If the configured map looks like
* *
* ```
* $config['map'] = array( * $config['map'] = array(
* 'User' => 'User/username', * 'User' => 'User/username',
* 'Role' => 'User/group_id', * 'Role' => 'User/group_id',
* ); * );
* ```
* *
* then PhpAcl will lookup if we defined a role like User/jeff. If that role is not found, PhpAcl will try to * then PhpAcl will lookup if we defined a role like User/jeff. If that role is not found, PhpAcl will try to
* find a definition for Role/4. If the definition isn't found then a default role (Role/default) will be used to * find a definition for Role/4. If the definition isn't found then a default role (Role/default) will be used to
* check rules for the given ACO. The search can be expanded by defining aliases in the alias configuration. * check rules for the given ACO. The search can be expanded by defining aliases in the alias configuration.
* E.g. if you want to use a more readable name than Role/4 in your definitions you can define an alias like * E.g. if you want to use a more readable name than Role/4 in your definitions you can define an alias like
* *
* ```
* $config['alias'] = array( * $config['alias'] = array(
* 'Role/4' => 'Role/editor', * 'Role/4' => 'Role/editor',
* ); * );
* ```
* *
* In the roles configuration you can define roles on the lhs and inherited roles on the rhs: * In the roles configuration you can define roles on the lhs and inherited roles on the rhs:
* *
* ```
* $config['roles'] = array( * $config['roles'] = array(
* 'Role/admin' => null, * 'Role/admin' => null,
* 'Role/accountant' => null, * 'Role/accountant' => null,
@ -67,10 +76,12 @@
* 'Role/manager' => 'Role/editor, Role/accountant', * 'Role/manager' => 'Role/editor, Role/accountant',
* 'User/jeff' => 'Role/manager', * 'User/jeff' => 'Role/manager',
* ); * );
* ```
* *
* In this example manager inherits all rules from editor and accountant. Role/admin doesn't inherit from any role. * In this example manager inherits all rules from editor and accountant. Role/admin doesn't inherit from any role.
* Lets define some rules: * Lets define some rules:
* *
* ```
* $config['rules'] = array( * $config['rules'] = array(
* 'allow' => array( * 'allow' => array(
* '*' => 'Role/admin', * '*' => 'Role/admin',
@ -85,9 +96,10 @@
* 'controllers/articles/(delete|publish)' => 'Role/editor', * 'controllers/articles/(delete|publish)' => 'Role/editor',
* ), * ),
* ); * );
* ```
* *
* Ok, so as jeff inherits from Role/manager he's matched every rule that references User/jeff, Role/manager, * Ok, so as jeff inherits from Role/manager he's matched every rule that references User/jeff, Role/manager,
* Role/editor, Role/accountant and Role/default. However, for jeff, rules for User/jeff are more specific than * Role/editor, and Role/accountant. However, for jeff, rules for User/jeff are more specific than
* rules for Role/manager, rules for Role/manager are more specific than rules for Role/editor and so on. * rules for Role/manager, rules for Role/manager are more specific than rules for Role/editor and so on.
* This is important when allow and deny rules match for a role. E.g. Role/accountant is allowed * This is important when allow and deny rules match for a role. E.g. Role/accountant is allowed
* controllers/invoices/* but at the same time controllers/invoices/delete is denied. But there is a more * controllers/invoices/* but at the same time controllers/invoices/delete is denied. But there is a more

View File

@ -8,18 +8,18 @@
* You should also use this file to include any files that provide global functions/constants * You should also use this file to include any files that provide global functions/constants
* that your application uses. * that your application uses.
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @package app.Config * @package app.Config
* @since CakePHP(tm) v 0.10.8.2117 * @since CakePHP(tm) v 0.10.8.2117
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
// Setup a 'default' cache configuration for use in the application. // Setup a 'default' cache configuration for use in the application.

View File

@ -31,7 +31,7 @@
* In production mode, flash messages redirect after a time interval. * In production mode, flash messages redirect after a time interval.
* In development mode, you need to click the flash message to continue. * In development mode, you need to click the flash message to continue.
*/ */
Configure::write('debug', 0); Configure::write('debug', 2);
/** /**
* Configure the Error handler used to handle errors for your application. By default * Configure the Error handler used to handle errors for your application. By default

View File

@ -2,18 +2,18 @@
/** /**
* *
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @package app.Config * @package app.Config
* @since CakePHP(tm) v 0.2.9 * @since CakePHP(tm) v 0.2.9
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
/** /**

View File

@ -2,18 +2,18 @@
/** /**
* *
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link http://cakephp.org CakePHP(tm) Project
* @package app.Config * @package app.Config
* @since CakePHP(tm) v 2.0.0 * @since CakePHP(tm) v 2.0.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
/** /**

View File

@ -6,18 +6,18 @@
* Routes are very important mechanism that allows you to freely connect * Routes are very important mechanism that allows you to freely connect
* different URLs to chosen controllers and their actions (functions). * different URLs to chosen controllers and their actions (functions).
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @package app.Config * @package app.Config
* @since CakePHP(tm) v 0.2.9 * @since CakePHP(tm) v 0.2.9
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
/** /**

View File

@ -2,17 +2,17 @@
/** /**
* AppShell file * AppShell file
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @since CakePHP(tm) v 2.0 * @since CakePHP(tm) v 2.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
App::uses('Shell', 'Console'); App::uses('Shell', 'Console');

View File

@ -3,18 +3,18 @@
# #
# Bake is a shell script for running CakePHP bake script # Bake is a shell script for running CakePHP bake script
# #
# CakePHP(tm) : Rapid Development Framework (http://cakephp.org) # CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
# Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) # Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
# #
# Licensed under The MIT License # Licensed under The MIT License
# For full copyright and license information, please see the LICENSE.txt # For full copyright and license information, please see the LICENSE.txt
# Redistributions of files must retain the above copyright notice. # Redistributions of files must retain the above copyright notice.
# #
# @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) # @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
# @link http://cakephp.org CakePHP(tm) Project # @link https://cakephp.org CakePHP(tm) Project
# @package app.Console # @package app.Console
# @since CakePHP(tm) v 1.2.0.5012 # @since CakePHP(tm) v 1.2.0.5012
# @license http://www.opensource.org/licenses/mit-license.php MIT License # @license https://opensource.org/licenses/mit-license.php MIT License
# #
################################################################################ ################################################################################

View File

@ -2,17 +2,17 @@
:: ::
:: Bake is a shell script for running CakePHP bake script :: Bake is a shell script for running CakePHP bake script
:: ::
:: CakePHP(tm) : Rapid Development Framework (http://cakephp.org) :: CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
:: Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) :: Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
:: ::
:: Licensed under The MIT License :: Licensed under The MIT License
:: Redistributions of files must retain the above copyright notice. :: Redistributions of files must retain the above copyright notice.
:: ::
:: @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) :: @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
:: @link http://cakephp.org CakePHP(tm) Project :: @link https://cakephp.org CakePHP(tm) Project
:: @package app.Console :: @package app.Console
:: @since CakePHP(tm) v 2.0 :: @since CakePHP(tm) v 2.0
:: @license http://www.opensource.org/licenses/mit-license.php MIT License :: @license https://opensource.org/licenses/mit-license.php MIT License
:: ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

View File

@ -3,34 +3,45 @@
/** /**
* Command-line code generation utility to automate programmer chores. * Command-line code generation utility to automate programmer chores.
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @package app.Console * @package app.Console
* @since CakePHP(tm) v 2.0 * @since CakePHP(tm) v 2.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
$ds = DIRECTORY_SEPARATOR; if (!defined('DS')) {
$dispatcher = 'Cake' . $ds . 'Console' . $ds . 'ShellDispatcher.php'; define('DS', DIRECTORY_SEPARATOR);
}
$dispatcher = 'Cake' . DS . 'Console' . DS . 'ShellDispatcher.php';
if (function_exists('ini_set')) { if (function_exists('ini_set')) {
$root = dirname(dirname(dirname(__FILE__))); $root = dirname(dirname(dirname(__FILE__)));
$appDir = basename(dirname(dirname(__FILE__)));
$install = $root . DS . 'lib';
$composerInstall = $root . DS . $appDir . DS . 'Vendor' . DS . 'cakephp' . DS . 'cakephp' . DS . 'lib';
// the following line differs from its sibling // the following lines differ from its sibling
// /lib/Cake/Console/Templates/skel/Console/cake.php // /lib/Cake/Console/Templates/skel/Console/cake.php
ini_set('include_path', $root . $ds . 'lib' . PATH_SEPARATOR . ini_get('include_path')); if (file_exists($composerInstall . DS . $dispatcher)) {
$install = $composerInstall;
}
ini_set('include_path', $install . PATH_SEPARATOR . ini_get('include_path'));
unset($root, $appDir, $install, $composerInstall);
} }
if (!include $dispatcher) { if (!include $dispatcher) {
trigger_error('Could not locate CakePHP core files.', E_USER_ERROR); trigger_error('Could not locate CakePHP core files.', E_USER_ERROR);
} }
unset($paths, $path, $dispatcher, $root, $ds); unset($dispatcher);
return ShellDispatcher::run($argv); return ShellDispatcher::run($argv);

View File

@ -4,18 +4,18 @@
* *
* This file will render views from views/pages/ * This file will render views from views/pages/
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @package app.Controller * @package app.Controller
* @since CakePHP(tm) v 0.2.9 * @since CakePHP(tm) v 0.2.9
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
App::uses('AppController', 'Controller'); App::uses('AppController', 'Controller');
@ -26,7 +26,7 @@ App::uses('AppController', 'Controller');
* Override this controller by placing a copy in controllers directory of an application * Override this controller by placing a copy in controllers directory of an application
* *
* @package app.Controller * @package app.Controller
* @link http://book.cakephp.org/2.0/en/controllers/pages-controller.html * @link https://book.cakephp.org/2.0/en/controllers/pages-controller.html
*/ */
class PagesController extends AppController { class PagesController extends AppController {
@ -40,8 +40,8 @@ class PagesController extends AppController {
/** /**
* Displays a view * Displays a view
* *
* @param mixed What page to display * @return CakeResponse|null
* @return void * @throws ForbiddenException When a directory traversal attempt.
* @throws NotFoundException When the view file could not be found * @throws NotFoundException When the view file could not be found
* or MissingViewException in debug mode. * or MissingViewException in debug mode.
*/ */
@ -52,6 +52,9 @@ class PagesController extends AppController {
if (!$count) { if (!$count) {
return $this->redirect('/'); return $this->redirect('/');
} }
if (in_array('..', $path, true) || in_array('.', $path, true)) {
throw new ForbiddenException();
}
$page = $subpage = $title_for_layout = null; $page = $subpage = $title_for_layout = null;
if (!empty($path[0])) { if (!empty($path[0])) {

@ -1 +1 @@
Subproject commit c3976f1478c681b0bbc132ec3a3e82c3984eeed5 Subproject commit 1351dde6b4c75b215099ae8bcf5a21d6c6e10298

View File

@ -1,2 +1,2 @@
<?php echo $scripts_for_layout; ?> <?php echo $this->fetch('script'); ?>
<script type="text/javascript"><?php echo $this->fetch('content'); ?></script> <script type="text/javascript"><?php echo $this->fetch('content'); ?></script>

View File

@ -1,17 +1,17 @@
<?php <?php
/** /**
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @package Cake.Cache * @package Cake.Cache
* @since CakePHP(tm) v 1.2.0.4933 * @since CakePHP(tm) v 1.2.0.4933
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
App::uses('Inflector', 'Utility'); App::uses('Inflector', 'Utility');
@ -616,4 +616,18 @@ class Cache {
self::set(null, $config); self::set(null, $config);
return $success; return $success;
} }
/**
* Fetch the engine attached to a specific configuration name.
*
* @param string $config Optional string configuration name to get an engine for. Defaults to 'default'.
* @return null|CacheEngine Null if the engine has not been initialized or the engine.
*/
public static function engine($config = 'default') {
if (self::isInitialized($config)) {
return self::$_engines[$config];
}
return null;
}
} }

View File

@ -1,17 +1,17 @@
<?php <?php
/** /**
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @package Cake.Cache * @package Cake.Cache
* @since CakePHP(tm) v 1.2.0.4933 * @since CakePHP(tm) v 1.2.0.4933
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
/** /**
@ -181,7 +181,7 @@ abstract class CacheEngine {
$prefix = ''; $prefix = '';
if (!empty($this->_groupPrefix)) { if (!empty($this->_groupPrefix)) {
$prefix = vsprintf($this->_groupPrefix, $this->groups()); $prefix = md5(implode('_', $this->groups()));
} }
$key = preg_replace('/[\s]+/', '_', strtolower(trim(str_replace(array(DS, '/', '.'), '_', strval($key))))); $key = preg_replace('/[\s]+/', '_', strtolower(trim(str_replace(array(DS, '/', '.'), '_', strval($key)))));

View File

@ -2,18 +2,18 @@
/** /**
* APC storage engine for cache. * APC storage engine for cache.
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @package Cake.Cache.Engine * @package Cake.Cache.Engine
* @since CakePHP(tm) v 1.2.0.4933 * @since CakePHP(tm) v 1.2.0.4933
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
/** /**
@ -31,6 +31,13 @@ class ApcEngine extends CacheEngine {
*/ */
protected $_compiledGroupNames = array(); protected $_compiledGroupNames = array();
/**
* APC or APCu extension
*
* @var string
*/
protected $_apcExtension = 'apc';
/** /**
* Initialize the Cache Engine * Initialize the Cache Engine
* *
@ -47,6 +54,10 @@ class ApcEngine extends CacheEngine {
} }
$settings += array('engine' => 'Apc'); $settings += array('engine' => 'Apc');
parent::init($settings); parent::init($settings);
if (function_exists('apcu_dec')) {
$this->_apcExtension = 'apcu';
return true;
}
return function_exists('apc_dec'); return function_exists('apc_dec');
} }
@ -63,8 +74,9 @@ class ApcEngine extends CacheEngine {
if ($duration) { if ($duration) {
$expires = time() + $duration; $expires = time() + $duration;
} }
apc_store($key . '_expires', $expires, $duration); $func = $this->_apcExtension . '_store';
return apc_store($key, $value, $duration); $func($key . '_expires', $expires, $duration);
return $func($key, $value, $duration);
} }
/** /**
@ -75,11 +87,12 @@ class ApcEngine extends CacheEngine {
*/ */
public function read($key) { public function read($key) {
$time = time(); $time = time();
$cachetime = (int)apc_fetch($key . '_expires'); $func = $this->_apcExtension . '_fetch';
$cachetime = (int)$func($key . '_expires');
if ($cachetime !== 0 && ($cachetime < $time || ($time + $this->settings['duration']) < $cachetime)) { if ($cachetime !== 0 && ($cachetime < $time || ($time + $this->settings['duration']) < $cachetime)) {
return false; return false;
} }
return apc_fetch($key); return $func($key);
} }
/** /**
@ -90,7 +103,8 @@ class ApcEngine extends CacheEngine {
* @return New incremented value, false otherwise * @return New incremented value, false otherwise
*/ */
public function increment($key, $offset = 1) { public function increment($key, $offset = 1) {
return apc_inc($key, $offset); $func = $this->_apcExtension . '_inc';
return $func($key, $offset);
} }
/** /**
@ -101,7 +115,8 @@ class ApcEngine extends CacheEngine {
* @return New decremented value, false otherwise * @return New decremented value, false otherwise
*/ */
public function decrement($key, $offset = 1) { public function decrement($key, $offset = 1) {
return apc_dec($key, $offset); $func = $this->_apcExtension . '_dec';
return $func($key, $offset);
} }
/** /**
@ -111,7 +126,8 @@ class ApcEngine extends CacheEngine {
* @return bool True if the value was successfully deleted, false if it didn't exist or couldn't be removed * @return bool True if the value was successfully deleted, false if it didn't exist or couldn't be removed
*/ */
public function delete($key) { public function delete($key) {
return apc_delete($key); $func = $this->_apcExtension . '_delete';
return $func($key);
} }
/** /**
@ -125,19 +141,20 @@ class ApcEngine extends CacheEngine {
if ($check) { if ($check) {
return true; return true;
} }
$func = $this->_apcExtension . '_delete';
if (class_exists('APCIterator', false)) { if (class_exists('APCIterator', false)) {
$iterator = new APCIterator( $iterator = new APCIterator(
'user', 'user',
'/^' . preg_quote($this->settings['prefix'], '/') . '/', '/^' . preg_quote($this->settings['prefix'], '/') . '/',
APC_ITER_NONE APC_ITER_NONE
); );
apc_delete($iterator); $func($iterator);
return true; return true;
} }
$cache = apc_cache_info('user'); $cache = $this->_apcExtension === 'apc' ? apc_cache_info('user') : apcu_cache_info();
foreach ($cache['cache_list'] as $key) { foreach ($cache['cache_list'] as $key) {
if (strpos($key['info'], $this->settings['prefix']) === 0) { if (strpos($key['info'], $this->settings['prefix']) === 0) {
apc_delete($key['info']); $func($key['info']);
} }
} }
return true; return true;
@ -157,11 +174,13 @@ class ApcEngine extends CacheEngine {
} }
} }
$groups = apc_fetch($this->_compiledGroupNames); $fetchFunc = $this->_apcExtension . '_fetch';
$storeFunc = $this->_apcExtension . '_store';
$groups = $fetchFunc($this->_compiledGroupNames);
if (count($groups) !== count($this->settings['groups'])) { if (count($groups) !== count($this->settings['groups'])) {
foreach ($this->_compiledGroupNames as $group) { foreach ($this->_compiledGroupNames as $group) {
if (!isset($groups[$group])) { if (!isset($groups[$group])) {
apc_store($group, 1); $storeFunc($group, 1);
$groups[$group] = 1; $groups[$group] = 1;
} }
} }
@ -184,7 +203,8 @@ class ApcEngine extends CacheEngine {
* @return bool success * @return bool success
*/ */
public function clearGroup($group) { public function clearGroup($group) {
apc_inc($this->settings['prefix'] . $group, 1, $success); $func = $this->_apcExtension . '_inc';
$func($this->settings['prefix'] . $group, 1, $success);
return $success; return $success;
} }
@ -203,7 +223,8 @@ class ApcEngine extends CacheEngine {
if ($duration) { if ($duration) {
$expires = time() + $duration; $expires = time() + $duration;
} }
apc_add($key . '_expires', $expires, $duration); $func = $this->_apcExtension . '_add';
return apc_add($key, $value, $duration); $func($key . '_expires', $expires, $duration);
return $func($key, $value, $duration);
} }
} }

View File

@ -6,17 +6,17 @@
* *
* You can configure a FileEngine cache, using Cache::config() * You can configure a FileEngine cache, using Cache::config()
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @since CakePHP(tm) v 1.2.0.4933 * @since CakePHP(tm) v 1.2.0.4933
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
/** /**
@ -132,7 +132,7 @@ class FileEngine extends CacheEngine {
} }
$expires = time() + $duration; $expires = time() + $duration;
$contents = $expires . $lineBreak . $data . $lineBreak; $contents = implode(array($expires, $lineBreak, $data, $lineBreak));
if ($this->settings['lock']) { if ($this->settings['lock']) {
$this->_File->flock(LOCK_EX); $this->_File->flock(LOCK_EX);
@ -267,6 +267,10 @@ class FileEngine extends CacheEngine {
} }
$dir = dir($path); $dir = dir($path);
if ($dir === false) {
return;
}
while (($entry = $dir->read()) !== false) { while (($entry = $dir->read()) !== false) {
if (substr($entry, 0, $prefixLength) !== $this->settings['prefix']) { if (substr($entry, 0, $prefixLength) !== $this->settings['prefix']) {
continue; continue;

View File

@ -2,18 +2,18 @@
/** /**
* Memcache storage engine for cache * Memcache storage engine for cache
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @package Cake.Cache.Engine * @package Cake.Cache.Engine
* @since CakePHP(tm) v 1.2.0.4933 * @since CakePHP(tm) v 1.2.0.4933
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
/** /**

View File

@ -1,16 +1,16 @@
<?php <?php
/** /**
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @since CakePHP(tm) v 2.5.0 * @since CakePHP(tm) v 2.5.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
/** /**
@ -23,6 +23,8 @@
* (if memcached extension compiled with --enable-igbinary) * (if memcached extension compiled with --enable-igbinary)
* Compressed keys can also be incremented/decremented * Compressed keys can also be incremented/decremented
* *
* This cache engine requires at least ext/memcached version 2.0
*
* @package Cake.Cache.Engine * @package Cake.Cache.Engine
*/ */
class MemcachedEngine extends CacheEngine { class MemcachedEngine extends CacheEngine {

View File

@ -2,18 +2,18 @@
/** /**
* Redis storage engine for cache * Redis storage engine for cache
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @package Cake.Cache.Engine * @package Cake.Cache.Engine
* @since CakePHP(tm) v 2.2 * @since CakePHP(tm) v 2.2
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
/** /**
@ -133,11 +133,11 @@ class RedisEngine extends CacheEngine {
*/ */
public function read($key) { public function read($key) {
$value = $this->_Redis->get($key); $value = $this->_Redis->get($key);
if (ctype_digit($value)) { if (preg_match('/^[-]?\d+$/', $value)) {
$value = (int)$value; return (int)$value;
} }
if ($value !== false && is_string($value)) { if ($value !== false && is_string($value)) {
$value = unserialize($value); return unserialize($value);
} }
return $value; return $value;
} }

View File

@ -4,18 +4,18 @@
* *
* Supports wincache 1.1.0 and higher. * Supports wincache 1.1.0 and higher.
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @package Cake.Cache.Engine * @package Cake.Cache.Engine
* @since CakePHP(tm) v 1.2.0.4933 * @since CakePHP(tm) v 1.2.0.4933
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
/** /**

View File

@ -2,18 +2,18 @@
/** /**
* Xcache storage engine for cache. * Xcache storage engine for cache.
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @package Cake.Cache.Engine * @package Cake.Cache.Engine
* @since CakePHP(tm) v 1.2.0.4947 * @since CakePHP(tm) v 1.2.0.4947
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
/** /**

File diff suppressed because it is too large Load Diff

View File

@ -2,18 +2,18 @@
/** /**
* Core Configurations. * Core Configurations.
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @package Cake.Config * @package Cake.Config
* @since CakePHP(tm) v 1.1.11.4062 * @since CakePHP(tm) v 1.1.11.4062
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
$versionFile = file(CAKE . 'VERSION.txt'); $versionFile = file(CAKE . 'VERSION.txt');

View File

@ -1,17 +1,17 @@
<?php <?php
/** /**
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @package Cake.Config * @package Cake.Config
* @since CakePHP(tm) v 2.0 * @since CakePHP(tm) v 2.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
/** /**
@ -38,7 +38,7 @@
* - `/:controller' * - `/:controller'
* - `/:controller/:action/*' * - `/:controller/:action/*'
* *
* You can disable the connection of default routes by deleting the require inside APP/Config/routes.php. * You can disable the connection of default routes by deleting the require inside CONFIG/routes.php.
*/ */
$prefixes = Router::prefixes(); $prefixes = Router::prefixes();

View File

@ -8,18 +8,18 @@
* @see http://www.unicode.org/Public/UNIDATA/CaseFolding.txt * @see http://www.unicode.org/Public/UNIDATA/CaseFolding.txt
* @see http://www.unicode.org/reports/tr21/tr21-5.html * @see http://www.unicode.org/reports/tr21/tr21-5.html
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @package Cake.Config.unicode.casefolding * @package Cake.Config.unicode.casefolding
* @since CakePHP(tm) v 1.2.0.5691 * @since CakePHP(tm) v 1.2.0.5691
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
/** /**

View File

@ -8,18 +8,18 @@
* @see http://www.unicode.org/Public/UNIDATA/CaseFolding.txt * @see http://www.unicode.org/Public/UNIDATA/CaseFolding.txt
* @see http://www.unicode.org/reports/tr21/tr21-5.html * @see http://www.unicode.org/reports/tr21/tr21-5.html
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @package Cake.Config.unicode.casefolding * @package Cake.Config.unicode.casefolding
* @since CakePHP(tm) v 1.2.0.5691 * @since CakePHP(tm) v 1.2.0.5691
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
/** /**

View File

@ -8,18 +8,18 @@
* @see http://www.unicode.org/Public/UNIDATA/CaseFolding.txt * @see http://www.unicode.org/Public/UNIDATA/CaseFolding.txt
* @see http://www.unicode.org/reports/tr21/tr21-5.html * @see http://www.unicode.org/reports/tr21/tr21-5.html
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @package Cake.Config.unicode.casefolding * @package Cake.Config.unicode.casefolding
* @since CakePHP(tm) v 1.2.0.5691 * @since CakePHP(tm) v 1.2.0.5691
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
/** /**

View File

@ -8,18 +8,18 @@
* @see http://www.unicode.org/Public/UNIDATA/CaseFolding.txt * @see http://www.unicode.org/Public/UNIDATA/CaseFolding.txt
* @see http://www.unicode.org/reports/tr21/tr21-5.html * @see http://www.unicode.org/reports/tr21/tr21-5.html
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @package Cake.Config.unicode.casefolding * @package Cake.Config.unicode.casefolding
* @since CakePHP(tm) v 1.2.0.6833 * @since CakePHP(tm) v 1.2.0.6833
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
/** /**

View File

@ -8,18 +8,18 @@
* @see http://www.unicode.org/Public/UNIDATA/CaseFolding.txt * @see http://www.unicode.org/Public/UNIDATA/CaseFolding.txt
* @see http://www.unicode.org/reports/tr21/tr21-5.html * @see http://www.unicode.org/reports/tr21/tr21-5.html
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @package Cake.Config.unicode.casefolding * @package Cake.Config.unicode.casefolding
* @since CakePHP(tm) v 1.2.0.5691 * @since CakePHP(tm) v 1.2.0.5691
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
/** /**

View File

@ -8,18 +8,18 @@
* @see http://www.unicode.org/Public/UNIDATA/CaseFolding.txt * @see http://www.unicode.org/Public/UNIDATA/CaseFolding.txt
* @see http://www.unicode.org/reports/tr21/tr21-5.html * @see http://www.unicode.org/reports/tr21/tr21-5.html
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @package Cake.Config.unicode.casefolding * @package Cake.Config.unicode.casefolding
* @since CakePHP(tm) v 1.2.0.5691 * @since CakePHP(tm) v 1.2.0.5691
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
/** /**

View File

@ -8,18 +8,18 @@
* @see http://www.unicode.org/Public/UNIDATA/CaseFolding.txt * @see http://www.unicode.org/Public/UNIDATA/CaseFolding.txt
* @see http://www.unicode.org/reports/tr21/tr21-5.html * @see http://www.unicode.org/reports/tr21/tr21-5.html
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @package Cake.Config.unicode.casefolding * @package Cake.Config.unicode.casefolding
* @since CakePHP(tm) v 1.2.0.5691 * @since CakePHP(tm) v 1.2.0.5691
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
/** /**

View File

@ -8,18 +8,18 @@
* @see http://www.unicode.org/Public/UNIDATA/CaseFolding.txt * @see http://www.unicode.org/Public/UNIDATA/CaseFolding.txt
* @see http://www.unicode.org/reports/tr21/tr21-5.html * @see http://www.unicode.org/reports/tr21/tr21-5.html
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @package Cake.Config.unicode.casefolding * @package Cake.Config.unicode.casefolding
* @since CakePHP(tm) v 1.2.0.5691 * @since CakePHP(tm) v 1.2.0.5691
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
/** /**

View File

@ -8,18 +8,18 @@
* @see http://www.unicode.org/Public/UNIDATA/CaseFolding.txt * @see http://www.unicode.org/Public/UNIDATA/CaseFolding.txt
* @see http://www.unicode.org/reports/tr21/tr21-5.html * @see http://www.unicode.org/reports/tr21/tr21-5.html
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @package Cake.Config.unicode.casefolding * @package Cake.Config.unicode.casefolding
* @since CakePHP(tm) v 1.2.0.5691 * @since CakePHP(tm) v 1.2.0.5691
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
/** /**

View File

@ -8,18 +8,18 @@
* @see http://www.unicode.org/Public/UNIDATA/CaseFolding.txt * @see http://www.unicode.org/Public/UNIDATA/CaseFolding.txt
* @see http://www.unicode.org/reports/tr21/tr21-5.html * @see http://www.unicode.org/reports/tr21/tr21-5.html
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @package Cake.Config.unicode.casefolding * @package Cake.Config.unicode.casefolding
* @since CakePHP(tm) v 1.2.0.5691 * @since CakePHP(tm) v 1.2.0.5691
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
/** /**

View File

@ -8,18 +8,18 @@
* @see http://www.unicode.org/Public/UNIDATA/CaseFolding.txt * @see http://www.unicode.org/Public/UNIDATA/CaseFolding.txt
* @see http://www.unicode.org/reports/tr21/tr21-5.html * @see http://www.unicode.org/reports/tr21/tr21-5.html
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @package Cake.Config.unicode.casefolding * @package Cake.Config.unicode.casefolding
* @since CakePHP(tm) v 1.2.0.5691 * @since CakePHP(tm) v 1.2.0.5691
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
/** /**

View File

@ -8,18 +8,18 @@
* @see http://www.unicode.org/Public/UNIDATA/CaseFolding.txt * @see http://www.unicode.org/Public/UNIDATA/CaseFolding.txt
* @see http://www.unicode.org/reports/tr21/tr21-5.html * @see http://www.unicode.org/reports/tr21/tr21-5.html
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @package Cake.Config.unicode.casefolding * @package Cake.Config.unicode.casefolding
* @since CakePHP(tm) v 1.2.0.5691 * @since CakePHP(tm) v 1.2.0.5691
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
/** /**

View File

@ -8,18 +8,18 @@
* @see http://www.unicode.org/Public/UNIDATA/CaseFolding.txt * @see http://www.unicode.org/Public/UNIDATA/CaseFolding.txt
* @see http://www.unicode.org/reports/tr21/tr21-5.html * @see http://www.unicode.org/reports/tr21/tr21-5.html
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @package Cake.Config.unicode.casefolding * @package Cake.Config.unicode.casefolding
* @since CakePHP(tm) v 1.2.0.5691 * @since CakePHP(tm) v 1.2.0.5691
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
/** /**

View File

@ -8,18 +8,18 @@
* @see http://www.unicode.org/Public/UNIDATA/CaseFolding.txt * @see http://www.unicode.org/Public/UNIDATA/CaseFolding.txt
* @see http://www.unicode.org/reports/tr21/tr21-5.html * @see http://www.unicode.org/reports/tr21/tr21-5.html
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @package Cake.Config.unicode.casefolding * @package Cake.Config.unicode.casefolding
* @since CakePHP(tm) v 1.2.0.5691 * @since CakePHP(tm) v 1.2.0.5691
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
/** /**

View File

@ -8,18 +8,18 @@
* @see http://www.unicode.org/Public/UNIDATA/CaseFolding.txt * @see http://www.unicode.org/Public/UNIDATA/CaseFolding.txt
* @see http://www.unicode.org/reports/tr21/tr21-5.html * @see http://www.unicode.org/reports/tr21/tr21-5.html
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @package Cake.Config.unicode.casefolding * @package Cake.Config.unicode.casefolding
* @since CakePHP(tm) v 1.2.0.5691 * @since CakePHP(tm) v 1.2.0.5691
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
/** /**

View File

@ -8,18 +8,18 @@
* @see http://www.unicode.org/Public/UNIDATA/CaseFolding.txt * @see http://www.unicode.org/Public/UNIDATA/CaseFolding.txt
* @see http://www.unicode.org/reports/tr21/tr21-5.html * @see http://www.unicode.org/reports/tr21/tr21-5.html
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @package Cake.Config.unicode.casefolding * @package Cake.Config.unicode.casefolding
* @since CakePHP(tm) v 1.2.0.5691 * @since CakePHP(tm) v 1.2.0.5691
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
/** /**

View File

@ -8,18 +8,18 @@
* @see http://www.unicode.org/Public/UNIDATA/CaseFolding.txt * @see http://www.unicode.org/Public/UNIDATA/CaseFolding.txt
* @see http://www.unicode.org/reports/tr21/tr21-5.html * @see http://www.unicode.org/reports/tr21/tr21-5.html
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @package Cake.Config.unicode.casefolding * @package Cake.Config.unicode.casefolding
* @since CakePHP(tm) v 1.2.0.5691 * @since CakePHP(tm) v 1.2.0.5691
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
/** /**

View File

@ -1,17 +1,17 @@
<?php <?php
/** /**
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @package Cake.Core * @package Cake.Core
* @since CakePHP(tm) v 1.0.0.2363 * @since CakePHP(tm) v 1.0.0.2363
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
/** /**

View File

@ -2,18 +2,18 @@
/** /**
* IniReader * IniReader
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @package Cake.Configure * @package Cake.Configure
* @since CakePHP(tm) v 2.0 * @since CakePHP(tm) v 2.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
App::uses('Hash', 'Utility'); App::uses('Hash', 'Utility');
@ -73,13 +73,13 @@ class IniReader implements ConfigReaderInterface {
* Build and construct a new ini file parser. The parser can be used to read * Build and construct a new ini file parser. The parser can be used to read
* ini files that are on the filesystem. * ini files that are on the filesystem.
* *
* @param string $path Path to load ini config files from. Defaults to APP . 'Config' . DS * @param string $path Path to load ini config files from. Defaults to CONFIG
* @param string $section Only get one section, leave null to parse and fetch * @param string $section Only get one section, leave null to parse and fetch
* all sections in the ini file. * all sections in the ini file.
*/ */
public function __construct($path = null, $section = null) { public function __construct($path = null, $section = null) {
if (!$path) { if (!$path) {
$path = APP . 'Config' . DS; $path = CONFIG;
} }
$this->_path = $path; $this->_path = $path;
$this->_section = $section; $this->_section = $section;

View File

@ -2,17 +2,17 @@
/** /**
* PhpReader file * PhpReader file
* *
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice * Redistributions of files must retain the above copyright notice
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://book.cakephp.org/2.0/en/development/configuration.html#loading-configuration-files CakePHP(tm) Configuration * @link https://book.cakephp.org/2.0/en/development/configuration.html#loading-configuration-files CakePHP(tm) Configuration
* @package Cake.Configure * @package Cake.Configure
* @since CakePHP(tm) v 2.0 * @since CakePHP(tm) v 2.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
App::uses('CakePlugin', 'Core'); App::uses('CakePlugin', 'Core');
@ -38,11 +38,11 @@ class PhpReader implements ConfigReaderInterface {
/** /**
* Constructor for PHP Config file reading. * Constructor for PHP Config file reading.
* *
* @param string $path The path to read config files from. Defaults to APP . 'Config' . DS * @param string $path The path to read config files from. Defaults to CONFIG
*/ */
public function __construct($path = null) { public function __construct($path = null) {
if (!$path) { if (!$path) {
$path = APP . 'Config' . DS; $path = CONFIG;
} }
$this->_path = $path; $this->_path = $path;
} }

View File

@ -2,17 +2,17 @@
/** /**
* Acl Shell provides Acl access in the CLI environment * Acl Shell provides Acl access in the CLI environment
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @since CakePHP(tm) v 1.2.0.5012 * @since CakePHP(tm) v 1.2.0.5012
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
App::uses('AppShell', 'Console/Command'); App::uses('AppShell', 'Console/Command');
@ -89,7 +89,7 @@ class AclShell extends AppShell {
$this->args = null; $this->args = null;
return $this->DbConfig->execute(); return $this->DbConfig->execute();
} }
require_once APP . 'Config' . DS . 'database.php'; require_once CONFIG . 'database.php';
if (!in_array($this->command, array('initdb'))) { if (!in_array($this->command, array('initdb'))) {
$collection = new ComponentCollection(); $collection = new ComponentCollection();

View File

@ -4,17 +4,17 @@
* *
* Implementation of a Cake Shell to show CakePHP core method signatures. * Implementation of a Cake Shell to show CakePHP core method signatures.
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @since CakePHP(tm) v 1.2.0.5012 * @since CakePHP(tm) v 1.2.0.5012
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
App::uses('AppShell', 'Console/Command'); App::uses('AppShell', 'Console/Command');

View File

@ -2,17 +2,17 @@
/** /**
* AppShell file * AppShell file
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @since CakePHP(tm) v 2.0 * @since CakePHP(tm) v 2.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
App::uses('Shell', 'Console'); App::uses('Shell', 'Console');

View File

@ -6,17 +6,17 @@
* application development by writing fully functional skeleton controllers, * application development by writing fully functional skeleton controllers,
* models, and views. Going further, Bake can also write Unit Tests for you. * models, and views. Going further, Bake can also write Unit Tests for you.
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @since CakePHP(tm) v 1.2.0.5012 * @since CakePHP(tm) v 1.2.0.5012
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
App::uses('AppShell', 'Console/Command'); App::uses('AppShell', 'Console/Command');
@ -30,7 +30,7 @@ App::uses('Model', 'Model');
* models, and views. Going further, Bake can also write Unit Tests for you. * models, and views. Going further, Bake can also write Unit Tests for you.
* *
* @package Cake.Console.Command * @package Cake.Console.Command
* @link http://book.cakephp.org/2.0/en/console-and-shells/code-generation-with-bake.html * @link https://book.cakephp.org/2.0/en/console-and-shells/code-generation-with-bake.html
*/ */
class BakeShell extends AppShell { class BakeShell extends AppShell {

View File

@ -1,17 +1,17 @@
<?php <?php
/** /**
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP Project * @link https://cakephp.org CakePHP Project
* @package Cake.Console.Command * @package Cake.Console.Command
* @since CakePHP v 2.0 * @since CakePHP v 2.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
App::uses('AppShell', 'Console/Command'); App::uses('AppShell', 'Console/Command');
@ -54,6 +54,7 @@ class CommandListShell extends AppShell {
$this->out(" -working: " . rtrim(APP, DS)); $this->out(" -working: " . rtrim(APP, DS));
$this->out(" -root: " . rtrim(ROOT, DS)); $this->out(" -root: " . rtrim(ROOT, DS));
$this->out(" -core: " . rtrim(CORE_PATH, DS)); $this->out(" -core: " . rtrim(CORE_PATH, DS));
$this->out(" -webroot: " . rtrim(WWW_ROOT, DS));
$this->out(""); $this->out("");
$this->out(__d('cake_console', "<info>Changing Paths:</info>"), 2); $this->out(__d('cake_console', "<info>Changing Paths:</info>"), 2);
$this->out(__d('cake_console', "Your working path should be the same as your application path. To change your path use the '-app' param.")); $this->out(__d('cake_console', "Your working path should be the same as your application path. To change your path use the '-app' param."));

View File

@ -1,17 +1,17 @@
<?php <?php
/** /**
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP Project * @link https://cakephp.org CakePHP Project
* @package Cake.Console.Command * @package Cake.Console.Command
* @since CakePHP v 2.5 * @since CakePHP v 2.5
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
App::uses('AppShell', 'Console/Command'); App::uses('AppShell', 'Console/Command');

View File

@ -1,16 +1,16 @@
<?php <?php
/** /**
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @since CakePHP(tm) v 1.2.0.5012 * @since CakePHP(tm) v 1.2.0.5012
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
App::uses('AppShell', 'Console/Command'); App::uses('AppShell', 'Console/Command');
@ -501,7 +501,7 @@ class ConsoleShell extends AppShell {
extract(Router::getNamedExpressions()); extract(Router::getNamedExpressions());
//@codingStandardsIgnoreStart //@codingStandardsIgnoreStart
if (!@include APP . 'Config' . DS . 'routes.php') { if (!@include CONFIG . 'routes.php') {
//@codingStandardsIgnoreEnd //@codingStandardsIgnoreEnd
return false; return false;
} }

View File

@ -2,17 +2,17 @@
/** /**
* Internationalization Management Shell * Internationalization Management Shell
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @since CakePHP(tm) v 1.2.0.5669 * @since CakePHP(tm) v 1.2.0.5669
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
App::uses('AppShell', 'Console/Command'); App::uses('AppShell', 'Console/Command');

View File

@ -1,16 +1,16 @@
<?php <?php
/** /**
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @since CakePHP(tm) v 1.2.0.5550 * @since CakePHP(tm) v 1.2.0.5550
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
App::uses('AppShell', 'Console/Command'); App::uses('AppShell', 'Console/Command');
@ -25,7 +25,7 @@ App::uses('CakeSchema', 'Model');
* of your database. * of your database.
* *
* @package Cake.Console.Command * @package Cake.Console.Command
* @link http://book.cakephp.org/2.0/en/console-and-shells/schema-management-and-migrations.html * @link https://book.cakephp.org/2.0/en/console-and-shells/schema-management-and-migrations.html
*/ */
class SchemaShell extends AppShell { class SchemaShell extends AppShell {
@ -476,7 +476,7 @@ class SchemaShell extends AppShell {
); );
$path = array( $path = array(
'help' => __d('cake_console', 'Path to read and write schema.php'), 'help' => __d('cake_console', 'Path to read and write schema.php'),
'default' => APP . 'Config' . DS . 'Schema' 'default' => CONFIG . 'Schema'
); );
$file = array( $file = array(
'help' => __d('cake_console', 'File name to read and write.'), 'help' => __d('cake_console', 'File name to read and write.'),

View File

@ -2,17 +2,17 @@
/** /**
* built-in Server Shell * built-in Server Shell
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @since CakePHP(tm) v 2.3.0 * @since CakePHP(tm) v 2.3.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
App::uses('AppShell', 'Console/Command'); App::uses('AppShell', 'Console/Command');
@ -78,7 +78,7 @@ class ServerShell extends AppShell {
* or otherwise modify the pre-command flow. * or otherwise modify the pre-command flow.
* *
* @return void * @return void
* @link http://book.cakephp.org/2.0/en/console-and-shells.html#Shell::startup * @link https://book.cakephp.org/2.0/en/console-and-shells.html#Shell::startup
*/ */
public function startup() { public function startup() {
if (!empty($this->params['host'])) { if (!empty($this->params['host'])) {

View File

@ -2,17 +2,17 @@
/** /**
* Base class for Bake Tasks. * Base class for Bake Tasks.
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @since CakePHP(tm) v 1.3 * @since CakePHP(tm) v 1.3
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
App::uses('AppShell', 'Console/Command'); App::uses('AppShell', 'Console/Command');

View File

@ -1,16 +1,16 @@
<?php <?php
/** /**
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @since CakePHP(tm) v 2.5 * @since CakePHP(tm) v 2.5
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
App::uses('AppShell', 'Console/Command'); App::uses('AppShell', 'Console/Command');

View File

@ -2,17 +2,17 @@
/** /**
* The ControllerTask handles creating and updating controller files. * The ControllerTask handles creating and updating controller files.
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @since CakePHP(tm) v 1.2 * @since CakePHP(tm) v 1.2
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
App::uses('AppShell', 'Console/Command'); App::uses('AppShell', 'Console/Command');
@ -182,11 +182,11 @@ class ControllerTask extends BakeTask {
$components = $this->doComponents(); $components = $this->doComponents();
$wannaUseSession = $this->in( $wannaUseSession = $this->in(
__d('cake_console', "Would you like to use Session flash messages?"), array('y', 'n'), 'y' __d('cake_console', "Would you like to use the FlashComponent to display flash messages?"), array('y', 'n'), 'y'
); );
if (strtolower($wannaUseSession) === 'y') { if (strtolower($wannaUseSession) === 'y') {
array_push($components, 'Session'); array_push($components, 'Session', 'Flash');
} }
array_unique($components); array_unique($components);
} }
@ -331,6 +331,12 @@ class ControllerTask extends BakeTask {
public function bake($controllerName, $actions = '', $helpers = null, $components = null) { public function bake($controllerName, $actions = '', $helpers = null, $components = null) {
$this->out("\n" . __d('cake_console', 'Baking controller class for %s...', $controllerName), 1, Shell::QUIET); $this->out("\n" . __d('cake_console', 'Baking controller class for %s...', $controllerName), 1, Shell::QUIET);
if ($helpers === null) {
$helpers = array();
}
if ($components === null) {
$components = array();
}
$isScaffold = ($actions === 'scaffold') ? true : false; $isScaffold = ($actions === 'scaffold') ? true : false;
$this->Template->set(array( $this->Template->set(array(
@ -384,9 +390,9 @@ class ControllerTask extends BakeTask {
* @return array Components the user wants to use. * @return array Components the user wants to use.
*/ */
public function doComponents() { public function doComponents() {
$components = array('Paginator', 'Flash'); $components = array('Paginator');
return array_merge($components, $this->_doPropertyChoices( return array_merge($components, $this->_doPropertyChoices(
__d('cake_console', "Would you like this controller to use other components\nbesides PaginatorComponent and FlashComponent?"), __d('cake_console', "Would you like this controller to use other components\nbesides PaginatorComponent?"),
__d('cake_console', "Please provide a comma separated list of the component names you'd like to use.\nExample: 'Acl, Security, RequestHandler'") __d('cake_console', "Please provide a comma separated list of the component names you'd like to use.\nExample: 'Acl, Security, RequestHandler'")
)); ));
} }

View File

@ -2,17 +2,17 @@
/** /**
* The DbConfig Task handles creating and updating the database.php * The DbConfig Task handles creating and updating the database.php
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @since CakePHP(tm) v 1.2 * @since CakePHP(tm) v 1.2
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
App::uses('AppShell', 'Console/Command'); App::uses('AppShell', 'Console/Command');
@ -64,7 +64,7 @@ class DbConfigTask extends AppShell {
* @return void * @return void
*/ */
public function initialize() { public function initialize() {
$this->path = APP . 'Config' . DS; $this->path = CONFIG;
} }
/** /**

View File

@ -2,17 +2,17 @@
/** /**
* Language string extractor * Language string extractor
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @since CakePHP(tm) v 1.2.0.5012 * @since CakePHP(tm) v 1.2.0.5012
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
App::uses('AppShell', 'Console/Command'); App::uses('AppShell', 'Console/Command');

View File

@ -2,17 +2,17 @@
/** /**
* The FixtureTask handles creating and updating fixture files. * The FixtureTask handles creating and updating fixture files.
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @since CakePHP(tm) v 1.3 * @since CakePHP(tm) v 1.3
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
App::uses('AppShell', 'Console/Command'); App::uses('AppShell', 'Console/Command');
@ -125,7 +125,8 @@ class FixtureTask extends BakeTask {
return $this->all(); return $this->all();
} }
$model = $this->_modelName($this->args[0]); $model = $this->_modelName($this->args[0]);
$this->bake($model); $importOptions = $this->importOptions($model);
$this->bake($model, false, $importOptions);
} }
} }
@ -177,24 +178,29 @@ class FixtureTask extends BakeTask {
*/ */
public function importOptions($modelName) { public function importOptions($modelName) {
$options = array(); $options = array();
$plugin = '';
if (isset($this->params['plugin'])) {
$plugin = $this->params['plugin'] . '.';
}
if (!empty($this->params['schema'])) { if (!empty($this->params['schema'])) {
$options['schema'] = $modelName; $options['schema'] = $plugin . $modelName;
} else { } elseif ($this->interactive) {
$doSchema = $this->in(__d('cake_console', 'Would you like to import schema for this fixture?'), array('y', 'n'), 'n'); $doSchema = $this->in(__d('cake_console', 'Would you like to import schema for this fixture?'), array('y', 'n'), 'n');
if ($doSchema === 'y') { if ($doSchema === 'y') {
$options['schema'] = $modelName; $options['schema'] = $modelName;
} }
} }
if (!empty($this->params['records'])) { if (!empty($this->params['records'])) {
$doRecords = 'y'; $options['fromTable'] = true;
} else { } elseif ($this->interactive) {
$doRecords = $this->in(__d('cake_console', 'Would you like to use record importing for this fixture?'), array('y', 'n'), 'n'); $doRecords = $this->in(__d('cake_console', 'Would you like to use record importing for this fixture?'), array('y', 'n'), 'n');
}
if ($doRecords === 'y') { if ($doRecords === 'y') {
$options['records'] = true; $options['records'] = true;
} }
if ($doRecords === 'n') { }
if (!isset($options['records']) && $this->interactive) {
$prompt = __d('cake_console', "Would you like to build this fixture with data from %s's table?", $modelName); $prompt = __d('cake_console', "Would you like to build this fixture with data from %s's table?", $modelName);
$fromTable = $this->in($prompt, array('y', 'n'), 'n'); $fromTable = $this->in($prompt, array('y', 'n'), 'n');
if (strtolower($fromTable) === 'y') { if (strtolower($fromTable) === 'y') {
@ -329,6 +335,9 @@ class FixtureTask extends BakeTask {
} }
$insert = ''; $insert = '';
switch ($fieldInfo['type']) { switch ($fieldInfo['type']) {
case 'tinyinteger':
case 'smallinteger':
case 'biginteger':
case 'integer': case 'integer':
case 'float': case 'float':
$insert = $i + 1; $insert = $i + 1;

View File

@ -2,17 +2,17 @@
/** /**
* The ModelTask handles creating and updating models files. * The ModelTask handles creating and updating models files.
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @since CakePHP(tm) v 1.2 * @since CakePHP(tm) v 1.2
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
App::uses('AppShell', 'Console/Command'); App::uses('AppShell', 'Console/Command');
@ -450,6 +450,10 @@ class ModelTask extends BakeTask {
$guess = $methods['notBlank']; $guess = $methods['notBlank'];
} elseif ($metaData['type'] === 'integer') { } elseif ($metaData['type'] === 'integer') {
$guess = $methods['numeric']; $guess = $methods['numeric'];
} elseif ($metaData['type'] === 'smallinteger') {
$guess = $methods['numeric'];
} elseif ($metaData['type'] === 'tinyinteger') {
$guess = $methods['numeric'];
} elseif ($metaData['type'] === 'float') { } elseif ($metaData['type'] === 'float') {
$guess = $methods['numeric']; $guess = $methods['numeric'];
} elseif ($metaData['type'] === 'boolean') { } elseif ($metaData['type'] === 'boolean') {

View File

@ -1,16 +1,16 @@
<?php <?php
/** /**
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @since CakePHP(tm) v 1.2 * @since CakePHP(tm) v 1.2
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
App::uses('AppShell', 'Console/Command'); App::uses('AppShell', 'Console/Command');
@ -45,7 +45,7 @@ class PluginTask extends AppShell {
*/ */
public function initialize() { public function initialize() {
$this->path = current(App::path('plugins')); $this->path = current(App::path('plugins'));
$this->bootstrap = APP . 'Config' . DS . 'bootstrap.php'; $this->bootstrap = CONFIG . 'bootstrap.php';
} }
/** /**

View File

@ -2,17 +2,17 @@
/** /**
* The Project Task handles creating the base application * The Project Task handles creating the base application
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @since CakePHP(tm) v 1.2 * @since CakePHP(tm) v 1.2
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
App::uses('AppShell', 'Console/Command'); App::uses('AppShell', 'Console/Command');
@ -79,14 +79,14 @@ class ProjectTask extends AppShell {
if ($this->securitySalt($path) === true) { if ($this->securitySalt($path) === true) {
$this->out(__d('cake_console', ' * Random hash key created for \'Security.salt\'')); $this->out(__d('cake_console', ' * Random hash key created for \'Security.salt\''));
} else { } else {
$this->err(__d('cake_console', 'Unable to generate random hash for \'Security.salt\', you should change it in %s', APP . 'Config' . DS . 'core.php')); $this->err(__d('cake_console', 'Unable to generate random hash for \'Security.salt\', you should change it in %s', CONFIG . 'core.php'));
$success = false; $success = false;
} }
if ($this->securityCipherSeed($path) === true) { if ($this->securityCipherSeed($path) === true) {
$this->out(__d('cake_console', ' * Random seed created for \'Security.cipherSeed\'')); $this->out(__d('cake_console', ' * Random seed created for \'Security.cipherSeed\''));
} else { } else {
$this->err(__d('cake_console', 'Unable to generate random seed for \'Security.cipherSeed\', you should change it in %s', APP . 'Config' . DS . 'core.php')); $this->err(__d('cake_console', 'Unable to generate random seed for \'Security.cipherSeed\', you should change it in %s', CONFIG . 'core.php'));
$success = false; $success = false;
} }
@ -362,7 +362,7 @@ class ProjectTask extends AppShell {
* @return bool Success * @return bool Success
*/ */
public function cakeAdmin($name) { public function cakeAdmin($name) {
$path = (empty($this->configPath)) ? APP . 'Config' . DS : $this->configPath; $path = (empty($this->configPath)) ? CONFIG : $this->configPath;
$File = new File($path . 'core.php'); $File = new File($path . 'core.php');
$contents = $File->read(); $contents = $File->read();
if (preg_match('%(\s*[/]*Configure::write\(\'Routing.prefixes\',[\s\'a-z,\)\(]*\);)%', $contents, $match)) { if (preg_match('%(\s*[/]*Configure::write\(\'Routing.prefixes\',[\s\'a-z,\)\(]*\);)%', $contents, $match)) {

View File

@ -2,17 +2,17 @@
/** /**
* Template Task can generate templated output Used in other Tasks * Template Task can generate templated output Used in other Tasks
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @since CakePHP(tm) v 1.3 * @since CakePHP(tm) v 1.3
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
App::uses('AppShell', 'Console/Command'); App::uses('AppShell', 'Console/Command');

View File

@ -2,17 +2,17 @@
/** /**
* The TestTask handles creating and updating test files. * The TestTask handles creating and updating test files.
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @since CakePHP(tm) v 1.3 * @since CakePHP(tm) v 1.3
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
App::uses('AppShell', 'Console/Command'); App::uses('AppShell', 'Console/Command');
@ -367,7 +367,7 @@ class TestTask extends BakeTask {
* Generate the list of fixtures that will be required to run this test based on * Generate the list of fixtures that will be required to run this test based on
* loaded models. * loaded models.
* *
* @param object $subject The object you want to generate fixtures for. * @param CakeObject $subject The object you want to generate fixtures for.
* @return array Array of fixtures to be included in the test. * @return array Array of fixtures to be included in the test.
*/ */
public function generateFixtureList($subject) { public function generateFixtureList($subject) {

View File

@ -2,17 +2,17 @@
/** /**
* The View Tasks handles creating and updating view files. * The View Tasks handles creating and updating view files.
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @since CakePHP(tm) v 1.2 * @since CakePHP(tm) v 1.2
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
App::uses('AppShell', 'Console/Command'); App::uses('AppShell', 'Console/Command');

View File

@ -4,17 +4,17 @@
* *
* This Shell allows the running of test suites via the cake command line * This Shell allows the running of test suites via the cake command line
* *
* CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html> * CakePHP(tm) Tests <https://book.cakephp.org/2.0/en/development/testing.html>
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice * Redistributions of files must retain the above copyright notice
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://book.cakephp.org/2.0/en/development/testing.html * @link https://book.cakephp.org/2.0/en/development/testing.html
* @since CakePHP(tm) v 1.2.0.4433 * @since CakePHP(tm) v 1.2.0.4433
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
App::uses('Shell', 'Console'); App::uses('Shell', 'Console');
@ -71,6 +71,9 @@ class TestShell extends Shell {
))->addOption('coverage-clover', array( ))->addOption('coverage-clover', array(
'help' => __d('cake_console', '<file> Write code coverage data in Clover XML format.'), 'help' => __d('cake_console', '<file> Write code coverage data in Clover XML format.'),
'default' => false 'default' => false
))->addOption('coverage-text', array(
'help' => __d('cake_console', 'Output code coverage report in Text format.'),
'boolean' => true
))->addOption('testdox-html', array( ))->addOption('testdox-html', array(
'help' => __d('cake_console', '<file> Write agile documentation in HTML format to file.'), 'help' => __d('cake_console', '<file> Write agile documentation in HTML format to file.'),
'default' => false 'default' => false
@ -152,6 +155,7 @@ class TestShell extends Shell {
'default' => false 'default' => false
))->addOption('directive', array( ))->addOption('directive', array(
'help' => __d('cake_console', 'key[=value] Sets a php.ini value.'), 'help' => __d('cake_console', 'key[=value] Sets a php.ini value.'),
'short' => 'd',
'default' => false 'default' => false
))->addOption('fixture', array( ))->addOption('fixture', array(
'help' => __d('cake_console', 'Choose a custom fixture manager.') 'help' => __d('cake_console', 'Choose a custom fixture manager.')
@ -234,7 +238,11 @@ class TestShell extends Shell {
if ($value === false) { if ($value === false) {
continue; continue;
} }
if ($param === 'directive') {
$options[] = '-d';
} else {
$options[] = '--' . $param; $options[] = '--' . $param;
}
if (is_string($value)) { if (is_string($value)) {
$options[] = $value; $options[] = $value;
} }

View File

@ -4,17 +4,17 @@
* *
* This is a bc wrapper for the newer Test shell * This is a bc wrapper for the newer Test shell
* *
* CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html> * CakePHP(tm) Tests <https://book.cakephp.org/2.0/en/development/testing.html>
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice * Redistributions of files must retain the above copyright notice
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://book.cakephp.org/2.0/en/development/testing.html * @link https://book.cakephp.org/2.0/en/development/testing.html
* @since CakePHP(tm) v 1.2.0.4433 * @since CakePHP(tm) v 1.2.0.4433
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
App::uses('TestShell', 'Console/Command'); App::uses('TestShell', 'Console/Command');

View File

@ -2,18 +2,18 @@
/** /**
* Upgrade Shell * Upgrade Shell
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @package Cake.Console.Command * @package Cake.Console.Command
* @since CakePHP(tm) v 2.0 * @since CakePHP(tm) v 2.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
App::uses('AppShell', 'Console/Command'); App::uses('AppShell', 'Console/Command');
@ -532,7 +532,7 @@ class UpgradeShell extends AppShell {
/** /**
* Update components. * Update components.
* *
* - Make components that extend Object to extend Component. * - Make components that extend CakeObject to extend Component.
* *
* @return void * @return void
*/ */
@ -547,6 +547,11 @@ class UpgradeShell extends AppShell {
'/([a-zA-Z]*Component extends) Object/', '/([a-zA-Z]*Component extends) Object/',
'\1 Component' '\1 Component'
), ),
array(
'*Component extends CakeObject to *Component extends Component',
'/([a-zA-Z]*Component extends) CakeObject/',
'\1 Component'
),
); );
$this->_filesRegexpUpdate($patterns); $this->_filesRegexpUpdate($patterns);

View File

@ -2,17 +2,17 @@
/** /**
* ErrorHandler for Console Shells * ErrorHandler for Console Shells
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @since CakePHP(tm) v 2.0 * @since CakePHP(tm) v 2.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
App::uses('ErrorHandler', 'Error'); App::uses('ErrorHandler', 'Error');

View File

@ -2,18 +2,18 @@
/** /**
* ConsoleInput file. * ConsoleInput file.
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @package Cake.Console * @package Cake.Console
* @since CakePHP(tm) v 2.0 * @since CakePHP(tm) v 2.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
/** /**

View File

@ -2,17 +2,17 @@
/** /**
* ConsoleArgumentOption file * ConsoleArgumentOption file
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @since CakePHP(tm) v 2.0 * @since CakePHP(tm) v 2.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
/** /**
@ -159,7 +159,7 @@ class ConsoleInputArgument {
$option = $parent->addChild('argument'); $option = $parent->addChild('argument');
$option->addAttribute('name', $this->_name); $option->addAttribute('name', $this->_name);
$option->addAttribute('help', $this->_help); $option->addAttribute('help', $this->_help);
$option->addAttribute('required', $this->isRequired()); $option->addAttribute('required', (int)$this->isRequired());
$choices = $option->addChild('choices'); $choices = $option->addChild('choices');
foreach ($this->_choices as $valid) { foreach ($this->_choices as $valid) {
$choices->addChild('choice', $valid); $choices->addChild('choice', $valid);

View File

@ -2,17 +2,17 @@
/** /**
* ConsoleInputOption file * ConsoleInputOption file
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @since CakePHP(tm) v 2.0 * @since CakePHP(tm) v 2.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
/** /**
@ -205,10 +205,11 @@ class ConsoleInputOption {
$option->addAttribute('name', '--' . $this->_name); $option->addAttribute('name', '--' . $this->_name);
$short = ''; $short = '';
if (strlen($this->_short)) { if (strlen($this->_short)) {
$short = $this->_short; $short = '-' . $this->_short;
} }
$option->addAttribute('short', '-' . $short); $option->addAttribute('short', $short);
$option->addAttribute('boolean', $this->_boolean); $option->addAttribute('help', $this->_help);
$option->addAttribute('boolean', (int)$this->_boolean);
$option->addChild('default', $this->_default); $option->addChild('default', $this->_default);
$choices = $option->addChild('choices'); $choices = $option->addChild('choices');
foreach ($this->_choices as $valid) { foreach ($this->_choices as $valid) {

View File

@ -2,17 +2,17 @@
/** /**
* ConsoleInputSubcommand file * ConsoleInputSubcommand file
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @since CakePHP(tm) v 2.0 * @since CakePHP(tm) v 2.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
/** /**

View File

@ -2,17 +2,17 @@
/** /**
* ConsoleOptionParser file * ConsoleOptionParser file
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @since CakePHP(tm) v 2.0 * @since CakePHP(tm) v 2.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
App::uses('TaskCollection', 'Console'); App::uses('TaskCollection', 'Console');

View File

@ -2,17 +2,17 @@
/** /**
* ConsoleOutput file. * ConsoleOutput file.
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @since CakePHP(tm) v 2.0 * @since CakePHP(tm) v 2.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
/** /**

View File

@ -2,16 +2,16 @@
/** /**
* HelpFormatter * HelpFormatter
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
App::uses('CakeText', 'Utility'); App::uses('CakeText', 'Utility');
@ -182,7 +182,6 @@ class HelpFormatter {
$xml->addChild('command', $parser->command()); $xml->addChild('command', $parser->command());
$xml->addChild('description', $parser->description()); $xml->addChild('description', $parser->description());
$xml->addChild('epilog', $parser->epilog());
$subcommands = $xml->addChild('subcommands'); $subcommands = $xml->addChild('subcommands');
foreach ($parser->subcommands() as $command) { foreach ($parser->subcommands() as $command) {
$command->xml($subcommands); $command->xml($subcommands);
@ -195,6 +194,7 @@ class HelpFormatter {
foreach ($parser->arguments() as $argument) { foreach ($parser->arguments() as $argument) {
$argument->xml($arguments); $argument->xml($arguments);
} }
$xml->addChild('epilog', $parser->epilog());
return $string ? $xml->asXml() : $xml; return $string ? $xml->asXml() : $xml;
} }

View File

@ -1,16 +1,16 @@
<?php <?php
/** /**
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @since 2.8 * @since 2.8
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
abstract class BaseShellHelper { abstract class BaseShellHelper {

View File

@ -1,16 +1,16 @@
<?php <?php
/** /**
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @since 2.8 * @since 2.8
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
App::uses("BaseShellHelper", "Console/Helper"); App::uses("BaseShellHelper", "Console/Helper");

View File

@ -1,16 +1,16 @@
<?php <?php
/** /**
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @since 2.8 * @since 2.8
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
App::uses("BaseShellHelper", "Console/Helper"); App::uses("BaseShellHelper", "Console/Helper");

View File

@ -2,17 +2,17 @@
/** /**
* Base class for Shells * Base class for Shells
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @since CakePHP(tm) v 1.2.0.5012 * @since CakePHP(tm) v 1.2.0.5012
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
App::uses('TaskCollection', 'Console'); App::uses('TaskCollection', 'Console');
@ -28,7 +28,7 @@ App::uses('File', 'Utility');
* *
* @package Cake.Console * @package Cake.Console
*/ */
class Shell extends Object { class Shell extends CakeObject {
/** /**
* Default error code * Default error code
@ -112,7 +112,7 @@ class Shell extends Object {
* Contains tasks to load and instantiate * Contains tasks to load and instantiate
* *
* @var array * @var array
* @link http://book.cakephp.org/2.0/en/console-and-shells.html#Shell::$tasks * @link https://book.cakephp.org/2.0/en/console-and-shells.html#Shell::$tasks
*/ */
public $tasks = array(); public $tasks = array();
@ -127,7 +127,7 @@ class Shell extends Object {
* Contains models to load and instantiate * Contains models to load and instantiate
* *
* @var array * @var array
* @link http://book.cakephp.org/2.0/en/console-and-shells.html#Shell::$uses * @link https://book.cakephp.org/2.0/en/console-and-shells.html#Shell::$uses
*/ */
public $uses = array(); public $uses = array();
@ -194,7 +194,7 @@ class Shell extends Object {
* @param ConsoleOutput $stdout A ConsoleOutput object for stdout. * @param ConsoleOutput $stdout A ConsoleOutput object for stdout.
* @param ConsoleOutput $stderr A ConsoleOutput object for stderr. * @param ConsoleOutput $stderr A ConsoleOutput object for stderr.
* @param ConsoleInput $stdin A ConsoleInput object for stdin. * @param ConsoleInput $stdin A ConsoleInput object for stdin.
* @link http://book.cakephp.org/2.0/en/console-and-shells.html#Shell * @link https://book.cakephp.org/2.0/en/console-and-shells.html#Shell
*/ */
public function __construct($stdout = null, $stderr = null, $stdin = null) { public function __construct($stdout = null, $stderr = null, $stdin = null) {
if (!$this->name) { if (!$this->name) {
@ -222,7 +222,7 @@ class Shell extends Object {
* allows configuration of tasks prior to shell execution * allows configuration of tasks prior to shell execution
* *
* @return void * @return void
* @link http://book.cakephp.org/2.0/en/console-and-shells.html#Shell::initialize * @link https://book.cakephp.org/2.0/en/console-and-shells.html#Shell::initialize
*/ */
public function initialize() { public function initialize() {
$this->_loadModels(); $this->_loadModels();
@ -237,7 +237,7 @@ class Shell extends Object {
* or otherwise modify the pre-command flow. * or otherwise modify the pre-command flow.
* *
* @return void * @return void
* @link http://book.cakephp.org/2.0/en/console-and-shells.html#Shell::startup * @link https://book.cakephp.org/2.0/en/console-and-shells.html#Shell::startup
*/ */
public function startup() { public function startup() {
$this->_welcome(); $this->_welcome();
@ -340,7 +340,7 @@ class Shell extends Object {
* *
* @param string $task The task name to check. * @param string $task The task name to check.
* @return bool Success * @return bool Success
* @link http://book.cakephp.org/2.0/en/console-and-shells.html#Shell::hasTask * @link https://book.cakephp.org/2.0/en/console-and-shells.html#Shell::hasTask
*/ */
public function hasTask($task) { public function hasTask($task) {
return isset($this->_taskMap[Inflector::camelize($task)]); return isset($this->_taskMap[Inflector::camelize($task)]);
@ -351,7 +351,7 @@ class Shell extends Object {
* *
* @param string $name The method name to check. * @param string $name The method name to check.
* @return bool * @return bool
* @link http://book.cakephp.org/2.0/en/console-and-shells.html#Shell::hasMethod * @link https://book.cakephp.org/2.0/en/console-and-shells.html#Shell::hasMethod
*/ */
public function hasMethod($name) { public function hasMethod($name) {
try { try {
@ -369,7 +369,7 @@ class Shell extends Object {
} }
/** /**
* Dispatch a command to another Shell. Similar to Object::requestAction() * Dispatch a command to another Shell. Similar to CakeObject::requestAction()
* but intended for running shells from other shells. * but intended for running shells from other shells.
* *
* ### Usage: * ### Usage:
@ -387,7 +387,7 @@ class Shell extends Object {
* `return $this->dispatchShell('schema', 'create', 'i18n', '--dry');` * `return $this->dispatchShell('schema', 'create', 'i18n', '--dry');`
* *
* @return mixed The return of the other shell. * @return mixed The return of the other shell.
* @link http://book.cakephp.org/2.0/en/console-and-shells.html#Shell::dispatchShell * @link https://book.cakephp.org/2.0/en/console-and-shells.html#Shell::dispatchShell
*/ */
public function dispatchShell() { public function dispatchShell() {
$args = func_get_args(); $args = func_get_args();
@ -415,8 +415,8 @@ class Shell extends Object {
* @param string $command The command name to run on this shell. If this argument is empty, * @param string $command The command name to run on this shell. If this argument is empty,
* and the shell has a `main()` method, that will be called instead. * and the shell has a `main()` method, that will be called instead.
* @param array $argv Array of arguments to run the shell with. This array should be missing the shell name. * @param array $argv Array of arguments to run the shell with. This array should be missing the shell name.
* @return void * @return int|bool
* @link http://book.cakephp.org/2.0/en/console-and-shells.html#Shell::runCommand * @link https://book.cakephp.org/2.0/en/console-and-shells.html#Shell::runCommand
*/ */
public function runCommand($command, $argv) { public function runCommand($command, $argv) {
$isTask = $this->hasTask($command); $isTask = $this->hasTask($command);
@ -431,6 +431,7 @@ class Shell extends Object {
try { try {
list($this->params, $this->args) = $this->OptionParser->parse($argv, $command); list($this->params, $this->args) = $this->OptionParser->parse($argv, $command);
} catch (ConsoleException $e) { } catch (ConsoleException $e) {
$this->err(__d('cake_console', '<error>Error:</error> %s', $e->getMessage()));
$this->out($this->OptionParser->help($command)); $this->out($this->OptionParser->help($command));
return false; return false;
} }
@ -468,7 +469,7 @@ class Shell extends Object {
* Display the help in the correct format * Display the help in the correct format
* *
* @param string $command The command to get help for. * @param string $command The command to get help for.
* @return void * @return int|bool
*/ */
protected function _displayHelp($command) { protected function _displayHelp($command) {
$format = 'text'; $format = 'text';
@ -487,7 +488,7 @@ class Shell extends Object {
* By overriding this method you can configure the ConsoleOptionParser before returning it. * By overriding this method you can configure the ConsoleOptionParser before returning it.
* *
* @return ConsoleOptionParser * @return ConsoleOptionParser
* @link http://book.cakephp.org/2.0/en/console-and-shells.html#Shell::getOptionParser * @link https://book.cakephp.org/2.0/en/console-and-shells.html#Shell::getOptionParser
*/ */
public function getOptionParser() { public function getOptionParser() {
$name = ($this->plugin ? $this->plugin . '.' : '') . $this->name; $name = ($this->plugin ? $this->plugin . '.' : '') . $this->name;
@ -533,7 +534,7 @@ class Shell extends Object {
* @param string|array $options Array or string of options. * @param string|array $options Array or string of options.
* @param string $default Default input value. * @param string $default Default input value.
* @return mixed Either the default value, or the user-provided input. * @return mixed Either the default value, or the user-provided input.
* @link http://book.cakephp.org/2.0/en/console-and-shells.html#Shell::in * @link https://book.cakephp.org/2.0/en/console-and-shells.html#Shell::in
*/ */
public function in($prompt, $options = null, $default = null) { public function in($prompt, $options = null, $default = null) {
if (!$this->interactive) { if (!$this->interactive) {
@ -570,7 +571,7 @@ class Shell extends Object {
* @param string $prompt Prompt text. * @param string $prompt Prompt text.
* @param string|array $options Array or string of options. * @param string|array $options Array or string of options.
* @param string $default Default input value. * @param string $default Default input value.
* @return Either the default value, or the user-provided input. * @return string|int the default value, or the user-provided input.
*/ */
protected function _getInput($prompt, $options, $default) { protected function _getInput($prompt, $options, $default) {
if (!is_array($options)) { if (!is_array($options)) {
@ -612,7 +613,7 @@ class Shell extends Object {
* @param string|int|array $options Array of options to use, or an integer to wrap the text to. * @param string|int|array $options Array of options to use, or an integer to wrap the text to.
* @return string Wrapped / indented text * @return string Wrapped / indented text
* @see CakeText::wrap() * @see CakeText::wrap()
* @link http://book.cakephp.org/2.0/en/console-and-shells.html#Shell::wrapText * @link https://book.cakephp.org/2.0/en/console-and-shells.html#Shell::wrapText
*/ */
public function wrapText($text, $options = array()) { public function wrapText($text, $options = array()) {
return CakeText::wrap($text, $options); return CakeText::wrap($text, $options);
@ -633,7 +634,7 @@ class Shell extends Object {
* @param int $newlines Number of newlines to append * @param int $newlines Number of newlines to append
* @param int $level The message's output level, see above. * @param int $level The message's output level, see above.
* @return int|bool Returns the number of bytes returned from writing to stdout. * @return int|bool Returns the number of bytes returned from writing to stdout.
* @link http://book.cakephp.org/2.0/en/console-and-shells.html#Shell::out * @link https://book.cakephp.org/2.0/en/console-and-shells.html#Shell::out
*/ */
public function out($message = null, $newlines = 1, $level = Shell::NORMAL) { public function out($message = null, $newlines = 1, $level = Shell::NORMAL) {
$currentLevel = Shell::NORMAL; $currentLevel = Shell::NORMAL;
@ -688,7 +689,7 @@ class Shell extends Object {
* @param string|array $message A string or an array of strings to output * @param string|array $message A string or an array of strings to output
* @param int $newlines Number of newlines to append * @param int $newlines Number of newlines to append
* @return void * @return void
* @link http://book.cakephp.org/2.0/en/console-and-shells.html#Shell::err * @link https://book.cakephp.org/2.0/en/console-and-shells.html#Shell::err
*/ */
public function err($message = null, $newlines = 1) { public function err($message = null, $newlines = 1) {
$this->stderr->write($message, $newlines); $this->stderr->write($message, $newlines);
@ -699,7 +700,7 @@ class Shell extends Object {
* *
* @param int $multiplier Number of times the linefeed sequence should be repeated * @param int $multiplier Number of times the linefeed sequence should be repeated
* @return string * @return string
* @link http://book.cakephp.org/2.0/en/console-and-shells.html#Shell::nl * @link https://book.cakephp.org/2.0/en/console-and-shells.html#Shell::nl
*/ */
public function nl($multiplier = 1) { public function nl($multiplier = 1) {
return str_repeat(ConsoleOutput::LF, $multiplier); return str_repeat(ConsoleOutput::LF, $multiplier);
@ -711,7 +712,7 @@ class Shell extends Object {
* @param int $newlines Number of newlines to pre- and append * @param int $newlines Number of newlines to pre- and append
* @param int $width Width of the line, defaults to 63 * @param int $width Width of the line, defaults to 63
* @return void * @return void
* @link http://book.cakephp.org/2.0/en/console-and-shells.html#Shell::hr * @link https://book.cakephp.org/2.0/en/console-and-shells.html#Shell::hr
*/ */
public function hr($newlines = 0, $width = 63) { public function hr($newlines = 0, $width = 63) {
$this->out(null, $newlines); $this->out(null, $newlines);
@ -725,8 +726,8 @@ class Shell extends Object {
* *
* @param string $title Title of the error * @param string $title Title of the error
* @param string $message An optional error message * @param string $message An optional error message
* @return void * @return int
* @link http://book.cakephp.org/2.0/en/console-and-shells.html#Shell::error * @link https://book.cakephp.org/2.0/en/console-and-shells.html#Shell::error
*/ */
public function error($title, $message = null) { public function error($title, $message = null) {
$this->err(__d('cake_console', '<error>Error:</error> %s', $title)); $this->err(__d('cake_console', '<error>Error:</error> %s', $title));
@ -742,7 +743,7 @@ class Shell extends Object {
* Clear the console * Clear the console
* *
* @return void * @return void
* @link http://book.cakephp.org/2.0/en/console-and-shells.html#Shell::clear * @link https://book.cakephp.org/2.0/en/console-and-shells.html#Shell::clear
*/ */
public function clear() { public function clear() {
if (empty($this->params['noclear'])) { if (empty($this->params['noclear'])) {
@ -760,7 +761,7 @@ class Shell extends Object {
* @param string $path Where to put the file. * @param string $path Where to put the file.
* @param string $contents Content to put in the file. * @param string $contents Content to put in the file.
* @return bool Success * @return bool Success
* @link http://book.cakephp.org/2.0/en/console-and-shells.html#Shell::createFile * @link https://book.cakephp.org/2.0/en/console-and-shells.html#Shell::createFile
*/ */
public function createFile($path, $contents) { public function createFile($path, $contents) {
$path = str_replace(DS . DS, DS, $path); $path = str_replace(DS . DS, DS, $path);
@ -849,7 +850,7 @@ class Shell extends Object {
* *
* @param string $file Absolute file path * @param string $file Absolute file path
* @return string short path * @return string short path
* @link http://book.cakephp.org/2.0/en/console-and-shells.html#Shell::shortPath * @link https://book.cakephp.org/2.0/en/console-and-shells.html#Shell::shortPath
*/ */
public function shortPath($file) { public function shortPath($file) {
$shortPath = str_replace(ROOT, null, $file); $shortPath = str_replace(ROOT, null, $file);
@ -974,15 +975,48 @@ class Shell extends Object {
CakeLog::drop('stderr'); CakeLog::drop('stderr');
return; return;
} }
if (!$this->_loggerIsConfigured("stdout")) {
$this->_configureStdOutLogger();
}
if (!$this->_loggerIsConfigured("stderr")) {
$this->_configureStdErrLogger();
}
}
/**
* Configure the stdout logger
*
* @return void
*/
protected function _configureStdOutLogger() {
CakeLog::config('stdout', array( CakeLog::config('stdout', array(
'engine' => 'Console', 'engine' => 'Console',
'types' => array('notice', 'info'), 'types' => array('notice', 'info'),
'stream' => $this->stdout, 'stream' => $this->stdout,
)); ));
}
/**
* Configure the stderr logger
*
* @return void
*/
protected function _configureStdErrLogger() {
CakeLog::config('stderr', array( CakeLog::config('stderr', array(
'engine' => 'Console', 'engine' => 'Console',
'types' => array('emergency', 'alert', 'critical', 'error', 'warning', 'debug'), 'types' => array('emergency', 'alert', 'critical', 'error', 'warning', 'debug'),
'stream' => $this->stderr, 'stream' => $this->stderr,
)); ));
} }
/**
* Checks if the given logger is configured
*
* @param string $logger The name of the logger to check
* @return bool
*/
protected function _loggerIsConfigured($logger) {
$configured = CakeLog::configured();
return in_array($logger, $configured);
}
} }

View File

@ -2,17 +2,17 @@
/** /**
* ShellDispatcher file * ShellDispatcher file
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @since CakePHP(tm) v 2.0 * @since CakePHP(tm) v 2.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
/** /**
@ -106,7 +106,7 @@ class ShellDispatcher {
$message = "This file has been loaded incorrectly and cannot continue.\n" . $message = "This file has been loaded incorrectly and cannot continue.\n" .
"Please make sure that " . DS . 'lib' . DS . 'Cake' . DS . "Console is in your system path,\n" . "Please make sure that " . DS . 'lib' . DS . 'Cake' . DS . "Console is in your system path,\n" .
"and check the cookbook for the correct usage of this command.\n" . "and check the cookbook for the correct usage of this command.\n" .
"(http://book.cakephp.org/)"; "(https://book.cakephp.org/)";
throw new CakeException($message); throw new CakeException($message);
} }
@ -129,15 +129,22 @@ class ShellDispatcher {
define('APP', $this->params['working'] . DS); define('APP', $this->params['working'] . DS);
} }
if (!defined('WWW_ROOT')) { if (!defined('WWW_ROOT')) {
define('WWW_ROOT', APP . $this->params['webroot'] . DS); if (!$this->_isAbsolutePath($this->params['webroot'])) {
$webroot = realpath(APP . $this->params['webroot']);
} else {
$webroot = $this->params['webroot'];
}
define('WWW_ROOT', $webroot . DS);
} }
if (!defined('TMP') && !is_dir(APP . 'tmp')) { if (!defined('TMP') && !is_dir(APP . 'tmp')) {
define('TMP', CAKE_CORE_INCLUDE_PATH . DS . 'Cake' . DS . 'Console' . DS . 'Templates' . DS . 'skel' . DS . 'tmp' . DS); define('TMP', CAKE_CORE_INCLUDE_PATH . DS . 'Cake' . DS . 'Console' . DS . 'Templates' . DS . 'skel' . DS . 'tmp' . DS);
} }
// $boot is used by Cake/bootstrap.php file
$boot = file_exists(ROOT . DS . APP_DIR . DS . 'Config' . DS . 'bootstrap.php'); $boot = file_exists(ROOT . DS . APP_DIR . DS . 'Config' . DS . 'bootstrap.php');
require CORE_PATH . 'Cake' . DS . 'bootstrap.php'; require CORE_PATH . 'Cake' . DS . 'bootstrap.php';
if (!file_exists(APP . 'Config' . DS . 'core.php')) { if (!file_exists(CONFIG . 'core.php')) {
include_once CAKE_CORE_INCLUDE_PATH . DS . 'Cake' . DS . 'Console' . DS . 'Templates' . DS . 'skel' . DS . 'Config' . DS . 'core.php'; include_once CAKE_CORE_INCLUDE_PATH . DS . 'Cake' . DS . 'Console' . DS . 'Templates' . DS . 'skel' . DS . 'Config' . DS . 'core.php';
App::build(); App::build();
} }
@ -305,25 +312,45 @@ class ShellDispatcher {
} }
} }
if ($params['app'][0] === '/' || preg_match('/([a-z])(:)/i', $params['app'], $matches)) { if ($this->_isAbsolutePath($params['app'])) {
$params['root'] = dirname($params['app']); $params['root'] = dirname($params['app']);
} elseif (strpos($params['app'], '/')) { } elseif (strpos($params['app'], '/')) {
$params['root'] .= '/' . dirname($params['app']); $params['root'] .= '/' . dirname($params['app']);
} }
$isWindowsAppPath = $this->_isWindowsPath($params['app']);
$params['app'] = basename($params['app']); $params['app'] = basename($params['app']);
$params['working'] = rtrim($params['root'], '/'); $params['working'] = rtrim($params['root'], '/');
if (!$isWin || !preg_match('/^[A-Z]:$/i', $params['app'])) { if (!$isWin || !preg_match('/^[A-Z]:$/i', $params['app'])) {
$params['working'] .= '/' . $params['app']; $params['working'] .= '/' . $params['app'];
} }
if (!empty($matches[0]) || !empty($isWin)) { if ($isWindowsAppPath || !empty($isWin)) {
$params = str_replace('/', '\\', $params); $params = str_replace('/', '\\', $params);
} }
$this->params = $params + $this->params; $this->params = $params + $this->params;
} }
/**
* Checks whether the given path is absolute or relative.
*
* @param string $path absolute or relative path.
* @return bool
*/
protected function _isAbsolutePath($path) {
return $path[0] === '/' || $this->_isWindowsPath($path);
}
/**
* Checks whether the given path is Window OS path.
*
* @param string $path absolute path.
* @return bool
*/
protected function _isWindowsPath($path) {
return preg_match('/([a-z])(:)/i', $path) == 1;
}
/** /**
* Parses out the paths from from the argv * Parses out the paths from from the argv
* *
@ -332,7 +359,7 @@ class ShellDispatcher {
*/ */
protected function _parsePaths($args) { protected function _parsePaths($args) {
$parsed = array(); $parsed = array();
$keys = array('-working', '--working', '-app', '--app', '-root', '--root'); $keys = array('-working', '--working', '-app', '--app', '-root', '--root', '-webroot', '--webroot');
$args = (array)$args; $args = (array)$args;
foreach ($keys as $key) { foreach ($keys as $key) {
while (($index = array_search($key, $args)) !== false) { while (($index = array_search($key, $args)) !== false) {

View File

@ -3,17 +3,17 @@
* Task collection is used as a registry for loaded tasks and handles loading * Task collection is used as a registry for loaded tasks and handles loading
* and constructing task class objects. * and constructing task class objects.
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @since CakePHP(tm) v 2.0 * @since CakePHP(tm) v 2.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
App::uses('ObjectCollection', 'Utility'); App::uses('ObjectCollection', 'Utility');
@ -64,7 +64,7 @@ class TaskCollection extends ObjectCollection {
* *
* @param string $task Task name to load * @param string $task Task name to load
* @param array $settings Settings for the task. * @param array $settings Settings for the task.
* @return Task A task object, Either the existing loaded task or a new one. * @return AppShell A task object, Either the existing loaded task or a new one.
* @throws MissingTaskException when the task could not be found * @throws MissingTaskException when the task could not be found
*/ */
public function load($task, $settings = array()) { public function load($task, $settings = array()) {

View File

@ -2,18 +2,18 @@
/** /**
* Bake Template for Controller action generation. * Bake Template for Controller action generation.
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @package Cake.Console.Templates.default.actions * @package Cake.Console.Templates.default.actions
* @since CakePHP(tm) v 1.3 * @since CakePHP(tm) v 1.3
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
?> ?>

View File

@ -4,18 +4,18 @@
* *
* Allows templating of Controllers generated from bake. * Allows templating of Controllers generated from bake.
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @package Cake.Console.Templates.default.classes * @package Cake.Console.Templates.default.classes
* @since CakePHP(tm) v 1.3 * @since CakePHP(tm) v 1.3
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
echo "<?php\n"; echo "<?php\n";

View File

@ -4,18 +4,18 @@
* *
* Fixture Template used when baking fixtures with bake * Fixture Template used when baking fixtures with bake
* *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt * For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project * @link https://cakephp.org CakePHP(tm) Project
* @package Cake.Console.Templates.default.classes * @package Cake.Console.Templates.default.classes
* @since CakePHP(tm) v 1.3 * @since CakePHP(tm) v 1.3
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
echo "<?php\n"; echo "<?php\n";

Some files were not shown because too many files have changed in this diff Show More