- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fritzmg
committed
Feb 13, 2016
1 parent
3d3a72e
commit e79d75b
Showing
9 changed files
with
111 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
/** | ||
* Contao Open Source CMS | ||
* | ||
* Extension to replace the ArticleModel in order to allow inheritable articles | ||
* | ||
* @copyright inspiredminds 2016 | ||
* @package inherit_article | ||
* @link http://www.inspiredminds.at | ||
* @author Fritz Michael Gschwantner <fmg@inspiredminds.at> | ||
* @license GPL-2.0 | ||
*/ | ||
|
||
|
||
/** | ||
* Runonce for autoupdate | ||
*/ | ||
class InheritArticleRunOnce | ||
{ | ||
|
||
public function run() | ||
{ | ||
// get the database | ||
$objDb = \Database::getInstance(); | ||
|
||
if( $objDb->tableExists('tl_article') ) | ||
{ | ||
if( $objDb->fieldExists('inheritAfter', 'tl_article') && !$objDb->fieldExists('inheritPriority', 'tl_article') ) | ||
{ | ||
// create field | ||
$objDb->execute("ALTER TABLE `tl_article` ADD `inheritPriority` smallint(5) NOT NULL default '0'"); | ||
|
||
if( $objDb->fieldExists('inheritPriority', 'tl_article', true) ) | ||
{ | ||
$objDb->execute("UPDATE tl_article SET inheritPriority = '-1' WHERE inheritAfter = '1' AND inherit = '1'"); | ||
} | ||
} | ||
} | ||
} | ||
|
||
} | ||
|
||
$objInheritArticleRunOnce = new InheritArticleRunOnce(); | ||
$objInheritArticleRunOnce->run(); |