Skip to content

Commit

Permalink
Merge pull request #112 from trom58al/LIMB-PHP-55
Browse files Browse the repository at this point in the history
changed compatibility - only with PHP 5.5
  • Loading branch information
p-kislitskiy committed Feb 6, 2015
2 parents 04ca4ad + 6fe574c commit 3fb24e2
Show file tree
Hide file tree
Showing 2,181 changed files with 55,649 additions and 164,906 deletions.
51 changes: 35 additions & 16 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,45 @@ This is a general CHANGELOG, if you need more detailed changes
consider viewing CHANGELOG files for each package.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

===== Limb2015.1 =====

* PHP-5.5 compatibility only
* CACHE package removed APC support
* SimpleTest updated to 1.1.0
* CKEditor updated to 4.4.6
* KCFinder updated to 3.12
* Removed old versions phpmailer
* Linter DB driver removed
* SQLite DB driver removed
* FCKEditor removed
* TinyMCE removed
* Deprecated methods removed

===== Limb2014.1 =====

* many fixes

===== Limb2011.1 =====

* CMS package #CMS-5
* new form tags: form:submit, form:checkbox, form:textarea, etc #LMB-89
* WACT removed #LMB-87
* new app mode check
* better ValueObjects support
* removed many uselless constants
* many fixes in PostgreSQL support
* fixed security bug in WYSIWYG package
* added implementation of REST interface
* added ACL config support
* reanimated web_cache package, added web_cache.conf.php
* PHPUnit adapter #LMB-19
* now lmbSQLCriteria supports fast creation for all kind of criterias
* changed file mask for files with tasks
* added CKEditor support in WYSIWYG with KCFinder as file manager
* CMS package #CMS-5
* new form tags: form:submit, form:checkbox, form:textarea, etc #LMB-89
* WACT removed #LMB-87
* new app mode check
* better ValueObjects support
* removed many uselless constants
* many fixes in PostgreSQL support
* fixed security bug in WYSIWYG package
* added implementation of REST interface
* added ACL config support
* reanimated web_cache package, added web_cache.conf.php
* PHPUnit adapter #LMB-19
* now lmbSQLCriteria supports fast creation for all kind of criterias
* changed file mask for files with tasks
* added CKEditor support in WYSIWYG with KCFinder as file manager

===== Limb2010.1 =====
3 years is a long time ;)

* 3 years is a long time ;)

===== Limb3-2007.4 (Frozzy) =====

Expand Down
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ testman — набор средств для организации и запу
* [Скачать](https://github.com/limb-php-framework/limb-app-taskman/downloads)
* [Issue tracker](https://github.com/limb-php-framework/limb-app-taskman/issues)

## Системные требования

* Операционная система: *nix, Windows 98/ME/2000/XP
* Веб-сервер: Apache 1.3+ (с подключенным модулем mod_rewrite), nginx (в связке с php-fpm)
* PHP: <= 5.3 (использовать [Limb2014.1](https://github.com/limb-php-framework/limb/tree/Limb2014.1)), PHP 5.5 (использовать [master](https://github.com/limb-php-framework/limb)),
* Поддерживаемые базы данных: [MySQL](http://www.mysql.com/) 4.1+, [PostgreSQL](http://www.postgresql.org/) 8.2+, [Oracle](http://www.oracle.com/index.html) (OCI8)

#English
##Limb PHP Framework
Limb is an [OpenSource](http://en.wikipedia.org/wiki/OpenSource) ([LGPL](http://en.wikipedia.org/wiki/LGPL)) Library of Interdependent Modules and Blocks mostly aimed for rapid web application prototyping and development with PHP5.
Expand All @@ -41,3 +48,9 @@ The easiest way to get almost immediate feedback from core Limb developers is to
* [Download](./docs/en/how_to_download.md)
* [All limb projects](https://github.com/limb-php-framework)

## System requirements

* OS: *nix, Windows 98/ME/2000/XP
* Web-server: Apache 1.3+ (with mod_rewrite), nginx (with php-fpm)
* PHP: <= 5.3 (use [Limb2014.1](https://github.com/limb-php-framework/limb/tree/Limb2014.1)), PHP 5.5 (use [master](https://github.com/limb-php-framework/limb)),
* DB Server: [MySQL](http://www.mysql.com/) 4.1+, [PostgreSQL](http://www.postgresql.org/) 8.2+, [Oracle](http://www.oracle.com/index.html) (OCI8)
33 changes: 13 additions & 20 deletions active_record/src/lmbARManyToManyCollection.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,50 +20,43 @@ class lmbARManyToManyCollection extends lmbARRelationCollection
protected function _createARQuery($params = array())
{
$query = self :: createFullARQueryForRelation($this->relation_info, $this->conn, $params);

$join_table = $this->conn->quoteIdentifier($this->relation_info['table']);
$field = $this->conn->quoteIdentifier($this->relation_info['field']);
$query->addCriteria("{$join_table}.{$field} = {$this->owner->getId()}");
if(isset($this->relation_info['criteria']))
{
$query->addCriteria($this->relation_info['criteria']);
}
return $query;
}

static function createFullARQueryForRelation($relation_info, $conn, $params = array())
{
return parent :: createFullARQueryForRelation(__CLASS__, $relation_info, $conn, $params);
return $query;
}

static function createCoreARQueryForRelation($relation_info, $conn, $params = array())
{
$class = $relation_info['class'];
$object = new $class();

$table = $conn->quoteIdentifier($object->getTableName());
$join_table = $conn->quoteIdentifier($relation_info['table']);
$field = $conn->quoteIdentifier($relation_info['field']);
$foreign_field = $conn->quoteIdentifier($relation_info['foreign_field']);
$primary_field = $conn->quoteIdentifier($object->getPrimaryKeyName());
$sql = "SELECT %fields% FROM {$table} INNER JOIN {$join_table} ON {$table}.{$primary_field} = {$join_table}.{$foreign_field}" .

$sql = "SELECT %fields% FROM {$table} INNER JOIN {$join_table} ON {$table}.{$primary_field} = {$join_table}.{$foreign_field}" .
" %tables% %left_join% %where% %group% %having% %order%";

$query = lmbARQuery :: create($class, $params, $conn, $sql);
$query = lmbARQuery :: create($class, $params, $conn, $sql);

$fields = $object->getDbTable()->getColumnsForSelect();
foreach($fields as $field => $alias)
$query->addField($field, $alias);

return $query;
}

function set($objects)
{
$existing_records = $this->_getExistingRecords($objects);
$linked_objects_ids = array_keys($existing_records);


foreach($objects as $object)
{
$id = $object->getId();
Expand All @@ -72,7 +65,7 @@ function set($objects)
else
unset($existing_records[$id]);
}

$to_remove_ids = array_keys($existing_records);
if(count($to_remove_ids))
{
Expand All @@ -84,18 +77,18 @@ function set($objects)
$table->delete($criteria);
}
}

protected function _getExistingRecords($objects)
{
$table = new lmbTableGateway($this->relation_info['table'], $this->conn);
$criteria = new lmbSQLCriteria();
$criteria->addAnd(new lmbSQLFieldCriteria($this->relation_info['field'], $this->owner->getId()));
$criteria->addAnd(new lmbSQLFieldCriteria($this->relation_info['foreign_field'], null, lmbSQLFieldCriteria :: IS_NOT_NULL));
$existing_records = $table->select($criteria);

return lmbCollection :: toFlatArray($existing_records, $this->relation_info['foreign_field']);
}

protected function _removeRelatedRecords()
{
$table = new lmbTableGateway($this->relation_info['table'], $this->conn);
Expand All @@ -113,7 +106,7 @@ protected function _saveObject($object, $error_list = null)
$table->insert(array($this->relation_info['field'] => $this->owner->getId(),
$this->relation_info['foreign_field'] => $object->getId()));
}

function remove($object)
{
$table = new lmbTableGateway($this->relation_info['table'], $this->conn);
Expand Down
5 changes: 0 additions & 5 deletions active_record/src/lmbAROneToManyCollection.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,6 @@ protected function _createARQuery($params = array())
return $query;
}

static function createFullARQueryForRelation($relation_info, $conn, $params = array())
{
return parent :: createFullARQueryForRelation(__CLASS__, $relation_info, $conn, $params);
}

static function createCoreARQueryForRelation($relation_info, $conn, $params = array())
{
return lmbARQuery :: create($relation_info['class'], $params, $conn);
Expand Down
4 changes: 2 additions & 2 deletions active_record/src/lmbARRelationCollection.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,12 @@ function attach($relation_name, $params = array())
return $this;
}

static function createFullARQueryForRelation($calling_class, $relation_info, $conn, $params = array())
static function createFullARQueryForRelation($relation_info, $conn, $params = array())
{
if(!isset($params['sort']) && isset($relation_info['sort_params']))
$params['sort'] = $relation_info['sort_params'];

$query = call_user_func_array(array($calling_class, 'createCoreARQueryForRelation'), array($relation_info, $conn, $params));
$query = static::createCoreARQueryForRelation($relation_info, $conn, $params);

return $query;
}
Expand Down
34 changes: 8 additions & 26 deletions active_record/src/lmbActiveRecord.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1442,31 +1442,13 @@ static protected function _isClass($name)
return ctype_alnum("$name") && !ctype_digit("$name");
}

/**
* @deprecated
* @return string
*/
static protected function _getCallingClass()
{
if(function_exists('get_called_class'))
return get_called_class();

//once PHP-5.3 LSB patch is available we'll use get_called_class
//currently it's a quite a slow implementation and it doesn't
//recognize multiline function calls

$trace = debug_backtrace();
$back = $trace[1];
$method = $back['function'];
$fp = fopen($back['file'], 'r');

for($i=0; $i<$back['line']-1; $i++)
fgets($fp);

$line = fgets($fp);
fclose($fp);

if(!preg_match('~(\w+)\s*::\s*' . $method . '\s*\(~', $line, $m))
throw new lmbARException("Static calling class not found!(using multiline static method call?)");
if($m[1] == 'lmbActiveRecord')
throw new lmbARException("Found static class can't be lmbActiveRecord!");
return $m[1];
return get_called_class();
}

/**
Expand All @@ -1482,7 +1464,7 @@ static function findFirst($class_name = null, $magic_params = null, $conn = null
if(!self :: _isClass($class_name))
{
$conn = $magic_params;
$magic_params = $class_name ? $class_name : array();
$magic_params = $class_name ?: array();
$class_name = self :: _getCallingClass();
}

Expand Down Expand Up @@ -1518,7 +1500,7 @@ static function findOne($class_name = null, $magic_params = null, $conn = null)
if(!self :: _isClass($class_name))
{
$conn = $magic_params;
$magic_params = $class_name ? $class_name : array();
$magic_params = $class_name ?: array();
$class_name = self :: _getCallingClass();
}
return self :: findFirst($class_name, $magic_params, $conn);
Expand Down Expand Up @@ -1748,7 +1730,7 @@ static function find($class_name = null, $magic_params = null, $conn = null)
if(!self :: _isClass($class_name))
{
$conn = $magic_params;
$magic_params = $class_name ? $class_name : array();
$magic_params = $class_name ?: array();
$class_name = self :: _getCallingClass();
}

Expand Down
Loading

0 comments on commit 3fb24e2

Please sign in to comment.