The block does not update

The block does not update

by Helson C -
Number of replies: 1

I have a block called myBlock

I changed the version in version.php and was added code in upgrade.php.

I ziped the file and re-upload the block to moodle and the block installs fine, but

nothing is changed, the version in database don't changed and the fields that I put inside upgrade.php don't be created.


I also tried "/admin/index.php" to check update, and moodle don't detect the new block version.

Moodle 3.1


Thanks in advance!



#vesion.php - file

defined('MOODLE_INTERNAL') || die();

$plugin->version   = 2016042506;           

$plugin->requires  = 2012112900;      

$plugin->component = 'block_myblock; 


#mdl_config_plugins - table

version = 2016042505


<?php 

defined('MOODLE_INTERNAL') || die();

function xmldb_block_myblock_upgrade($oldversion, $block) {

global $DB;

$dbman = $DB->get_manager();

    if ($oldversion < 2016042506) {

     $table  = new xmldb_table('block_secretaria_servicos');

    $field  = new xmldb_field('data', XMLDB_TYPE_INTEGER, '20', null, null, null, null, '');


         if (!$dbman->field_exists($table, $field)) {

              $dbman->add_field($table, $field);     

        }        

    }    

    upgrade_block_savepoint(true, 2016042506, 'myblock');

    return true;

}




Average of ratings: -
In reply to Helson C

Re: The block does not update

by Helson C -

I solve cleaning the cache and restarting apache.