Skip to content

Add-on Update File - return values from parent installer class #715

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: 7.dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 7 additions & 20 deletions docs/development/add-on-update-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,24 +37,18 @@ class Amazing_add_on_upd extends Installer

public function install()
{
parent::install();

return true;
return parent::install();
}

public function update($current = '')
{
// Runs migrations
parent::update($current);

return true;
return parent::update($current);
}

public function uninstall()
{
parent::uninstall();

return true;
return parent::uninstall();
}
}
```
Expand All @@ -79,13 +73,11 @@ The CLI automatically generates our install method. This method will ensure that
```
public function install()
{
parent::install();

// create a database table
// notify mission control
// add publish tabs

return true;
return parent::install();
}
```

Expand Down Expand Up @@ -140,19 +132,16 @@ The `update` method will run code when a user installs an update to our add-on.

public function update($current = '')
{
// Runs migrations
parent::update($current);

// only run the update if the user is currently running a version less than 2.0
if (version_compare($current, '2.0', '<'))
{
// Do your update code here
// update database
// notify mission control of the update
}


return true;
// Runs migrations
return parent::update($current);
}

## Uninstall Your Add-On (`uninstall()`)
Expand All @@ -164,13 +153,11 @@ The CLI automatically generates our uninstall method. This method will ensure th

public function uninstall()
{
parent::uninstall();

// remove my database tables
// remove any publish tabs
// turn off the lights

return true;
return parent::uninstall();;
}

### Removing Tabs
Expand Down