Chyrp

Upgrader

A task-based general-purpose Chyrp upgrader.

Performs upgrade functions based on individual tasks, and checks whether or not they need to be done.

Version-agnostic.  Completely safe to be run at all times, by anyone.

Summary
Upgrader A task-based general-purpose Chyrp upgrader.
Functions
config_file Returns what config file their install is set up for.
database_file Returns what database config file their install is set up for.
using_yaml Are they using YAML config storage?
Files
Helpers Various functions used throughout Chyrp’s code.
Gettext Gettext library.
Streams Streams library.
YAML Horde YAML parsing library.
SQL SQL
Config Handles writing to whichever config file they’re using.
Variables
$yaml Stores all of the YAML data.
Functions
get Returns a config setting.
set Sets a config setting.
check Goes a config exist?
fallback Sets a config setting to $value if it does not exist.
remove Removes a setting if it exists.
test Attempts to perform a task, and displays a “success” or “failed” message determined by the outcome.
fix_htaccess Repairs their .htaccess file.
tweets_to_posts Enacts the “tweet” to “post” rename.
pages_parent_id_column Adds the parent_id column to the “pages” table.
pages_list_order_column Adds the list_order column to the “pages” table.
remove_beginning_slash_from_post_url Removes the slash at the beginning of the post URL setting.
move_yml_yaml Renames config.yml.php to config.yaml.php.
update_protection Updates the PHP protection code in the config file.
theme_default_to_stardust Changes their theme from “default” to “stardust”, or leaves it alone if they’re not using “default”.
default_db_adapter_to_mysql Adds an “adapter” SQL setting if it doesn’t exist, and sets it to “mysql”.
move_upload Renames the “upload” directory to “uploads”.
make_posts_xml Updates all of the post XML data to well-formed non-CDATAized XML.
rss_posts_to_feed_items Rename the feed items setting.
update_groups_to_yaml Updates the groups to use YAML-based permissions instead of table columns.
add_permissions_table Creates the “permissions” table and fills it in with the default set.
add_sessions_table Creates the “sessions” table.
update_permissions_table Updates the “permissions” table from ## (id) => foo_bar (name) to foo_bar (id) => Foo Bar (name).
update_custom_routes Updates the custom routes to be path => action instead of # => path.
remove_database_config_file Removes the database.yaml.php file, which is merged into config.yaml.php.
rename_database_setting_to_sql Renames the “database” config setting to “sql”.
update_post_status_column Updates the status column on the “posts” table to be a generic varchar field instead of enum.
add_post_attributes_table Adds the “post_attributes” table.
post_xml_to_db Migrates the XML post attributes to the “post_attributes” table.
add_group_id_to_permissions Adds the group_id column to the “permissions” table.
group_permissions_to_db Migrates the group permissions from a YAML column to the “permissions” table.
remove_old_files Removes unused files from previous installs.
update_user_password_column Updates the password column on the “users” table to have a length of 60.

Functions

config_file

function config_file()

Returns what config file their install is set up for.

database_file

function database_file()

Returns what database config file their install is set up for.

using_yaml

function using_yaml()

Are they using YAML config storage?

Files

Helpers

Various functions used throughout Chyrp’s code.

Gettext

Gettext library.

Streams

Streams library.

YAML

Horde YAML parsing library.

SQL

See Also

SQL

Config

Handles writing to whichever config file they’re using.

Summary
Variables
$yaml Stores all of the YAML data.
Functions
get Returns a config setting.
set Sets a config setting.
check Goes a config exist?
fallback Sets a config setting to $value if it does not exist.
remove Removes a setting if it exists.
test Attempts to perform a task, and displays a “success” or “failed” message determined by the outcome.
fix_htaccess Repairs their .htaccess file.
tweets_to_posts Enacts the “tweet” to “post” rename.
pages_parent_id_column Adds the parent_id column to the “pages” table.
pages_list_order_column Adds the list_order column to the “pages” table.
remove_beginning_slash_from_post_url Removes the slash at the beginning of the post URL setting.
move_yml_yaml Renames config.yml.php to config.yaml.php.
update_protection Updates the PHP protection code in the config file.
theme_default_to_stardust Changes their theme from “default” to “stardust”, or leaves it alone if they’re not using “default”.
default_db_adapter_to_mysql Adds an “adapter” SQL setting if it doesn’t exist, and sets it to “mysql”.
move_upload Renames the “upload” directory to “uploads”.
make_posts_xml Updates all of the post XML data to well-formed non-CDATAized XML.
rss_posts_to_feed_items Rename the feed items setting.
update_groups_to_yaml Updates the groups to use YAML-based permissions instead of table columns.
add_permissions_table Creates the “permissions” table and fills it in with the default set.
add_sessions_table Creates the “sessions” table.
update_permissions_table Updates the “permissions” table from ## (id) => foo_bar (name) to foo_bar (id) => Foo Bar (name).
update_custom_routes Updates the custom routes to be path => action instead of # => path.
remove_database_config_file Removes the database.yaml.php file, which is merged into config.yaml.php.
rename_database_setting_to_sql Renames the “database” config setting to “sql”.
update_post_status_column Updates the status column on the “posts” table to be a generic varchar field instead of enum.
add_post_attributes_table Adds the “post_attributes” table.
post_xml_to_db Migrates the XML post attributes to the “post_attributes” table.
add_group_id_to_permissions Adds the group_id column to the “permissions” table.
group_permissions_to_db Migrates the group permissions from a YAML column to the “permissions” table.
remove_old_files Removes unused files from previous installs.
update_user_password_column Updates the password column on the “users” table to have a length of 60.

Variables

$yaml

static $yaml

Stores all of the YAML data.

Functions

get

static function get( $setting )

Returns a config setting.

Parameters

$setting The setting to return.

set

static function set( $setting,   
$value,   
$message  =  null )

Sets a config setting.

Parameters

$setting The config setting to set.
$value The value for the setting.
$message The message to display with test().

check

static function check( $setting )

Goes a config exist?

Parameters

$setting Name of the config to check.

fallback

static function fallback( $setting,   
$value,   
$message  =  null )

Sets a config setting to $value if it does not exist.

Parameters

$setting The config setting to set.
$value The value for the setting.
$message The message to display with test().

remove

static function remove( $setting )

Removes a setting if it exists.

Parameters

$setting The setting to remove.

test

function test( $try,   
$message  =  "" )

Attempts to perform a task, and displays a “success” or “failed” message determined by the outcome.

Parameters

$try The task to attempt.  Should return something that evaluates to true or false.
$message Message to display for the test.

fix_htaccess

function fix_htaccess()

Repairs their .htaccess file.

tweets_to_posts

function tweets_to_posts()

Enacts the “tweet” to “post” rename.

Versions: 1.0.2 => 1.0.3

pages_parent_id_column

function pages_parent_id_column()

Adds the parent_id column to the “pages” table.

Versions: 1.0.3 => 1.0.4

pages_list_order_column

function pages_list_order_column()

Adds the list_order column to the “pages” table.

Versions: 1.0.4 => 1.1.0

remove_beginning_slash_from_post_url

function remove_beginning_slash_from_post_url()

Removes the slash at the beginning of the post URL setting.

move_yml_yaml

function move_yml_yaml()

Renames config.yml.php to config.yaml.php.

Versions: 1.1.2 => 1.1.3

update_protection

function update_protection()

Updates the PHP protection code in the config file.

theme_default_to_stardust

function theme_default_to_stardust()

Changes their theme from “default” to “stardust”, or leaves it alone if they’re not using “default”.

Versions: 1.1.3.2 => 2.0

default_db_adapter_to_mysql

function default_db_adapter_to_mysql()

Adds an “adapter” SQL setting if it doesn’t exist, and sets it to “mysql”.

Versions: 1.1.3.2 => 2.0

move_upload

function move_upload()

Renames the “upload” directory to “uploads”.

make_posts_xml

Updates all of the post XML data to well-formed non-CDATAized XML.

Versions: 1.1.3.2 => 2.0

rss_posts_to_feed_items

function rss_posts_to_feed_items()

Rename the feed items setting.

Versions: 1.1.3.2 => 2.0

update_groups_to_yaml

function update_groups_to_yaml()

Updates the groups to use YAML-based permissions instead of table columns.

Versions: 1.1.3.2 => 2.0

add_permissions_table

function add_permissions_table()

Creates the “permissions” table and fills it in with the default set.

Versions: 1.1.3.2 => 2.0

add_sessions_table

function add_sessions_table()

Creates the “sessions” table.

Versions: 1.1.3.2 => 2.0

update_permissions_table

function update_permissions_table()

Updates the “permissions” table from ## (id) => foo_bar (name) to foo_bar (id) => Foo Bar (name).

Versions: 2.0b => 2.0

update_custom_routes

function update_custom_routes()

Updates the custom routes to be path => action instead of # => path.

Versions: 2.0rc1 => 2.0rc2

remove_database_config_file

function remove_database_config_file()

Removes the database.yaml.php file, which is merged into config.yaml.php.

Versions: 2.0rc1 => 2.0rc2

rename_database_setting_to_sql

function rename_database_setting_to_sql()

Renames the “database” config setting to “sql”.

update_post_status_column

function update_post_status_column()

Updates the status column on the “posts” table to be a generic varchar field instead of enum.

Versions: 2.0rc1 => 2.0rc2

add_post_attributes_table

function add_post_attributes_table()

Adds the “post_attributes” table.

Versions: 2.0rc1 => 2.0rc2

post_xml_to_db

function post_xml_to_db()

Migrates the XML post attributes to the “post_attributes” table.

Versions: 2.0rc1 => 2.0rc2

add_group_id_to_permissions

function add_group_id_to_permissions()

Adds the group_id column to the “permissions” table.

Versions: 2.0rc1 => 2.0rc2

group_permissions_to_db

function group_permissions_to_db()

Migrates the group permissions from a YAML column to the “permissions” table.

Versions: 2.0rc1 => 2.0rc2

remove_old_files

function remove_old_files()

Removes unused files from previous installs.

update_user_password_column

function update_user_password_column()

Updates the password column on the “users” table to have a length of 60.

Versions: 2.0rc3 => 2.0