Welcome to mirror list, hosted at ThFree Co, Russian Federation.

UpdateObserver.php « Updater « core - github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e639ecdb04fdbdf2a7801e93a90744cee9fc1504 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<?php
/**
 * Piwik - free/libre analytics platform
 *
 * @link http://piwik.org
 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 */
namespace Piwik\Updater;

/**
 * UpdateObservers can be used to inject logic into the component updating process. Derive
 * from this base class and add an instance of the derived class to a Updater instance. When
 * Updater::update() is called, the methods in the added UpdateListeners will be executed
 * accordingly.
 */
abstract class UpdateObserver
{
    /**
     * Executed when a component is about to be updated. At this point, no SQL queries or other
     * updating logic has been executed.
     *
     * @param string $name The name of the component being updated.
     */
    public function onComponentUpdateStarting($name)
    {
        // empty
    }

    /**
     * Executed after a component has been successfully updated.
     *
     * @param string $name The name of the component being updated.
     * @param string $version The version of the component that was updated.
     * @param string[] $warnings Any warnings that occurred during the component update process.
     */
    public function onComponentUpdateFinished($name, $version, $warnings)
    {
        // empty
    }

    /**
     * Executed before the update method of an Updates class is executed.
     *
     * @param string $componentName The name of the component being updated.
     * @param string $file The path to the Updates file being executed.
     * @param string $updateClassName The name of the Update class that should exist within the Update file.
     * @param string $version The version the Updates file belongs to.
     */
    public function onComponentUpdateFileStarting($componentName, $file, $updateClassName, $version)
    {
        // empty
    }

    /**
     * Executed after the update method of an Updates class is successfully executed.
     *
     * @param string $componentName The name of the component being updated.
     * @param string $file The path to the Updates file being executed.
     * @param string $updateClassName The name of the Update class that should exist within the Update file.
     * @param string $version The version the Updates file belongs to.
     */
    public function onComponentUpdateFileFinished($componentName, $file, $updateClassName, $version)
    {
        // empty
    }

    /**
     * Executed before a migration query is executed.
     *
     * @param string $updateFile The path to the Updates file being executed.
     * @param string $sql The SQL query that is about to be executed.
     */
    public function onStartExecutingMigrationQuery($updateFile, $sql)
    {
        // empty
    }

    /**
     * Executed after a migration query is executed.
     *
     * @param string $updateFile The path to the Updates file being executed.
     * @param string $sql The SQL query that has finished executing.
     */
    public function onFinishedExecutingMigrationQuery($updateFile, $sql)
    {
        // empty
    }

    /**
     * Executed when a warning occurs during the update process. A warning occurs when an Updates file
     * throws an exception that is not a UpdaterErrorException.
     *
     * @param string $componentName The name of the component being updated.
     * @param string $version The version of the Updates file during which the warning occurred.
     * @param \Exception $exception The exception that generated the warning.
     */
    public function onWarning($componentName, $version, \Exception $exception)
    {
        // empty
    }

    /**
     * Executed when an error occurs during the update process. An error occurs when an Updates file
     * throws a UpdaterErrorException.
     *
     * @param string $componentName The name of the component being updated.
     * @param string $version The version of the Updates file during which the error occurred.
     * @param \Exception $exception The exception that generated the error.
     */
    public function onError($componentName, $version, \Exception $exception)
    {
        // empty
    }
}