Skip to content
This repository has been archived by the owner on May 11, 2018. It is now read-only.

Commit

Permalink
(#) Sorting categories in category field by position doesn't reflect…
Browse files Browse the repository at this point in the history
… changes if cache is on (Issue #25)
  • Loading branch information
SigsiuTrinity committed May 9, 2018
1 parent 2bc7428 commit 2be8f57
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -35,6 +35,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public

(#) Unpacking of Sobi Framework in case of missing Phar support works now (Issue #80)
(#) Error 500 instead of 404 for undefined tasks (URL addresses) (Issue #97)
(#) Sorting categories in category field by position doesn't reflect changes if cache is on (Issue #25)


### 1.4.7.2 (8 May 2018)
Expand Down
2 changes: 2 additions & 0 deletions Site/lib/base/cache.php
Expand Up @@ -258,6 +258,8 @@ public function & cleanCategories()
if ( $file ) {
SPFs::delete( $file );
}
SPFactory::cache()
->addVar( null, 'categories_tree', Sobi::Section() );
return $this;
}

Expand Down
2 changes: 1 addition & 1 deletion Site/lib/ctrl/adm/category.php
Expand Up @@ -55,9 +55,9 @@ public function execute()
break;
case 'reorder':
$this->authorise( 'edit' );
SPFactory::cache()->cleanCategories();
$r = true;
$this->reorder();
SPFactory::cache()->cleanCategories();
break;
case 'up':
case 'down':
Expand Down
5 changes: 3 additions & 2 deletions Site/opt/fields/category.php
Expand Up @@ -435,8 +435,9 @@ private function createValues( $cats, &$result, $margin, $selector = true )

protected function loadCategories()
{
if ( ( !( $this->_cats ) || !( count( $this->_cats ) ) ) && SPLoader::path( 'etc.categories.' . Sobi::Lang( false ) . '-' . Sobi::Section(), 'front', true, 'json' ) ) {
$this->_cats = json_decode( SPFs::read( SPLoader::path( 'etc.categories.' . Sobi::Lang( false ) . '-' . Sobi::Section(), 'front', true, 'json' ) ), true );
$catFile = SPLoader::path( 'etc.categories' . Sobi::Lang( false ) . '-' . Sobi::Section(), 'front', true, 'json' );
if ( ( !( $this->_cats ) || !( count( $this->_cats ) ) ) && $catFile ) {
$this->_cats = json_decode( SPFs::read( $catFile ), true );
}
if ( !( $this->_cats ) || !( count( $this->_cats ) ) ) {
$this->_cats = SPFactory::cache()
Expand Down

0 comments on commit 2be8f57

Please sign in to comment.