Completed
Branch master (95506d)
by Jonathan
13:15
created
phpunit.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,6 +23,6 @@
 block discarded – undo
23 23
 define('WT_REGEX_INTEGER', '-?\d+');
24 24
 define('WT_REGEX_BYTES', '[0-9]+[bBkKmMgG]?');
25 25
 define('WT_REGEX_IPV4', '\d{1,3}(\.\d{1,3}){3}');
26
-define('WT_REGEX_PASSWORD', '.{' . WT_MINIMUM_PASSWORD_LENGTH . ',}');
26
+define('WT_REGEX_PASSWORD', '.{'.WT_MINIMUM_PASSWORD_LENGTH.',}');
27 27
 
28 28
 I18N::init('en-US');
29 29
\ No newline at end of file
Please login to merge, or discard this patch.
src/Webtrees/Constants.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -14,17 +14,17 @@  discard block
 block discarded – undo
14 14
  */
15 15
 class Constants {
16 16
     
17
-    const LIB_NAMESPACE = __NAMESPACE__;
17
+	const LIB_NAMESPACE = __NAMESPACE__;
18 18
 	
19
-    /** Internal name of the Certificates Module
20
-     * @var string
21
-     */
22
-    const MODULE_MAJ_CERTIF_NAME = 'myartjaub_certificates';
19
+	/** Internal name of the Certificates Module
20
+	 * @var string
21
+	 */
22
+	const MODULE_MAJ_CERTIF_NAME = 'myartjaub_certificates';
23 23
     
24
-    /** Internal name of the GeoDispersion Module
25
-     * @var string
26
-     */
27
-    const MODULE_MAJ_GEODISP_NAME = 'myartjaub_geodispersion';
24
+	/** Internal name of the GeoDispersion Module
25
+	 * @var string
26
+	 */
27
+	const MODULE_MAJ_GEODISP_NAME = 'myartjaub_geodispersion';
28 28
     
29 29
 	/** Internal name of the Hooks Module
30 30
 	 * @var string
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 	 * @return string $WT_RAPHAEL_JS_URL
62 62
 	 */
63 63
 	public static function WT_RAPHAEL_JS_URL() {
64
-	    return WT_STATIC_URL . 'packages/raphael-2.1.4/raphael-min.js';
64
+		return WT_STATIC_URL . 'packages/raphael-2.1.4/raphael-min.js';
65 65
 	}
66 66
 		
67 67
 }
68 68
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@
 block discarded – undo
61 61
 	 * @return string $WT_RAPHAEL_JS_URL
62 62
 	 */
63 63
 	public static function WT_RAPHAEL_JS_URL() {
64
-	    return WT_STATIC_URL . 'packages/raphael-2.1.4/raphael-min.js';
64
+	    return WT_STATIC_URL.'packages/raphael-2.1.4/raphael-min.js';
65 65
 	}
66 66
 		
67 67
 }
68 68
\ No newline at end of file
Please login to merge, or discard this patch.
src/Webtrees/Map/GoogleMapsProvider.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -25,13 +25,13 @@  discard block
 block discarded – undo
25 25
 	 * @see \MyArtJaub\Webtrees\Map\MapProviderInterface::getProviderPlaceId()
26 26
 	 */
27 27
 	public function getProviderPlaceId(\Fisharebest\Webtrees\Place $place) {
28
-		if(!$place->isEmpty()) {
29
-			$parent = explode (',', $place->getGedcomName());
28
+		if (!$place->isEmpty()) {
29
+			$parent = explode(',', $place->getGedcomName());
30 30
 			$place_id = 0;
31
-			for ($i=0; $i<count($parent); $i++) {
31
+			for ($i = 0; $i < count($parent); $i++) {
32 32
 				$parent[$i] = trim($parent[$i]);
33
-				if (empty($parent[$i])) $parent[$i]='unknown';// GoogleMap module uses "unknown" while GEDCOM uses , ,
34
-				$pl_id=Database::prepare('SELECT pl_id FROM `##placelocation` WHERE pl_level=? AND pl_parent_id=? AND pl_place LIKE ? ORDER BY pl_place')
33
+				if (empty($parent[$i])) $parent[$i] = 'unknown'; // GoogleMap module uses "unknown" while GEDCOM uses , ,
34
+				$pl_id = Database::prepare('SELECT pl_id FROM `##placelocation` WHERE pl_level=? AND pl_parent_id=? AND pl_place LIKE ? ORDER BY pl_place')
35 35
 					->execute(array($i, $place_id, $parent[$i]))
36 36
 					->fetchOne();
37 37
 				if (empty($pl_id)) break;
@@ -47,12 +47,12 @@  discard block
 block discarded – undo
47 47
 	 * @see \MyArtJaub\Webtrees\Map\MapProviderInterface::getPlaceIcon()
48 48
 	 */
49 49
 	public function getPlaceIcon(\Fisharebest\Webtrees\Place $place) {
50
-		if(!$place->isEmpty()){
50
+		if (!$place->isEmpty()) {
51 51
 			$place_details =
52 52
 				Database::prepare("SELECT SQL_CACHE pl_icon FROM `##placelocation` WHERE pl_id=? ORDER BY pl_place")	
53 53
 				->execute(array($this->getProviderPlaceId($place)))
54 54
 				->fetchOneRow();
55
-			if($place_details){
55
+			if ($place_details) {
56 56
 				return WT_MODULES_DIR.'googlemap/'.$place_details->pl_icon;
57 57
 			}
58 58
 		}
Please login to merge, or discard this patch.
src/Webtrees/Module/IsSourcedModule.php 2 patches
Indentation   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -29,26 +29,26 @@  discard block
 block discarded – undo
29 29
 implements ModuleSidebarInterface, HookSubscriberInterface, IndividualHeaderExtender, RecordNameTextExtender
30 30
 {
31 31
     
32
-    /**
33
-     * {@inheritDoc}
34
-     * @see \Fisharebest\Webtrees\Module\AbstractModule::getTitle()
35
-     */
36
-    public function getTitle() {
37
-        return I18N::translate('Sourced events');
38
-    }
32
+	/**
33
+	 * {@inheritDoc}
34
+	 * @see \Fisharebest\Webtrees\Module\AbstractModule::getTitle()
35
+	 */
36
+	public function getTitle() {
37
+		return I18N::translate('Sourced events');
38
+	}
39 39
     
40 40
    /**
41 41
     * {@inheritDoc}
42 42
     * @see \Fisharebest\Webtrees\Module\AbstractModule::getDescription()
43 43
     */
44
-    public function getDescription() {
45
-        return I18N::translate('Indicate if events related to an record are sourced.');
46
-    }
44
+	public function getDescription() {
45
+		return I18N::translate('Indicate if events related to an record are sourced.');
46
+	}
47 47
     
48
-    /**
49
-     * {@inheritDoc}
50
-     * @see \MyArtJaub\Webtrees\Hook\HookSubscriberInterface::getSubscribedHooks()
51
-     */
48
+	/**
49
+	 * {@inheritDoc}
50
+	 * @see \MyArtJaub\Webtrees\Hook\HookSubscriberInterface::getSubscribedHooks()
51
+	 */
52 52
 	public function getSubscribedHooks() {
53 53
 		return array(
54 54
  			'hExtendIndiHeaderIcons' => 10,
@@ -61,12 +61,12 @@  discard block
 block discarded – undo
61 61
 	 * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\IndividualHeaderExtender::hExtendIndiHeaderIcons()
62 62
 	 */
63 63
 	public function hExtendIndiHeaderIcons(IndividualController $ctrlIndi) {
64
-	    if($ctrlIndi){
65
-	        $dindi = new Individual($ctrlIndi->getSignificantIndividual());
66
-	        if ($dindi->canDisplayIsSourced()) 
67
-	            return FunctionsPrint::formatIsSourcedIcon('R', $dindi->isSourced(), 'INDI', 1, 'large');
68
-	    }
69
-	    return '';
64
+		if($ctrlIndi){
65
+			$dindi = new Individual($ctrlIndi->getSignificantIndividual());
66
+			if ($dindi->canDisplayIsSourced()) 
67
+				return FunctionsPrint::formatIsSourcedIcon('R', $dindi->isSourced(), 'INDI', 1, 'large');
68
+		}
69
+		return '';
70 70
 	}
71 71
 	
72 72
 	/**
@@ -92,15 +92,15 @@  discard block
 block discarded – undo
92 92
 	 * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\RecordNameTextExtender::hRecordNameAppend()
93 93
 	 */
94 94
 	public function hRecordNameAppend(GedcomRecord $grec){
95
-	    $html = '';
96
-	    if($grec instanceof \Fisharebest\Webtrees\Individual){
97
-	        $dindi = new Individual($grec);
98
-	        $html .= FunctionsPrint::formatIsSourcedIcon('R', $dindi->isSourced(), 'INDI', 1, 'small');
99
-	        $html .= FunctionsPrint::formatIsSourcedIcon('E', $dindi->isBirthSourced(), 'BIRT', 1, 'small');
100
-	        if($grec->isDead())
101
-	            $html .= FunctionsPrint::formatIsSourcedIcon('E', $dindi->isDeathSourced(), 'DEAT', 1, 'small');
102
-	    }
103
-	    return $html;
95
+		$html = '';
96
+		if($grec instanceof \Fisharebest\Webtrees\Individual){
97
+			$dindi = new Individual($grec);
98
+			$html .= FunctionsPrint::formatIsSourcedIcon('R', $dindi->isSourced(), 'INDI', 1, 'small');
99
+			$html .= FunctionsPrint::formatIsSourcedIcon('E', $dindi->isBirthSourced(), 'BIRT', 1, 'small');
100
+			if($grec->isDead())
101
+				$html .= FunctionsPrint::formatIsSourcedIcon('E', $dindi->isDeathSourced(), 'DEAT', 1, 'small');
102
+		}
103
+		return $html;
104 104
 	}
105 105
 	
106 106
 	/**
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	 * @see \Fisharebest\Webtrees\Module\ModuleSidebarInterface::defaultSidebarOrder()
109 109
 	 */
110 110
 	public function defaultSidebarOrder() {
111
-	    return 15;
111
+		return 15;
112 112
 	}
113 113
 	
114 114
 	/**
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 	 * @see \Fisharebest\Webtrees\Module\ModuleSidebarInterface::hasSidebarContent()
117 117
 	 */
118 118
 	public function hasSidebarContent(){ 
119
-	    return true;
119
+		return true;
120 120
 	}
121 121
 	
122 122
 	/**
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 	 * @see \Fisharebest\Webtrees\Module\ModuleSidebarInterface::getSidebarAjaxContent()
125 125
 	 */
126 126
 	public function getSidebarAjaxContent() {
127
-	    return '';
127
+		return '';
128 128
 	}
129 129
 	
130 130
 	/**
@@ -132,17 +132,17 @@  discard block
 block discarded – undo
132 132
 	 * @see \Fisharebest\Webtrees\Module\ModuleSidebarInterface::getSidebarContent()
133 133
 	 */
134 134
 	public function getSidebarContent() {
135
-	    global $controller;
135
+		global $controller;
136 136
 	    
137
-	    ob_start();
138
-	    $root = $controller->getSignificantIndividual();
139
-	    if ($root) {
140
-	        $dindi = new Individual($root);
137
+		ob_start();
138
+		$root = $controller->getSignificantIndividual();
139
+		if ($root) {
140
+			$dindi = new Individual($root);
141 141
 	        	
142
-	        if (!$dindi->canDisplayIsSourced()) {
143
-	            echo '<div class="error">', I18N::translate('This information is private and cannot be shown.'), '</div>';
144
-	        } else {
145
-	            echo '
142
+			if (!$dindi->canDisplayIsSourced()) {
143
+				echo '<div class="error">', I18N::translate('This information is private and cannot be shown.'), '</div>';
144
+			} else {
145
+				echo '
146 146
 	                <table class="issourcedtable">
147 147
 	                   <tr>
148 148
 	                       <td class="slabel"> ' . GedcomTag::getLabel('INDI') . '</td>
@@ -153,35 +153,35 @@  discard block
 block discarded – undo
153 153
 	                       <td class="svalue">' . FunctionsPrint::formatIsSourcedIcon('E', $dindi->isBirthSourced(), 'BIRT', 1).'</td>
154 154
 	                   </tr>';
155 155
 	            
156
-	            $fams = $root->getSpouseFamilies();
157
-	            ($ct = count($fams)) > 1 ? $nb=1 : $nb=' ';	            
158
-	            foreach($fams as $fam){
159
-	                $dfam = new Family($fam);
160
-	                echo '
156
+				$fams = $root->getSpouseFamilies();
157
+				($ct = count($fams)) > 1 ? $nb=1 : $nb=' ';	            
158
+				foreach($fams as $fam){
159
+					$dfam = new Family($fam);
160
+					echo '
161 161
 	                    <tr>
162 162
 	                       <td class="slabel right">
163 163
 	                           <a href="' . $fam->getHtmlUrl() . '"> '. GedcomTag::getLabel('MARR');
164
-	                if($ct > 1){
165
-	                    echo ' ',$nb;
166
-	                    $nb++;
167
-	                }
168
-	                echo '     </a>
164
+					if($ct > 1){
165
+						echo ' ',$nb;
166
+						$nb++;
167
+					}
168
+					echo '     </a>
169 169
 	                       </td>
170 170
 	                       <td class="svalue">' . FunctionsPrint::formatIsSourcedIcon('E', $dfam->isMarriageSourced(), 'MARR', 1).'</td>
171 171
 	                   </tr>';
172
-	            }
172
+				}
173 173
 	            
174
-	            if( $root->isDead() )
175
-	                echo '
174
+				if( $root->isDead() )
175
+					echo '
176 176
 	                    <tr>
177 177
 	                       <td class="slabel">' . GedcomTag::getLabel('DEAT') . '</td>
178 178
 	                       <td class="svalue">' . FunctionsPrint::formatIsSourcedIcon('E', $dindi->isDeathSourced(), 'DEAT', 1).'</td>
179 179
 	                   </tr>';
180 180
 	            
181
-	            echo '</table>';
182
-	        }
183
-	    }
184
-	    return ob_get_clean();	    
181
+				echo '</table>';
182
+			}
183
+		}
184
+		return ob_get_clean();	    
185 185
 	}
186 186
 	
187 187
 	
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 	 * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\IndividualHeaderExtender::hExtendIndiHeaderIcons()
62 62
 	 */
63 63
 	public function hExtendIndiHeaderIcons(IndividualController $ctrlIndi) {
64
-	    if($ctrlIndi){
64
+	    if ($ctrlIndi) {
65 65
 	        $dindi = new Individual($ctrlIndi->getSignificantIndividual());
66 66
 	        if ($dindi->canDisplayIsSourced()) 
67 67
 	            return FunctionsPrint::formatIsSourcedIcon('R', $dindi->isSourced(), 'INDI', 1, 'large');
@@ -85,19 +85,19 @@  discard block
 block discarded – undo
85 85
 	 * {@inheritDoc}
86 86
 	 * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\RecordNameTextExtender::hRecordNamePrepend()
87 87
 	 */
88
-	public function hRecordNamePrepend(GedcomRecord $grec){ }
88
+	public function hRecordNamePrepend(GedcomRecord $grec) { }
89 89
 	
90 90
 	/**
91 91
 	 * {@inheritDoc}
92 92
 	 * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\RecordNameTextExtender::hRecordNameAppend()
93 93
 	 */
94
-	public function hRecordNameAppend(GedcomRecord $grec){
94
+	public function hRecordNameAppend(GedcomRecord $grec) {
95 95
 	    $html = '';
96
-	    if($grec instanceof \Fisharebest\Webtrees\Individual){
96
+	    if ($grec instanceof \Fisharebest\Webtrees\Individual) {
97 97
 	        $dindi = new Individual($grec);
98 98
 	        $html .= FunctionsPrint::formatIsSourcedIcon('R', $dindi->isSourced(), 'INDI', 1, 'small');
99 99
 	        $html .= FunctionsPrint::formatIsSourcedIcon('E', $dindi->isBirthSourced(), 'BIRT', 1, 'small');
100
-	        if($grec->isDead())
100
+	        if ($grec->isDead())
101 101
 	            $html .= FunctionsPrint::formatIsSourcedIcon('E', $dindi->isDeathSourced(), 'DEAT', 1, 'small');
102 102
 	    }
103 103
 	    return $html;
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 	 * {@inheritDoc}
116 116
 	 * @see \Fisharebest\Webtrees\Module\ModuleSidebarInterface::hasSidebarContent()
117 117
 	 */
118
-	public function hasSidebarContent(){ 
118
+	public function hasSidebarContent() { 
119 119
 	    return true;
120 120
 	}
121 121
 	
@@ -145,24 +145,24 @@  discard block
 block discarded – undo
145 145
 	            echo '
146 146
 	                <table class="issourcedtable">
147 147
 	                   <tr>
148
-	                       <td class="slabel"> ' . GedcomTag::getLabel('INDI') . '</td>
148
+	                       <td class="slabel"> ' . GedcomTag::getLabel('INDI').'</td>
149 149
 	                       <td class="svalue">' . FunctionsPrint::formatIsSourcedIcon('R', $dindi->isSourced(), 'INDI', 1).'</td>
150 150
 	                   </tr>
151 151
 	                   <tr>
152
-	                       <td class="slabel">' . GedcomTag::getLabel('BIRT') . '</td>
152
+	                       <td class="slabel">' . GedcomTag::getLabel('BIRT').'</td>
153 153
 	                       <td class="svalue">' . FunctionsPrint::formatIsSourcedIcon('E', $dindi->isBirthSourced(), 'BIRT', 1).'</td>
154 154
 	                   </tr>';
155 155
 	            
156 156
 	            $fams = $root->getSpouseFamilies();
157
-	            ($ct = count($fams)) > 1 ? $nb=1 : $nb=' ';	            
158
-	            foreach($fams as $fam){
157
+	            ($ct = count($fams)) > 1 ? $nb = 1 : $nb = ' ';	            
158
+	            foreach ($fams as $fam) {
159 159
 	                $dfam = new Family($fam);
160 160
 	                echo '
161 161
 	                    <tr>
162 162
 	                       <td class="slabel right">
163
-	                           <a href="' . $fam->getHtmlUrl() . '"> '. GedcomTag::getLabel('MARR');
164
-	                if($ct > 1){
165
-	                    echo ' ',$nb;
163
+	                           <a href="' . $fam->getHtmlUrl().'"> '.GedcomTag::getLabel('MARR');
164
+	                if ($ct > 1) {
165
+	                    echo ' ', $nb;
166 166
 	                    $nb++;
167 167
 	                }
168 168
 	                echo '     </a>
@@ -171,10 +171,10 @@  discard block
 block discarded – undo
171 171
 	                   </tr>';
172 172
 	            }
173 173
 	            
174
-	            if( $root->isDead() )
174
+	            if ($root->isDead())
175 175
 	                echo '
176 176
 	                    <tr>
177
-	                       <td class="slabel">' . GedcomTag::getLabel('DEAT') . '</td>
177
+	                       <td class="slabel">' . GedcomTag::getLabel('DEAT').'</td>
178 178
 	                       <td class="svalue">' . FunctionsPrint::formatIsSourcedIcon('E', $dindi->isDeathSourced(), 'DEAT', 1).'</td>
179 179
 	                   </tr>';
180 180
 	            
Please login to merge, or discard this patch.
src/Webtrees/Module/AdminTasksModule.php 2 patches
Indentation   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -23,61 +23,61 @@  discard block
 block discarded – undo
23 23
 class AdminTasksModule extends AbstractModule 
24 24
 implements ModuleConfigInterface, ModuleBlockInterface
25 25
 {
26
-    // How to update the database schema for this module
27
-    const SCHEMA_TARGET_VERSION   = 1;
28
-    const SCHEMA_SETTING_NAME     = 'MAJ_ADMTASKS_SCHEMA_VERSION';
29
-    const SCHEMA_MIGRATION_PREFIX = '\MyArtJaub\Webtrees\Module\AdminTasks\Schema';
26
+	// How to update the database schema for this module
27
+	const SCHEMA_TARGET_VERSION   = 1;
28
+	const SCHEMA_SETTING_NAME     = 'MAJ_ADMTASKS_SCHEMA_VERSION';
29
+	const SCHEMA_MIGRATION_PREFIX = '\MyArtJaub\Webtrees\Module\AdminTasks\Schema';
30 30
     
31
-    /**
32
-     * Admin Task provider
33
-     * @var \MyArtJaub\Webtrees\Module\AdminTasks\Model\TaskProviderInterface $provider
34
-     */
35
-    protected $provider;
31
+	/**
32
+	 * Admin Task provider
33
+	 * @var \MyArtJaub\Webtrees\Module\AdminTasks\Model\TaskProviderInterface $provider
34
+	 */
35
+	protected $provider;
36 36
     
37
-    /**
38
-     * {@inheritDoc}
39
-     * @see \Fisharebest\Webtrees\Module\AbstractModule::getTitle()
40
-     */
41
-    public function getTitle() {
42
-        return I18N::translate('Administration Tasks');
43
-    }
37
+	/**
38
+	 * {@inheritDoc}
39
+	 * @see \Fisharebest\Webtrees\Module\AbstractModule::getTitle()
40
+	 */
41
+	public function getTitle() {
42
+		return I18N::translate('Administration Tasks');
43
+	}
44 44
     
45 45
    /**
46 46
     * {@inheritDoc}
47 47
     * @see \Fisharebest\Webtrees\Module\AbstractModule::getDescription()
48 48
     */
49
-    public function getDescription() {
50
-        return I18N::translate('Manage and run nearly-scheduled administration tasks.');
51
-    }
49
+	public function getDescription() {
50
+		return I18N::translate('Manage and run nearly-scheduled administration tasks.');
51
+	}
52 52
     
53
-    /**
54
-     * {@inheritDoc}
55
-     * @see \Fisharebest\Webtrees\Module\AbstractModule::modAction()
56
-     */
57
-    public function modAction($mod_action) {
58
-        Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION);
53
+	/**
54
+	 * {@inheritDoc}
55
+	 * @see \Fisharebest\Webtrees\Module\AbstractModule::modAction()
56
+	 */
57
+	public function modAction($mod_action) {
58
+		Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION);
59 59
                 
60
-        \MyArtJaub\Webtrees\Mvc\Dispatcher::getInstance()->handle($this, $mod_action);
61
-    }
60
+		\MyArtJaub\Webtrees\Mvc\Dispatcher::getInstance()->handle($this, $mod_action);
61
+	}
62 62
     
63
-    /**
64
-     * {@inheritDoc}
65
-     * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink()
66
-     */
67
-    public function getConfigLink() {
68
-        Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION);
63
+	/**
64
+	 * {@inheritDoc}
65
+	 * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink()
66
+	 */
67
+	public function getConfigLink() {
68
+		Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION);
69 69
         
70
-        return 'module.php?mod=' . $this->getName() . '&amp;mod_action=AdminConfig';
71
-    }
70
+		return 'module.php?mod=' . $this->getName() . '&amp;mod_action=AdminConfig';
71
+	}
72 72
     
73
-    /**
74
-     * {@inheritDoc}
75
-     * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::getBlock()
76
-     */
77
-    public function getBlock($block_id, $template = true, $cfg = array()) {
78
-        global $controller;
73
+	/**
74
+	 * {@inheritDoc}
75
+	 * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::getBlock()
76
+	 */
77
+	public function getBlock($block_id, $template = true, $cfg = array()) {
78
+		global $controller;
79 79
         
80
-        $controller->addInlineJavascript('
80
+		$controller->addInlineJavascript('
81 81
 			$(document).ready(function(){
82 82
 				$.ajax({
83 83
 					url: "module.php",
@@ -88,60 +88,60 @@  discard block
 block discarded – undo
88 88
 				});
89 89
 			});
90 90
 		');
91
-        return '';
92
-    }
91
+		return '';
92
+	}
93 93
     
94
-    /**
95
-     * {@inheritDoc}
96
-     * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::loadAjax()
97
-     */
98
-    public function loadAjax() {
99
-        return false;
100
-    }
94
+	/**
95
+	 * {@inheritDoc}
96
+	 * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::loadAjax()
97
+	 */
98
+	public function loadAjax() {
99
+		return false;
100
+	}
101 101
     
102
-    /**
103
-     * {@inheritDoc}
104
-     * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::isGedcomBlock()
105
-     */
106
-    public function isGedcomBlock() {
107
-        return true;
108
-    }
102
+	/**
103
+	 * {@inheritDoc}
104
+	 * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::isGedcomBlock()
105
+	 */
106
+	public function isGedcomBlock() {
107
+		return true;
108
+	}
109 109
     
110
-    /**
111
-     * {@inheritDoc}
112
-     * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::isUserBlock()
113
-     */
114
-    public function isUserBlock() {
115
-        return false;
116
-    }
110
+	/**
111
+	 * {@inheritDoc}
112
+	 * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::isUserBlock()
113
+	 */
114
+	public function isUserBlock() {
115
+		return false;
116
+	}
117 117
     
118
-    /**
119
-     * {@inheritDoc}
120
-     * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::configureBlock()
121
-     */
122
-    public function configureBlock($block_id) {
118
+	/**
119
+	 * {@inheritDoc}
120
+	 * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::configureBlock()
121
+	 */
122
+	public function configureBlock($block_id) {
123 123
         
124
-    }
124
+	}
125 125
    
126 126
 /**
127
-	 * Get the Admin Tasks Provider (initialise it if not done yet).
128
-	 *
129
-	 * @return \MyArtJaub\Webtrees\Module\AdminTasks\Model\TaskProviderInterface
130
-	 */
131
-    public function getProvider() {        
132
-        if(!$this->provider) {
133
-            $this->provider = new TaskProvider(WT_ROOT.WT_MODULES_DIR.$this->getName().'/tasks/');
134
-        }
135
-        return $this->provider;
136
-    }
127
+ * Get the Admin Tasks Provider (initialise it if not done yet).
128
+ *
129
+ * @return \MyArtJaub\Webtrees\Module\AdminTasks\Model\TaskProviderInterface
130
+ */
131
+	public function getProvider() {        
132
+		if(!$this->provider) {
133
+			$this->provider = new TaskProvider(WT_ROOT.WT_MODULES_DIR.$this->getName().'/tasks/');
134
+		}
135
+		return $this->provider;
136
+	}
137 137
 	
138 138
 	/**
139 139
 	 * Set the Admin Tasks Provider.
140 140
 	 *
141 141
 	 * @return \MyArtJaub\Webtrees\Module\GeoDispersion\Model\TaskProviderInterface
142 142
 	 */
143
-    public function setProvider(TaskProviderInterface $provider) {
144
-        $this->provider = $provider;
145
-    }
143
+	public function setProvider(TaskProviderInterface $provider) {
144
+		$this->provider = $provider;
145
+	}
146 146
 }
147 147
  
148 148
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
     public function getConfigLink() {
68 68
         Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION);
69 69
         
70
-        return 'module.php?mod=' . $this->getName() . '&amp;mod_action=AdminConfig';
70
+        return 'module.php?mod='.$this->getName().'&amp;mod_action=AdminConfig';
71 71
     }
72 72
     
73 73
     /**
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 	 * @return \MyArtJaub\Webtrees\Module\AdminTasks\Model\TaskProviderInterface
130 130
 	 */
131 131
     public function getProvider() {        
132
-        if(!$this->provider) {
132
+        if (!$this->provider) {
133 133
             $this->provider = new TaskProvider(WT_ROOT.WT_MODULES_DIR.$this->getName().'/tasks/');
134 134
         }
135 135
         return $this->provider;
Please login to merge, or discard this patch.
src/Webtrees/Module/ModuleMenuItemInterface.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -15,11 +15,11 @@
 block discarded – undo
15 15
  */
16 16
 interface ModuleMenuItemInterface
17 17
 {
18
-    /**
19
-     * Returns a menu item for the module.
20
-     * 
21
-     * @param \Fisharebest\Webtrees\Tree|null $tree
22
-     * @param mixed $reference
23
-     */
24
-    public function getMenu(\Fisharebest\Webtrees\Tree $tree, $reference);
18
+	/**
19
+	 * Returns a menu item for the module.
20
+	 * 
21
+	 * @param \Fisharebest\Webtrees\Tree|null $tree
22
+	 * @param mixed $reference
23
+	 */
24
+	public function getMenu(\Fisharebest\Webtrees\Tree $tree, $reference);
25 25
 }
26 26
\ No newline at end of file
Please login to merge, or discard this patch.
src/Webtrees/Module/AdminTasks/TaskController.php 2 patches
Indentation   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -35,25 +35,25 @@  discard block
 block discarded – undo
35 35
  */
36 36
 class TaskController extends MvcController
37 37
 {    
38
-    /**
39
-     * Tasks Provider
40
-     * @var TaskProviderInterface $provider
41
-     */
42
-    protected $provider;    
38
+	/**
39
+	 * Tasks Provider
40
+	 * @var TaskProviderInterface $provider
41
+	 */
42
+	protected $provider;    
43 43
     
44
-    /**
45
-     * Constructor for Admin Config controller
46
-     * @param AbstractModule $module
47
-     */
48
-    public function __construct(AbstractModule $module) {
49
-        parent::__construct($module);
44
+	/**
45
+	 * Constructor for Admin Config controller
46
+	 * @param AbstractModule $module
47
+	 */
48
+	public function __construct(AbstractModule $module) {
49
+		parent::__construct($module);
50 50
         
51
-        $this->provider = $this->module->getProvider();
52
-    }    
51
+		$this->provider = $this->module->getProvider();
52
+	}    
53 53
     
54
-    /**
55
-     * Pages
56
-     */        
54
+	/**
55
+	 * Pages
56
+	 */        
57 57
 	
58 58
 	/**
59 59
 	 * Task@trigger
@@ -77,35 +77,35 @@  discard block
 block discarded – undo
77 77
 	/**
78 78
 	 * Task@setStatus
79 79
 	 */
80
-    public function setStatus() {          
81
-        $controller = new JsonController();
80
+	public function setStatus() {          
81
+		$controller = new JsonController();
82 82
         
83
-        $task_name = Filter::get('task');
84
-        $task = $this->provider->getTask($task_name, false);
83
+		$task_name = Filter::get('task');
84
+		$task = $this->provider->getTask($task_name, false);
85 85
         
86
-        $controller->restrictAccess(
87
-            true // Filter::checkCsrf()   -- Cannot use CSRF on a GET request (modules can only work with GET requests)
88
-            &&  Auth::isAdmin() 
89
-            && $task
90
-        );
86
+		$controller->restrictAccess(
87
+			true // Filter::checkCsrf()   -- Cannot use CSRF on a GET request (modules can only work with GET requests)
88
+			&&  Auth::isAdmin() 
89
+			&& $task
90
+		);
91 91
         
92
-        $status = Filter::getBool('status');
93
-        $res = array('task' => $task->getName() , 'error' => null);
94
-        try{
95
-            $this->provider->setTaskStatus($task, $status);
96
-            $res['status'] = $status;
92
+		$status = Filter::getBool('status');
93
+		$res = array('task' => $task->getName() , 'error' => null);
94
+		try{
95
+			$this->provider->setTaskStatus($task, $status);
96
+			$res['status'] = $status;
97 97
 			Log::addConfigurationLog('Module '.$this->module->getName().' : Admin Task "'.$task->getName().'" has been '. ($status ? 'enabled' : 'disabled') .'.');
98
-        }
99
-        catch (\Exception $ex) {
100
-            $res['error'] = $ex->getMessage();
98
+		}
99
+		catch (\Exception $ex) {
100
+			$res['error'] = $ex->getMessage();
101 101
 			Log::addErrorLog('Module '.$this->module->getName().' : Admin Task "'.$task->getName().'" could not be ' . ($status ? 'enabled' : 'disabled') .'. Error: '. $ex->getMessage());
102
-        }
102
+		}
103 103
         
104
-        $controller->pageHeader();
105
-        if($res['error']) http_response_code(500);
104
+		$controller->pageHeader();
105
+		if($res['error']) http_response_code(500);
106 106
         
107
-        echo \Zend_Json::encode($res);
108
-    }
107
+		echo \Zend_Json::encode($res);
108
+	}
109 109
 	
110 110
 	/**
111 111
 	 * Task@edit
@@ -113,15 +113,15 @@  discard block
 block discarded – undo
113 113
 	public function edit() {
114 114
 		global $WT_TREE;
115 115
         		
116
-        $task_name = Filter::get('task');
117
-        $task = $this->provider->getTask($task_name, false);
116
+		$task_name = Filter::get('task');
117
+		$task = $this->provider->getTask($task_name, false);
118 118
 		
119
-        Theme::theme(new AdministrationTheme)->init($WT_TREE);
120
-        $controller = new PageController();        
121
-        $controller
122
-            ->restrictAccess(Auth::isAdmin() && $task)
119
+		Theme::theme(new AdministrationTheme)->init($WT_TREE);
120
+		$controller = new PageController();        
121
+		$controller
122
+			->restrictAccess(Auth::isAdmin() && $task)
123 123
 			->setPageTitle(I18N::translate('Edit the administrative task'))
124
-            ->addInlineJavascript('
124
+			->addInlineJavascript('
125 125
                 function toggleRemainingOccurrences() {
126 126
                     if($("input:radio[name=\'is_limited\']:checked").val() == 1) {
127 127
                         $("#nb_occurences").show();
@@ -134,39 +134,39 @@  discard block
 block discarded – undo
134 134
                 $("[name=\'is_limited\']").on("change", toggleRemainingOccurrences);
135 135
                 toggleRemainingOccurrences();
136 136
             ')
137
-        ;
137
+		;
138 138
         
139 139
         
140
-        $data = new ViewBag();        
141
-        $data->set('title', $controller->getPageTitle());
140
+		$data = new ViewBag();        
141
+		$data->set('title', $controller->getPageTitle());
142 142
 		$data->set('admin_config_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig&ged=' . $WT_TREE->getNameUrl());
143
-        $data->set('module_title', $this->module->getTitle());
143
+		$data->set('module_title', $this->module->getTitle());
144 144
 		$data->set('save_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=Task@save&ged=' . $WT_TREE->getNameUrl());
145 145
 		$data->set('task', $task);
146 146
 		    
147
-        ViewFactory::make('TaskEdit', $this, $controller, $data)->render();	
147
+		ViewFactory::make('TaskEdit', $this, $controller, $data)->render();	
148 148
 	}	
149 149
 	
150 150
 	/**
151 151
 	 * Task@save
152 152
 	 */
153 153
 	public function save() {		
154
-        $tmp_contrl = new PageController();
154
+		$tmp_contrl = new PageController();
155 155
 				
156
-        $tmp_contrl->restrictAccess(
157
-            Auth::isAdmin() 
158
-            && Filter::checkCsrf()
159
-         );
156
+		$tmp_contrl->restrictAccess(
157
+			Auth::isAdmin() 
158
+			&& Filter::checkCsrf()
159
+		 );
160 160
         
161 161
 		$task_name      = Filter::post('task');
162
-        $frequency    	= Filter::postInteger('frequency');
163
-        $is_limited  	= Filter::postInteger('is_limited', 0, 1);
164
-        $nb_occur       = Filter::postInteger('nb_occur');
162
+		$frequency    	= Filter::postInteger('frequency');
163
+		$is_limited  	= Filter::postInteger('is_limited', 0, 1);
164
+		$nb_occur       = Filter::postInteger('nb_occur');
165 165
 				
166 166
 		$task = $this->provider->getTask($task_name, false);
167 167
         
168
-        $success = false; 
169
-        if($task) {
168
+		$success = false; 
169
+		if($task) {
170 170
 			$task->setFrequency($frequency);
171 171
 			if($is_limited == 1) {
172 172
 				$task->setRemainingOccurrences($nb_occur);
@@ -198,13 +198,13 @@  discard block
 block discarded – undo
198 198
 				Log::addConfigurationLog('Module '.$this->module->getName().' : AdminTask “'. $task->getName() .'” could not be updated. See error log.');
199 199
 			}
200 200
 			
201
-        }
201
+		}
202 202
         
203
-        $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig';
204
-        if(!$success) {
203
+		$redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig';
204
+		if(!$success) {
205 205
 			$redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=Task@edit&task='. $task->getName();
206
-        }        
207
-        header('Location: ' . WT_BASE_URL . $redirection_url);
206
+		}        
207
+		header('Location: ' . WT_BASE_URL . $redirection_url);
208 208
 	}
209 209
      
210 210
 }
211 211
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 		
70 70
 		$tasks = $this->provider->getTasksToRun($token == $token_submitted, $task_name);
71 71
 		
72
-		foreach($tasks as $task) {
72
+		foreach ($tasks as $task) {
73 73
 			$task->execute();		
74 74
 		}
75 75
 	}	
@@ -90,19 +90,19 @@  discard block
 block discarded – undo
90 90
         );
91 91
         
92 92
         $status = Filter::getBool('status');
93
-        $res = array('task' => $task->getName() , 'error' => null);
94
-        try{
93
+        $res = array('task' => $task->getName(), 'error' => null);
94
+        try {
95 95
             $this->provider->setTaskStatus($task, $status);
96 96
             $res['status'] = $status;
97
-			Log::addConfigurationLog('Module '.$this->module->getName().' : Admin Task "'.$task->getName().'" has been '. ($status ? 'enabled' : 'disabled') .'.');
97
+			Log::addConfigurationLog('Module '.$this->module->getName().' : Admin Task "'.$task->getName().'" has been '.($status ? 'enabled' : 'disabled').'.');
98 98
         }
99 99
         catch (\Exception $ex) {
100 100
             $res['error'] = $ex->getMessage();
101
-			Log::addErrorLog('Module '.$this->module->getName().' : Admin Task "'.$task->getName().'" could not be ' . ($status ? 'enabled' : 'disabled') .'. Error: '. $ex->getMessage());
101
+			Log::addErrorLog('Module '.$this->module->getName().' : Admin Task "'.$task->getName().'" could not be '.($status ? 'enabled' : 'disabled').'. Error: '.$ex->getMessage());
102 102
         }
103 103
         
104 104
         $controller->pageHeader();
105
-        if($res['error']) http_response_code(500);
105
+        if ($res['error']) http_response_code(500);
106 106
         
107 107
         echo \Zend_Json::encode($res);
108 108
     }
@@ -139,9 +139,9 @@  discard block
 block discarded – undo
139 139
         
140 140
         $data = new ViewBag();        
141 141
         $data->set('title', $controller->getPageTitle());
142
-		$data->set('admin_config_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig&ged=' . $WT_TREE->getNameUrl());
142
+		$data->set('admin_config_url', 'module.php?mod='.$this->module->getName().'&mod_action=AdminConfig&ged='.$WT_TREE->getNameUrl());
143 143
         $data->set('module_title', $this->module->getTitle());
144
-		$data->set('save_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=Task@save&ged=' . $WT_TREE->getNameUrl());
144
+		$data->set('save_url', 'module.php?mod='.$this->module->getName().'&mod_action=Task@save&ged='.$WT_TREE->getNameUrl());
145 145
 		$data->set('task', $task);
146 146
 		    
147 147
         ViewFactory::make('TaskEdit', $this, $controller, $data)->render();	
@@ -158,17 +158,17 @@  discard block
 block discarded – undo
158 158
             && Filter::checkCsrf()
159 159
          );
160 160
         
161
-		$task_name      = Filter::post('task');
162
-        $frequency    	= Filter::postInteger('frequency');
163
-        $is_limited  	= Filter::postInteger('is_limited', 0, 1);
164
-        $nb_occur       = Filter::postInteger('nb_occur');
161
+		$task_name = Filter::post('task');
162
+        $frequency = Filter::postInteger('frequency');
163
+        $is_limited = Filter::postInteger('is_limited', 0, 1);
164
+        $nb_occur = Filter::postInteger('nb_occur');
165 165
 				
166 166
 		$task = $this->provider->getTask($task_name, false);
167 167
         
168 168
         $success = false; 
169
-        if($task) {
169
+        if ($task) {
170 170
 			$task->setFrequency($frequency);
171
-			if($is_limited == 1) {
171
+			if ($is_limited == 1) {
172 172
 				$task->setRemainingOccurrences($nb_occur);
173 173
 			}
174 174
 			else {
@@ -177,34 +177,34 @@  discard block
 block discarded – undo
177 177
 			
178 178
 			$res = $task->save();
179 179
 						
180
-			if($res) {						
181
-				if($task instanceof MyArtJaub\Webtrees\Module\AdminTasks\Model\ConfigurableTaskInterface) {
180
+			if ($res) {						
181
+				if ($task instanceof MyArtJaub\Webtrees\Module\AdminTasks\Model\ConfigurableTaskInterface) {
182 182
 					$res = $task->saveConfig();
183 183
 					
184
-					if(!$res) {
184
+					if (!$res) {
185 185
 						FlashMessages::addMessage(I18N::translate('An error occured while updating the specific settings of administrative task “%s”', $task->getTitle()), 'danger');
186
-						Log::addConfigurationLog('Module '.$this->module->getName().' : AdminTask “'. $task->getName() .'” specific settings could not be updated. See error log.');
186
+						Log::addConfigurationLog('Module '.$this->module->getName().' : AdminTask “'.$task->getName().'” specific settings could not be updated. See error log.');
187 187
 					}
188 188
 				}
189 189
 			
190
-				if($res) {
190
+				if ($res) {
191 191
 					FlashMessages::addMessage(I18N::translate('The administrative task “%s” has been successfully updated', $task->getTitle()), 'success');
192
-					Log::addConfigurationLog('Module '.$this->module->getName().' : AdminTask “'.$task->getName() .'” has been updated.');
192
+					Log::addConfigurationLog('Module '.$this->module->getName().' : AdminTask “'.$task->getName().'” has been updated.');
193 193
 					$success = true;
194 194
 				}
195 195
 			}
196 196
 			else {
197 197
 				FlashMessages::addMessage(I18N::translate('An error occured while updating the administrative task “%s”', $task->getTitle()), 'danger');
198
-				Log::addConfigurationLog('Module '.$this->module->getName().' : AdminTask “'. $task->getName() .'” could not be updated. See error log.');
198
+				Log::addConfigurationLog('Module '.$this->module->getName().' : AdminTask “'.$task->getName().'” could not be updated. See error log.');
199 199
 			}
200 200
 			
201 201
         }
202 202
         
203
-        $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig';
204
-        if(!$success) {
205
-			$redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=Task@edit&task='. $task->getName();
203
+        $redirection_url = 'module.php?mod='.$this->module->getName().'&mod_action=AdminConfig';
204
+        if (!$success) {
205
+			$redirection_url = 'module.php?mod='.$this->module->getName().'&mod_action=Task@edit&task='.$task->getName();
206 206
         }        
207
-        header('Location: ' . WT_BASE_URL . $redirection_url);
207
+        header('Location: '.WT_BASE_URL.$redirection_url);
208 208
 	}
209 209
      
210 210
 }
211 211
\ No newline at end of file
Please login to merge, or discard this patch.
src/Webtrees/Module/AdminTasks/Model/AbstractTask.php 2 patches
Indentation   +195 added lines, -195 removed lines patch added patch discarded remove patch
@@ -21,254 +21,254 @@
 block discarded – undo
21 21
  */
22 22
 abstract class AbstractTask {
23 23
     
24
-    /**
25
-     * Time out for runnign tasks, in seconds. Default 5 min
26
-     * @var int TASK_TIME_OUT
27
-     */
28
-    const TASK_TIME_OUT = 300;
24
+	/**
25
+	 * Time out for runnign tasks, in seconds. Default 5 min
26
+	 * @var int TASK_TIME_OUT
27
+	 */
28
+	const TASK_TIME_OUT = 300;
29 29
               
30
-    /**
31
-     * Task provider
32
-     * @var TaskProviderInterface $provider
33
-     */
30
+	/**
31
+	 * Task provider
32
+	 * @var TaskProviderInterface $provider
33
+	 */
34 34
 	protected $provider;
35 35
 			
36 36
 	/**
37 37
 	 * Task name
38 38
 	 * @var string $name
39 39
 	 */
40
-    protected $name;
40
+	protected $name;
41 41
     
42
-    /**
43
-     * Status of the task
44
-     * @var bool $is_enabled
45
-     */
46
-    protected $is_enabled;
42
+	/**
43
+	 * Status of the task
44
+	 * @var bool $is_enabled
45
+	 */
46
+	protected $is_enabled;
47 47
     
48
-    /**
49
-     * Last updated date
50
-     * @var \DateTime $last_updated
51
-     */
52
-    protected $last_updated;
48
+	/**
49
+	 * Last updated date
50
+	 * @var \DateTime $last_updated
51
+	 */
52
+	protected $last_updated;
53 53
     
54
-    /**
55
-     * Last run result
56
-     * @var bool $last_result
57
-     */
58
-    protected $last_result;
54
+	/**
55
+	 * Last run result
56
+	 * @var bool $last_result
57
+	 */
58
+	protected $last_result;
59 59
     
60
-    /**
61
-     * Task run frequency
62
-     * @var int $frequency
63
-     */
64
-    protected $frequency;
60
+	/**
61
+	 * Task run frequency
62
+	 * @var int $frequency
63
+	 */
64
+	protected $frequency;
65 65
     
66
-    /**
67
-     * Task remaining runs
68
-     * @var int $nb_occurrences
69
-     */
70
-    protected $nb_occurrences;
66
+	/**
67
+	 * Task remaining runs
68
+	 * @var int $nb_occurrences
69
+	 */
70
+	protected $nb_occurrences;
71 71
     
72
-    /**
73
-     * Current running status of the task
74
-     * @var bool $is_running
75
-     */
76
-    protected $is_running;
72
+	/**
73
+	 * Current running status of the task
74
+	 * @var bool $is_running
75
+	 */
76
+	protected $is_running;
77 77
     
78
-    /**
79
-     * Constructor for the Admin task class
78
+	/**
79
+	 * Constructor for the Admin task class
80 80
 	 *
81 81
 	 * @param string $file Filename containing the task object
82 82
 	 * @param TaskProviderInterface $provider Provider for tasks
83
-     */
84
-    public function __construct($file, TaskProviderInterface $provider = null){
85
-        $this->name = trim(basename($file, '.php'));
83
+	 */
84
+	public function __construct($file, TaskProviderInterface $provider = null){
85
+		$this->name = trim(basename($file, '.php'));
86 86
 		$this->provider = $provider;
87
-    }
87
+	}
88 88
     
89
-    /**
90
-     * Get the provider.
91
-     *
92
-     * @return TaskProviderInterface 
93
-     */
94
-    public function getProvider(){
95
-        return $this->provider;
96
-    }
89
+	/**
90
+	 * Get the provider.
91
+	 *
92
+	 * @return TaskProviderInterface 
93
+	 */
94
+	public function getProvider(){
95
+		return $this->provider;
96
+	}
97 97
     
98
-    /**
99
-     * Set the provider.
100
-     *
101
-     * @param TaskProviderInterface $provider
102
-     * @return self Enable method-chaining
103
-     */
104
-    public function setProvider(TaskProviderInterface $provider){
105
-        $this->provider = $provider;
106
-        return $this;
107
-    }
98
+	/**
99
+	 * Set the provider.
100
+	 *
101
+	 * @param TaskProviderInterface $provider
102
+	 * @return self Enable method-chaining
103
+	 */
104
+	public function setProvider(TaskProviderInterface $provider){
105
+		$this->provider = $provider;
106
+		return $this;
107
+	}
108 108
     
109
-    /**
110
-     * Set parameters of the Task
111
-     *
112
-     * @param bool $is_enabled Status of the task
113
-     * @param \DateTime $lastupdated Time of the last task run
114
-     * @param bool $last_result Result of the last run, true for success, false for failure
115
-     * @param int $frequency Frequency of execution in minutes
116
-     * @param int $nb_occur Number of remaining occurrences, 0 for tasks not limited
117
-     * @param bool $is_running Indicates if the task is currently running
118
-     */
119
-    public function setParameters($is_enabled, \DateTime $last_updated, $last_result, $frequency, $nb_occur, $is_running){
120
-        $this->is_enabled = $is_enabled;
121
-        $this->last_updated = $last_updated;
122
-        $this->last_result = $last_result;
123
-        $this->frequency = $frequency;
124
-        $this->nb_occurrences = $nb_occur;
125
-        $this->is_running = $is_running;
126
-    }
109
+	/**
110
+	 * Set parameters of the Task
111
+	 *
112
+	 * @param bool $is_enabled Status of the task
113
+	 * @param \DateTime $lastupdated Time of the last task run
114
+	 * @param bool $last_result Result of the last run, true for success, false for failure
115
+	 * @param int $frequency Frequency of execution in minutes
116
+	 * @param int $nb_occur Number of remaining occurrences, 0 for tasks not limited
117
+	 * @param bool $is_running Indicates if the task is currently running
118
+	 */
119
+	public function setParameters($is_enabled, \DateTime $last_updated, $last_result, $frequency, $nb_occur, $is_running){
120
+		$this->is_enabled = $is_enabled;
121
+		$this->last_updated = $last_updated;
122
+		$this->last_result = $last_result;
123
+		$this->frequency = $frequency;
124
+		$this->nb_occurrences = $nb_occur;
125
+		$this->is_running = $is_running;
126
+	}
127 127
     
128
-    /**
129
-     * Get the name of the task
130
-     *
131
-     * @return string
132
-     */
133
-    public function getName(){
134
-        return $this->name;
135
-    }
128
+	/**
129
+	 * Get the name of the task
130
+	 *
131
+	 * @return string
132
+	 */
133
+	public function getName(){
134
+		return $this->name;
135
+	}
136 136
     
137 137
     
138
-    /**
139
-     * Return the status of the task in a boolean way
140
-     *
141
-     * @return boolean True if enabled
142
-     */
143
-    public function isEnabled(){
144
-        return $this->is_enabled;
145
-    }
138
+	/**
139
+	 * Return the status of the task in a boolean way
140
+	 *
141
+	 * @return boolean True if enabled
142
+	 */
143
+	public function isEnabled(){
144
+		return $this->is_enabled;
145
+	}
146 146
     
147
-    /**
148
-     * Get the last updated time.
149
-     *
150
-     * @return \DateTime
151
-     */
152
-    public function getLastUpdated(){
153
-        return $this->last_updated;
154
-    }
147
+	/**
148
+	 * Get the last updated time.
149
+	 *
150
+	 * @return \DateTime
151
+	 */
152
+	public function getLastUpdated(){
153
+		return $this->last_updated;
154
+	}
155 155
     
156
-    /**
157
-     * Check if the last result has been successful.
158
-     *
159
-     * @return bool
160
-     */
161
-    public function isLastRunSuccess(){
162
-        return $this->last_result;
163
-    }
156
+	/**
157
+	 * Check if the last result has been successful.
158
+	 *
159
+	 * @return bool
160
+	 */
161
+	public function isLastRunSuccess(){
162
+		return $this->last_result;
163
+	}
164 164
     
165
-    /**
166
-     * Get the task frequency.
167
-     *
168
-     * @return int
169
-     */
170
-    public function getFrequency(){
171
-        return $this->frequency;
172
-    }
165
+	/**
166
+	 * Get the task frequency.
167
+	 *
168
+	 * @return int
169
+	 */
170
+	public function getFrequency(){
171
+		return $this->frequency;
172
+	}
173 173
 	
174 174
 	/**
175
-     * Set the task frequency.
176
-     *
175
+	 * Set the task frequency.
176
+	 *
177 177
 	 * @param int $frequency
178
-     * @return self Enable method-chaining
179
-     */
180
-    public function setFrequency($frequency){
181
-        $this->frequency = $frequency;
178
+	 * @return self Enable method-chaining
179
+	 */
180
+	public function setFrequency($frequency){
181
+		$this->frequency = $frequency;
182 182
 		return $this;
183
-    }
183
+	}
184 184
     
185
-    /**
186
-     * Get the number of remaining occurrences.
187
-     *
188
-     * @return int
189
-     */
190
-    public function getRemainingOccurrences(){
191
-        return $this->nb_occurrences;
192
-    }
185
+	/**
186
+	 * Get the number of remaining occurrences.
187
+	 *
188
+	 * @return int
189
+	 */
190
+	public function getRemainingOccurrences(){
191
+		return $this->nb_occurrences;
192
+	}
193 193
 	
194 194
 	/**
195
-     * Set the number of remaining occurrences.
196
-     *
195
+	 * Set the number of remaining occurrences.
196
+	 *
197 197
 	 * @param int $nb_occur
198
-     * @return self Enable method-chaining
199
-     */
200
-    public function setRemainingOccurrences($nb_occur){
201
-        $this->nb_occurrences = $nb_occur;
198
+	 * @return self Enable method-chaining
199
+	 */
200
+	public function setRemainingOccurrences($nb_occur){
201
+		$this->nb_occurrences = $nb_occur;
202 202
 		return $this;
203
-    }
203
+	}
204 204
     
205
-    /**
206
-     * Check if the task if running.
207
-     *
208
-     * @return bool
209
-     */
210
-    public function isRunning(){
211
-        return $this->is_running;
212
-    }
205
+	/**
206
+	 * Check if the task if running.
207
+	 *
208
+	 * @return bool
209
+	 */
210
+	public function isRunning(){
211
+		return $this->is_running;
212
+	}
213 213
     
214 214
     
215
-    /**
216
-     * Return the name to display for the task
217
-     *
218
-     * @return string Title for the task
219
-     */
220
-    abstract public function getTitle();
215
+	/**
216
+	 * Return the name to display for the task
217
+	 *
218
+	 * @return string Title for the task
219
+	 */
220
+	abstract public function getTitle();
221 221
     
222
-    /**
223
-     * Return the default frequency for the execution of the task
224
-     *
225
-     * @return int Frequency for the execution of the task
226
-     */
227
-    abstract public function getDefaultFrequency();
222
+	/**
223
+	 * Return the default frequency for the execution of the task
224
+	 *
225
+	 * @return int Frequency for the execution of the task
226
+	 */
227
+	abstract public function getDefaultFrequency();
228 228
     
229
-    /**
230
-     * Execute the task's actions
231
-     */
232
-    abstract protected function executeSteps();
229
+	/**
230
+	 * Execute the task's actions
231
+	 */
232
+	abstract protected function executeSteps();
233 233
     
234 234
 	/**
235 235
 	 * Persist task state into database.
236 236
 	 * @return bool
237 237
 	 */
238 238
 	public function save() {
239
-	    if(!$this->provider) throw new \Exception('The task has not been initialised with a provider.');
239
+		if(!$this->provider) throw new \Exception('The task has not been initialised with a provider.');
240 240
 		return $this->provider->updateTask($this);
241 241
 	}
242 242
 	
243
-    /**
244
-     * Execute the task, default skeleton
245
-     *
246
-     */
247
-    public function execute(){
243
+	/**
244
+	 * Execute the task, default skeleton
245
+	 *
246
+	 */
247
+	public function execute(){
248 248
     
249
-        if($this->last_updated->add(new \DateInterval('PT'.self::TASK_TIME_OUT.'S')) < new \DateTime())
250
-            $this->is_running = false;
249
+		if($this->last_updated->add(new \DateInterval('PT'.self::TASK_TIME_OUT.'S')) < new \DateTime())
250
+			$this->is_running = false;
251 251
     
252
-        if(!$this->is_running){  //TODO put in place a time_out for running...
253
-            //TODO Log the executions in the logs
254
-            $this->last_result = false;
255
-            $this->is_running = true;
256
-            $this->save();
252
+		if(!$this->is_running){  //TODO put in place a time_out for running...
253
+			//TODO Log the executions in the logs
254
+			$this->last_result = false;
255
+			$this->is_running = true;
256
+			$this->save();
257 257
     
258
-            Log::addDebugLog('Start execution of Admin task: '.$this->getTitle());
259
-            $this->last_result = $this->executeSteps();
260
-            if($this->last_result){
261
-                $this->last_updated = new \DateTime();
262
-                if($this->nb_occurrences > 0){
263
-                    $this->nb_occurrences--;
264
-                    if($this->nb_occurrences == 0) $this->is_enabled = false;
265
-                }
266
-            }
267
-            $this->is_running = false;
268
-            $this->save();
269
-            Log::addDebugLog('Execution completed for Admin task: '.$this->getTitle().' - '.($this->last_result ? 'Success' : 'Failure'));
270
-        }
271
-    }
258
+			Log::addDebugLog('Start execution of Admin task: '.$this->getTitle());
259
+			$this->last_result = $this->executeSteps();
260
+			if($this->last_result){
261
+				$this->last_updated = new \DateTime();
262
+				if($this->nb_occurrences > 0){
263
+					$this->nb_occurrences--;
264
+					if($this->nb_occurrences == 0) $this->is_enabled = false;
265
+				}
266
+			}
267
+			$this->is_running = false;
268
+			$this->save();
269
+			Log::addDebugLog('Execution completed for Admin task: '.$this->getTitle().' - '.($this->last_result ? 'Success' : 'Failure'));
270
+		}
271
+	}
272 272
     
273 273
     
274 274
 }
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 	 * @param string $file Filename containing the task object
82 82
 	 * @param TaskProviderInterface $provider Provider for tasks
83 83
      */
84
-    public function __construct($file, TaskProviderInterface $provider = null){
84
+    public function __construct($file, TaskProviderInterface $provider = null) {
85 85
         $this->name = trim(basename($file, '.php'));
86 86
 		$this->provider = $provider;
87 87
     }
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
      *
92 92
      * @return TaskProviderInterface 
93 93
      */
94
-    public function getProvider(){
94
+    public function getProvider() {
95 95
         return $this->provider;
96 96
     }
97 97
     
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
      * @param TaskProviderInterface $provider
102 102
      * @return self Enable method-chaining
103 103
      */
104
-    public function setProvider(TaskProviderInterface $provider){
104
+    public function setProvider(TaskProviderInterface $provider) {
105 105
         $this->provider = $provider;
106 106
         return $this;
107 107
     }
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
      * @param int $nb_occur Number of remaining occurrences, 0 for tasks not limited
117 117
      * @param bool $is_running Indicates if the task is currently running
118 118
      */
119
-    public function setParameters($is_enabled, \DateTime $last_updated, $last_result, $frequency, $nb_occur, $is_running){
119
+    public function setParameters($is_enabled, \DateTime $last_updated, $last_result, $frequency, $nb_occur, $is_running) {
120 120
         $this->is_enabled = $is_enabled;
121 121
         $this->last_updated = $last_updated;
122 122
         $this->last_result = $last_result;
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
      *
131 131
      * @return string
132 132
      */
133
-    public function getName(){
133
+    public function getName() {
134 134
         return $this->name;
135 135
     }
136 136
     
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
      *
141 141
      * @return boolean True if enabled
142 142
      */
143
-    public function isEnabled(){
143
+    public function isEnabled() {
144 144
         return $this->is_enabled;
145 145
     }
146 146
     
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
      *
150 150
      * @return \DateTime
151 151
      */
152
-    public function getLastUpdated(){
152
+    public function getLastUpdated() {
153 153
         return $this->last_updated;
154 154
     }
155 155
     
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
      *
159 159
      * @return bool
160 160
      */
161
-    public function isLastRunSuccess(){
161
+    public function isLastRunSuccess() {
162 162
         return $this->last_result;
163 163
     }
164 164
     
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
      *
168 168
      * @return int
169 169
      */
170
-    public function getFrequency(){
170
+    public function getFrequency() {
171 171
         return $this->frequency;
172 172
     }
173 173
 	
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 	 * @param int $frequency
178 178
      * @return self Enable method-chaining
179 179
      */
180
-    public function setFrequency($frequency){
180
+    public function setFrequency($frequency) {
181 181
         $this->frequency = $frequency;
182 182
 		return $this;
183 183
     }
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
      *
188 188
      * @return int
189 189
      */
190
-    public function getRemainingOccurrences(){
190
+    public function getRemainingOccurrences() {
191 191
         return $this->nb_occurrences;
192 192
     }
193 193
 	
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 	 * @param int $nb_occur
198 198
      * @return self Enable method-chaining
199 199
      */
200
-    public function setRemainingOccurrences($nb_occur){
200
+    public function setRemainingOccurrences($nb_occur) {
201 201
         $this->nb_occurrences = $nb_occur;
202 202
 		return $this;
203 203
     }
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
      *
208 208
      * @return bool
209 209
      */
210
-    public function isRunning(){
210
+    public function isRunning() {
211 211
         return $this->is_running;
212 212
     }
213 213
     
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 	 * @return bool
237 237
 	 */
238 238
 	public function save() {
239
-	    if(!$this->provider) throw new \Exception('The task has not been initialised with a provider.');
239
+	    if (!$this->provider) throw new \Exception('The task has not been initialised with a provider.');
240 240
 		return $this->provider->updateTask($this);
241 241
 	}
242 242
 	
@@ -244,12 +244,12 @@  discard block
 block discarded – undo
244 244
      * Execute the task, default skeleton
245 245
      *
246 246
      */
247
-    public function execute(){
247
+    public function execute() {
248 248
     
249
-        if($this->last_updated->add(new \DateInterval('PT'.self::TASK_TIME_OUT.'S')) < new \DateTime())
249
+        if ($this->last_updated->add(new \DateInterval('PT'.self::TASK_TIME_OUT.'S')) < new \DateTime())
250 250
             $this->is_running = false;
251 251
     
252
-        if(!$this->is_running){  //TODO put in place a time_out for running...
252
+        if (!$this->is_running) {  //TODO put in place a time_out for running...
253 253
             //TODO Log the executions in the logs
254 254
             $this->last_result = false;
255 255
             $this->is_running = true;
@@ -257,11 +257,11 @@  discard block
 block discarded – undo
257 257
     
258 258
             Log::addDebugLog('Start execution of Admin task: '.$this->getTitle());
259 259
             $this->last_result = $this->executeSteps();
260
-            if($this->last_result){
260
+            if ($this->last_result) {
261 261
                 $this->last_updated = new \DateTime();
262
-                if($this->nb_occurrences > 0){
262
+                if ($this->nb_occurrences > 0) {
263 263
                     $this->nb_occurrences--;
264
-                    if($this->nb_occurrences == 0) $this->is_enabled = false;
264
+                    if ($this->nb_occurrences == 0) $this->is_enabled = false;
265 265
                 }
266 266
             }
267 267
             $this->is_running = false;
Please login to merge, or discard this patch.
src/Webtrees/Module/AdminTasks/Model/ConfigurableTaskInterface.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -15,11 +15,11 @@
 block discarded – undo
15 15
  */
16 16
 interface ConfigurableTaskInterface {
17 17
     
18
-    /**
19
-     * Returns the HTML code to display the specific task configuration.
20
-     * 
21
-     * @return string HTML code
22
-     */
18
+	/**
19
+	 * Returns the HTML code to display the specific task configuration.
20
+	 * 
21
+	 * @return string HTML code
22
+	 */
23 23
 	function htmlConfigForm();
24 24
 	
25 25
 	/**
Please login to merge, or discard this patch.