UpgradeFunctions.php
SeekQuarry/Yioop -- Open Source Pure PHP Search Engine, Crawler, and Indexer
Copyright (C) 2009 - 2023 Chris Pollett chris@pollett.org
LICENSE:
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.
END LICENSE
This file contains global functions to check whether upgrading the database or locales is needed as wells as auxiliary functions to be used by the VersionFunctions.php code to actually carry out upgrades between versions
Tags
Table of Contents
- upgradeLocalesCheck() : mixed
- Checks to see if the locale data of Yioop! of a locale in the work dir is older than the currently running Yioop!
- upgradeLocales() : mixed
- If the locale data of Yioop! in the work directory is older than the currently running Yioop! then this function is called to at least try to copy the new strings into the old profile.
- upgradePublicHelpWiki() : mixed
- Used to force push the default Public and Wiki pages into the current database
- upgradeDatabaseWorkDirectoryCheck() : mixed
- Checks to see if the database data or work_dir folder of Yioop! is from an older version of Yioop! than the currently running Yioop!
- upgradeDatabaseWorkDirectory() : mixed
- If the database data of Yioop is older than the version of the currently running Yioop then this function is called to try upgrade the database to the new version
- updateVersionNumber() : mixed
- Update the database version number to a new number
- getWikiHelpPages() : mixed
- Reads the Help articles from default db and returns the array of pages.
- addActivityAtId() : mixed
- Used to insert a new activity into the database at a given activity_id
- updateTranslationForStringId() : mixed
- Adds or replaces a translation for a database message string for a given IANA locale tag.
Functions
upgradeLocalesCheck()
Checks to see if the locale data of Yioop! of a locale in the work dir is older than the currently running Yioop!
upgradeLocalesCheck(string $locale_tag) : mixed
Parameters
- $locale_tag : string
-
locale to check directory of
Return values
mixed —upgradeLocales()
If the locale data of Yioop! in the work directory is older than the currently running Yioop! then this function is called to at least try to copy the new strings into the old profile.
upgradeLocales() : mixed
Return values
mixed —upgradePublicHelpWiki()
Used to force push the default Public and Wiki pages into the current database
upgradePublicHelpWiki(resource &$db) : mixed
Parameters
- $db : resource
-
datasource to use to upgrade
Return values
mixed —upgradeDatabaseWorkDirectoryCheck()
Checks to see if the database data or work_dir folder of Yioop! is from an older version of Yioop! than the currently running Yioop!
upgradeDatabaseWorkDirectoryCheck() : mixed
Return values
mixed —upgradeDatabaseWorkDirectory()
If the database data of Yioop is older than the version of the currently running Yioop then this function is called to try upgrade the database to the new version
upgradeDatabaseWorkDirectory() : mixed
Return values
mixed —updateVersionNumber()
Update the database version number to a new number
updateVersionNumber(object &$db, int $number) : mixed
Parameters
- $db : object
-
datasource for Yioop database
- $number : int
-
the new database number
Return values
mixed —getWikiHelpPages()
Reads the Help articles from default db and returns the array of pages.
getWikiHelpPages() : mixed
Return values
mixed —addActivityAtId()
Used to insert a new activity into the database at a given activity_id
addActivityAtId(resource &$db, string $string_id, string $method_name, int $activity_id) : mixed
Inserting at an ID rather than at the end is useful since activities are displayed in admin panel in order of increasing id.
Parameters
- $db : resource
-
database handle where Yioop database stored
- $string_id : string
-
message identifier to give translations for for activity
- $method_name : string
-
admin_controller method to be called to perform this activity
- $activity_id : int
-
the id location at which to create this activity activity at and below this location will be shifted down by 1.
Return values
mixed —updateTranslationForStringId()
Adds or replaces a translation for a database message string for a given IANA locale tag.
updateTranslationForStringId(resource &$db, string $string_id, string $locale_tag, string $translation) : mixed
Parameters
- $db : resource
-
database handle where Yioop database stored
- $string_id : string
-
message identifier to give translation for
- $locale_tag : string
-
the IANA language tag to update the strings of
- $translation : string
-
the translation for $string_id in the language $locale_tag