Skip to content

Commit

Permalink
Merge pull request #670 from phalcon/2.0.x
Browse files Browse the repository at this point in the history
2.0.12
  • Loading branch information
sergeyklay committed May 17, 2016
2 parents 30b0933 + d991ea1 commit 031dbcf
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 12 deletions.
8 changes: 5 additions & 3 deletions ide/stubs/Phalcon/Crypt.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,22 +105,24 @@ public function getKey() {}
/**
* Pads texts before encryption
*
* @see http://www.di-mgt.com.au/cryptopad.html
* @link http://www.di-mgt.com.au/cryptopad.html
* @param string $text
* @param string $mode
* @param int $blockSize
* @param int $paddingType
* @return string
*/
protected function _cryptPadText($text, $mode, $blockSize, $paddingType) {}

/**
* Removes padding @a padding_type from @a text
* If the function detects that the text was not padded, it will return it unmodified
* Removes $paddingType padding from text
* If the method detects that the text was not padded, it will return it unmodified
*
* @param string $text Message to be unpadded
* @param string $mode Encryption mode; unpadding is applied only in CBC or ECB mode
* @param int $blockSize Cipher block size
* @param int $paddingType Padding scheme
* @return string
*/
protected function _cryptUnpadText($text, $mode, $blockSize, $paddingType) {}

Expand Down
2 changes: 1 addition & 1 deletion ide/stubs/Phalcon/Flash.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function notice($message) {}
* $flash->success('The process was finished successfully');
* </code>
*
* @param string $message
* @param mixed $message
* @return string
*/
public function success($message) {}
Expand Down
4 changes: 2 additions & 2 deletions ide/stubs/Phalcon/mvc/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ public function assign($data, $dataColumnMap = null, $whiteList = null) {}
* ));
* </code>
*
* @param \Phalcon\Mvc\ModelInterface|Phalcon\Mvc\Model\Row $base
* @param \Phalcon\Mvc\ModelInterface|\Phalcon\Mvc\Model\Row $base
* @param array $data
* @param array $columnMap
* @param int $dirtyState
Expand Down Expand Up @@ -605,7 +605,7 @@ public function validationHasFailed() {}
* </code>
*
* @param mixed $filter
* @return MessageInterface[]
* @return \Phalcon\Mvc\Model\Message\MessageInterface[]
*/
public function getMessages($filter = null) {}

Expand Down
3 changes: 2 additions & 1 deletion ide/stubs/Phalcon/mvc/view/engine/Volt.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ public function sort($value) {}
*
* @param string $name
* @param array $arguments
* @return mixed
*/
public function callMacro($name, $arguments) {}
public function callMacro($name, $arguments = array()) {}

}
39 changes: 35 additions & 4 deletions scripts/Phalcon/Builder/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

namespace Phalcon\Builder;

use SplFileInfo;

/**
* Module Builder
*
Expand Down Expand Up @@ -88,7 +90,7 @@ public function build()
$modulesDir = $this->path->getRootPath($modulesDir);
}

$this->options->offsetSet('modulesDir', realpath($modulesDir));
$this->options->offsetSet('modulesDir', $modulesDir);
$this->options->offsetSet('templatePath', realpath($templatePath));
$this->options->offsetSet('projectPath', $this->path->getRootPath());

Expand Down Expand Up @@ -122,10 +124,39 @@ public function buildDirectories()
));
}

mkdir($modulesDir . DIRECTORY_SEPARATOR . $moduleName, 0777, true);
$modulesPath = new SplFileInfo($modulesDir);
$modulePath = $modulesDir. DIRECTORY_SEPARATOR . $moduleName;

try {
if ($modulesPath->isFile() && !$modulesPath->isDir()) {
throw new BuilderException(
sprintf(
"Builder expects a directory for 'modulesDir'. But %s is a file.",
$modulesPath->getPathname()
)
);
} elseif ($modulesPath->isReadable() && !mkdir($modulePath, 0777, true)) {
throw new BuilderException("Unable to create module directory. Check permissions.");
}

foreach ($this->moduleDirectories as $dir) {
$path = $modulePath . DIRECTORY_SEPARATOR . $dir;
if (!mkdir($path, 0777, true)) {
throw new BuilderException(
sprintf(
"Unable to create %s directory. Check permissions.",
$path
)
);
}
}

foreach ($this->moduleDirectories as $dir) {
mkdir($modulesDir . DIRECTORY_SEPARATOR . $moduleName . DIRECTORY_SEPARATOR . $dir, 0777, true);
} catch (\Exception $e) {
throw new BuilderException(
$e->getMessage(),
$e->getCode(),
($e instanceof BuilderException ? null : $e)
);
}

return $this;
Expand Down
27 changes: 26 additions & 1 deletion scripts/Phalcon/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ class Utils
{
const DB_ADAPTER_POSTGRESQL = 'Postgresql';

const DB_ADAPTER_SQLITE = 'Sqlite';

/**
* Converts the underscore_notation to the UpperCamelCase
*
* @param string $string
* @return string
*/
public static function camelize($string)
{
$stringParts = explode('_', $string);
Expand All @@ -35,6 +43,17 @@ public static function camelize($string)
return implode('', $stringParts);
}

/**
* Converts the underscore_notation to the lowerCamelCase
*
* @param string $string
* @return string
*/
public static function lowerCamelize($string)
{
return lcfirst(self::camelize($string));
}

/**
* Resolves the DB Schema
*
Expand All @@ -48,7 +67,13 @@ public static function resolveDbSchema(Config $config)
}

if (self::DB_ADAPTER_POSTGRESQL == $config->get('adapter')) {
return 'public';
return 'public';
}

if (self::DB_ADAPTER_SQLITE == $config->get('adapter')) {
// SQLite only supports the current database, unless one is
// attached. This is not the case, so don't return a schema.
return null;
}

if ($config->offsetExists('dbname')) {
Expand Down

0 comments on commit 031dbcf

Please sign in to comment.