I want to edit/update Joomla article using an external script. The assets table has been broken and for that I used ACL Manager to fix it. But there are some missing assets for which I need to open and re-save the articles without modifying anything. No content modification I can do this manually but when data is heavy, then opening and re-saving each and every article would be hectic.

Therefore, I want to create a php script using which I can update the articles or just save them as it is.

Any help would be appreciated.

1 Answer 1


I solved the problem of manual update using the following script. In this case, I only wanted to update the missing assets articles mentioned in ACL manager. There were about 1000 such articles.

if (!defined('_JEXEC')) {
    define( '_JEXEC', 1 );
    define('JPATH_BASE', realpath(dirname(__FILE__)));
    require_once ( JPATH_BASE .'/includes/defines.php' );
    require_once ( JPATH_BASE .'/includes/framework.php' );
    defined('DS') or define('DS', DIRECTORY_SEPARATOR);

$app = JFactory::getApplication('site');
$db = JFactory::getDbo();

$basePath = JPATH_ADMINISTRATOR.'/components/com_content';
require_once $basePath.'/models/article.php';
$article_model =  JModelLegacy::getInstance('Article','ContentModel');

require_once JPATH_ADMINISTRATOR.'/components/com_aclmanager/models/diagnostic.php';
$acl_model =  JModelLegacy::getInstance('Diagnostic','AclmanagerModel');
$missingAssets = $acl_model->getMissingAssets();

 * @missingAssets : returns array of issues present in asset table
foreach ($missingAssets as $key => $value) {
    //to check and update only articles. The array might contain type of category and module as well
    if($value->type == 'article'){
        $query = $db->getQuery(true);
        $update_data = $db->setQuery($query)->loadAssoc();
        echo '<p>article updated - '.$value->id.'</p>';

I have added more description in github . So, one can refer this also if more guidance is needed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.