Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dp-ifacesoft committed Mar 17, 2015
1 parent 82ee484 commit 64a7bb3
Show file tree
Hide file tree
Showing 14 changed files with 116 additions and 523 deletions.
56 changes: 56 additions & 0 deletions Resource/Ice/Core/Data/Scheme.res.php
Original file line number Diff line number Diff line change
Expand Up @@ -428,4 +428,60 @@
'en' => 'Removing models from data source {$0}',
'ru' => 'Удаление моделей из источника данных {$0}',
],
'Update scheme for model {$0}: {$1}' => [
'en' => 'Update scheme for model {$0}: {$1}',
'be' => 'Абнаўленне схемы для мадэлі {$0}: {$1}',
'ca' => 'Actualització de l\'esquema de model {$0}: {$1}',
'cs' => 'Aktualizace systému pro model {$0}: {$1}',
'da' => 'Opdatering ordning for model {$0}: {$1}',
'de' => 'Update-System für Modell {$0}: {$1}',
'el' => 'Ενημερωμένη έκδοση καθεστώς για το πρότυπο {$0}: {$1}',
'es' => 'Actualización de esquema para el modelo {$0}: {$1}',
'et' => 'Update süsteemi mudel {$0}: {$1}',
'fi' => 'Update-ohjelma malli {$0}: {$1}',
'fr' => 'Mettre à jour le jeu pour le modèle {$0}: {$1}',
'hu' => 'Update rendszer modell {$0}: {$1}',
'it' => 'Aggiornamento regime per il modello {$0}: {$1}',
'lt' => 'Atnaujinti sistemos modelį {$0}: {$1}',
'lv' => 'Atjaunināt sistēmu modelis {$0}: {$1}',
'mk' => 'Ажурирање шема за модел {$0}: {$1}',
'nl' => 'Update schema voor model {$0}: {$1}',
'no' => 'Oppdatering ordningen for modellen {$0}: {$1}',
'pt' => 'Atualização de esquema para o modelo {$0}: {$1}',
'ru' => 'Обновление схемы для модели {$0}: {$1}',
'sk' => 'Aktualizácia systému pre model {$0}: {$1}',
'sl' => 'Posodobitev sistema za model {$0}: {$1}',
'sq' => 'Update skemë për modelin {$0}: {$1}',
'sv' => 'Update system för modell {$0}: {$1}',
'tr' => 'Model {$0} için: düzeni Update {$1}',
'uk' => 'Оновлення схеми для моделі {$0}: {$1}',
],
'Update field {$0} for model {$1}: {$2}' => [
'en' => 'Update field {$0} for model {$1}: {$2}',
'be' => 'Абнаўленне поля {$0} мадэлі для {$1}: {$2}',
'ca' => 'Actualització camp {$0} per model {$1}: {$2}',
'cs' => 'Aktualizovat pole {$0} pro model {$1}: {$2}',
'da' => 'Opdater felt {$0} til model {$1}: {$2}',
'de' => 'Update-Feld {$0} für Modell {$1}: {$2}',
'el' => 'Ενημερωμένη έκδοση πεδίο {$0} για το πρότυπο {$1}: {$2}',
'es' => 'Actualización de campo {$0} para el modelo {$1}: {$2}',
'et' => 'Update field {$0} mudeli {$1}: {$2}',
'fi' => 'Päivitä kenttä {$0} mallin {$1}: {$2}',
'fr' => 'Mise à jour le champ {$0} pour le modèle {$1}: {$2}',
'hu' => 'Frissítés mező {$0} modell {$1}: {$2}',
'it' => 'Aggiornamento campo {$0} per il modello {$1}: {$2}',
'lt' => 'Atnaujinti lauko {$0} modelis {$1}: {$2}',
'lv' => 'Atjaunināt lauks {$0} modelis {$1}: {$2}',
'mk' => 'Ажурирање на полето {$0} за модел {$1}: {$2}',
'nl' => 'Update het veld {$0} voor model {$1}: {$2}',
'no' => 'Oppdatering feltet {$0} for modellen {$1}: {$2}',
'pt' => 'Atualização de campo {$0} para o modelo {$1}: {$2}',
'ru' => 'Обновление поля {$0} для модели {$1}: {$2}',
'sk' => 'Aktualizácia pole {$0} pre model {$1}: {$2}',
'sl' => 'Posodobitev področju {$0} za model {$1}: {$2}',
'sq' => 'Update fushën {$0} për modelin {$1}: {$2}',
'sv' => 'Uppdatera fält {$0} modell för {$1}: {$2}',
'tr' => 'Güncelleme alan {$0} modeli {$1}: {$2}',
'uk' => 'Оновлення поля {$0} для моделі {$1}: {$2}',
],
];
8 changes: 4 additions & 4 deletions Resource/Ice/Helper/Arrays.res.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
return [
'array_column() expects parameter 1 to be array, null given' => [
'en' => 'array_column() expects parameter 1 to be array, null given',
'be' => 'array_column() чакае параметр 1 to be array, null given',
'be' => 'array_column() чакае параметр 1, каб быць масіў, нуль дадзена',
'ca' => 'array_column() espera que el paràmetre 1 a ser matriu, null donat',
'cs' => 'array_column() očekává, že parametr 1 jako pole, null',
'da' => 'array_column() forventer parameter 1 være matrix, null givet',
Expand All @@ -20,12 +20,12 @@
'nl' => 'array_column() verwacht dat parameter 1 te matrix, null gegeven',
'no' => 'array_column() forventer parameter 1 å være matrise, null gitt',
'pt' => 'array_column() expects parameter 1 para ser matriz, null dado',
'ru' => 'array_column() ожидает параметр 1 to be array, null given',
'ru' => 'array_column() ожидает параметр 1, чтобы быть массив, нуль дано',
'sk' => 'array_column() očakáva, že parameter 1 pole null vzhľadom',
'sl' => 'array_column() pričakuje, parameter 1, da se matrika, NIČ dal',
'sq' => 'array_column() pret parametër 1 të jetë grup, null dhënë',
'sq' => 'array_column() pret parametër 1 të jetë grup, i PAVLEFSHËM të dhënë',
'sv' => 'array_column() räknar parametern 1 vara matris, null ges',
'tr' => '() array_column dizi, BOŞ verilecek parametre 1 bekliyor ',
'uk' => 'array_column() очікує параметр 1 to be array, null given',
'uk' => 'array_column() очікує параметр 1, щоб бути масив, нуль дається',
],
];
15 changes: 10 additions & 5 deletions Source/Ice/Core/Loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Composer\Autoload\ClassLoader;
use Ice;
use Ice\Core;
use Ice\Data\Provider\Repository;
use Ice\Exception\File_Not_Found;
use Ice\Helper\Object;

Expand Down Expand Up @@ -43,6 +44,11 @@ class Loader
private static $_loader = null;

private static $_forceLoading = null;

/**
* @var Repository
*/
private static $_repository = null;
/**
* Load class
*
Expand All @@ -61,10 +67,7 @@ public static function load($class, $isRequired = true)
return true;
}

/** @var Data_Provider $dataProvider */
$dataProvider = Loader::getDataProvider();

$fileName = $dataProvider->get($class);
$fileName = self::$_repository->get($class);
if ($fileName) {
require_once $fileName;
return true;
Expand All @@ -76,7 +79,7 @@ public static function load($class, $isRequired = true)
require_once $fileName;

if (class_exists($class, false) || interface_exists($class, false) || trait_exists($class, false)) {
$dataProvider->set($class, $fileName);
self::$_repository->set($class, $fileName);
return true;
}

Expand Down Expand Up @@ -212,6 +215,8 @@ public static function init(ClassLoader $loader, $forceLoading = false)
self::$_loader = $loader;
self::$_forceLoading = $forceLoading;

self::$_repository = Loader::getRepository();

spl_autoload_unregister([$loader, 'loadClass']);

Loader::register([$loader, 'loadClass']);
Expand Down
18 changes: 15 additions & 3 deletions Source/Ice/Core/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ public static function getInstance($moduleAlias = null, $postfix = null, $isRequ
* @version 0.6
* @since 0.0
*/
public static function getAll() {
public static function getAll()
{
if (self::$_modules === null) {
self::$_modules = [];

Expand Down Expand Up @@ -169,7 +170,8 @@ private static function loadConfig($vendor, $context, array &$modules = [], $con
*/
public function getDataSourcePrefixes($dataSourceKey)
{
return $this->gets(Data_Source::getClass() . '/' . $dataSourceKey);
$dataSources = $this->getDataSources();
return (array)$dataSources[$dataSourceKey];
}

/**
Expand Down Expand Up @@ -214,6 +216,11 @@ public function getModelClass($tableName, $dataSourceKey)
return rtrim($modelName, '_');
}

public function getDataSources()
{
return $this->gets(Data_Source::getClass());
}

public function getDataSourceTables()
{
$tables = [];
Expand All @@ -227,6 +234,11 @@ public function getDataSourceTables()

public function getDataSourceKeys()
{
return array_keys($this->gets(Data_Source::getClass()));
return array_keys($this->getDataSources());
}

public function getAlias()
{
return $this->getConfigName();
}
}
2 changes: 1 addition & 1 deletion Source/Ice/Core/Resource.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public function get($message, $params = null, $class = null)
$locale = Request::locale();

if (!isset($resource[$message]) || !isset($resource[$message][$locale])) {
$resource = $class::getResource();
$resource = Resource::create($class);
$resource->set(rtrim($message, ';'));
$resource = $resource->_resource;
}
Expand Down
1 change: 1 addition & 0 deletions Source/Ice/Data/Provider/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

use Ice\Core\Data_Provider;
use Ice\Core\Exception;
use Ice\Core\Logger;
use Ice\Core\Module;
use Ice\Helper\Directory;
use Ice\Helper\File as Helper_File;
Expand Down
27 changes: 25 additions & 2 deletions Source/Ice/Data/Source/Mongodb.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
use Ice\Core\Query;
use Ice\Core\Query_Result;
use Ice\Core\Query_Translator;
use Ice\Helper\Json;
use Ice\Helper\String;
use MongoCursor;
use MongoId;

Expand Down Expand Up @@ -343,19 +345,40 @@ public function executeDrop(Query $query)
* @return array
* @author dp <[email protected]>
*
* @version 0.5
* @version 0.6
* @since 0.4
*/
public function getTables(Module $module)
{
$tables = [];

foreach ($this->getConnection()->getCollectionNames() as $name) {
$tables[$name] = [
$tables[$name] = [];

$data = &$tables[$name];

$data = [
'revision' => date('mdHi') . '_' . strtolower(String::getRandomString(2)),
'dataSourceKey' => $this->getDataSourceKey(),
'scheme' => [],
'schemeHash' => crc32(Json::encode([])),
'columns' => [],
];

$dataScheme = &$data['scheme'];
$dataScheme = [
'tableName' => $name,
'engine' => 'MongoDB',
'charset' => 'utf-8',
'comment' => $name
];
$data['schemeHash'] = crc32(Json::encode($dataScheme));

$data['indexes'] = [];
$data['indexesHash'] = crc32(Json::encode($data['indexes']));

$data['columns'] = [];
$data['columnsHash'] = crc32(Json::encode($data['columns']));
}

return $tables;
Expand Down
4 changes: 2 additions & 2 deletions Source/Ice/Data/Source/Mysqli.php
Original file line number Diff line number Diff line change
Expand Up @@ -444,8 +444,8 @@ public function getTables(Module $module)
$data = &$tables[$table['TABLE_NAME']];

$data = [
'revision' => date('mdHi') . '_' . String::getRandomString(2),
'dataSourceKey' => /*$module->get('type') == 'module' ? null : */$this->getDataSourceKey(),
'revision' => date('mdHi') . '_' . strtolower(String::getRandomString(2)),
'dataSourceKey' => $this->getDataSourceKey(),
'scheme' => [],
'schemeHash' => crc32(Json::encode([])),
'columns' => [],
Expand Down
3 changes: 0 additions & 3 deletions Source/Ice/Helper/Object.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@
*
* @package Ice
* @subpackage Helper
*
* @version 0.0
* @since 0.0
*/
class Object
{
Expand Down
2 changes: 2 additions & 0 deletions Source/Ice/Helper/Serializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ public static function getSerializer($serializer = null)
return $serializer;
}

return self::SERIALIZER_JSON;

return function_exists('igbinary_serialize')
? self::SERIALIZER_IGBINARY
: self::SERIALIZER_DEFAULT;
Expand Down
Loading

0 comments on commit 64a7bb3

Please sign in to comment.