phpBB

Development Wiki

Difference between revisions of "Migrations/Data Changes/If"

From phpBB Development Wiki

(Created page with "The if statement helper allows you to create a basic if statement which will be checked and, if true, the attached statement will be parsed. ==How it works== <php>array('if',...")
 
m
 
Line 19: Line 19:
 
     array('config.update', array('allow_avatar', 1)),
 
     array('config.update', array('allow_avatar', 1)),
 
)),</php>
 
)),</php>
 +
 +
[[Category: Migrations]]

Latest revision as of 23:14, 13 January 2013

The if statement helper allows you to create a basic if statement which will be checked and, if true, the attached statement will be parsed.

How it works

array('if', array(
    
true// Some statement that is either true or false
    
array(/* Call to make if the statement is true */),
)),

Examples

if ($this->config['captcha_gd']) { run array('config.update', array('captcha_plugin', 'phpbb_captcha_gd')), }

array('if', array(
    (
$this->config['captcha_gd']),
    array(
'config.update', array('captcha_plugin''phpbb_captcha_gd')),
)),


if ($this->config['allow_avatar_upload'] || $this->config['allow_avatar_local'] || $this->config['allow_avatar_remote']) { run array('config.update', array('allow_avatar', 1)), }

array('if', array(
    (
$this->config['allow_avatar_upload'] || $this->config['allow_avatar_local'] || $this->config['allow_avatar_remote']),
    array(
'config.update', array('allow_avatar'1)),
)),