Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixes with missing tags.

  • Loading branch information...
commit 57470de31376fd062dadb76da3f08ddf0d4914da 1 parent edf40e3
@balupton balupton authored
Showing with 19 additions and 6 deletions.
  1. +4 −2 lib/Bal/Controller/Plugin/Url.php
  2. +15 −4 lib/Bal/Doctrine/Core.php
View
6 lib/Bal/Controller/Plugin/Url.php
@@ -284,8 +284,10 @@ public function hard ( $value ) {
* Free anything that needs cleaning/freeling
*/
public function free ( ) {
- foreach ( $this->_free as $Item ) {
- $Item->free(true);
+ if ( FREE_RESOURCES ) {
+ foreach ( $this->_free as $Item ) {
+ $Item->free(true);
+ }
}
$this->_free = array();
}
View
19 lib/Bal/Doctrine/Core.php
@@ -1505,25 +1505,29 @@ public static function ensureMany ( Doctrine_Event $Event, $relation ) {
public static function ensureTags ( Doctrine_Event $Event, $tagRelation, $tagField ) {
# Prepare
$save = false;
+ $tagRelationNames = $tagRelation.'Names';
# Fetch
$Invoker = $Event->getInvoker();
- $Invoker->addTags($Invoker->code);
# Fetch
$modified = $Invoker->getModified();
$modifiedLast = $Invoker->getLastModified();
- $tagRelationNames = $tagRelation.'Names';
# Fetch
- $tagsSystemOrig = $Invoker->$tagRelationNames;
- $tagsUserOrig = $Invoker->$tagField;
+ $tagsSystemOrig = delve($Invoker,$tagRelationNames);
+ $tagsUserOrig = delve($Invoker,$tagField);
$tagsSystem = prepare_csv_str($tagsSystemOrig);
$tagsUser = prepare_csv_str($tagsUserOrig);
$tagsUserNewer = array_key_exists($tagField, $modified);
$tagsSystemNewer = !array_key_exists($tagField, $modified) && !array_key_exists($tagField, $modifiedLast);
$tagsDiffer = $tagsUser != $tagsSystem;
+ # Workaround to fix Doctrine bug which causes lost tags
+ if ( !$tagsSystemOrig ) {
+ $tagsSystemNewer = false;
+ }
+
# TagField > TagField
if ( ($tagsDiffer || $tagsUserOrig != $tagsUser) && $tagsUserNewer ) {
# TagField is newer than TagField
@@ -1560,6 +1564,13 @@ public static function ensureTags ( Doctrine_Event $Event, $tagRelation, $tagFie
$save = true;
}
+ # Ensure our Code is a Tag
+ $tagsSystemOrig = delve($Invoker,$tagRelationNames);
+ if ( !in_array($Invoker->code, $tagsSystemOrig) ) {
+ $Invoker->addTags($Invoker->code);
+ }
+
+
# Return
return $save;
}
Please sign in to comment.
Something went wrong with that request. Please try again.