88 */
99namespace Burzum \HtmlPurifier \Shell ;
1010
11+ use Cake \Console \ConsoleOptionParser ;
1112use Cake \Console \Shell ;
1213use Cake \ORM \Locator \TableLocator ;
1314use Cake \ORM \Table ;
15+ use Cake \Datasource \EntityInterface ;
1416
1517/**
1618 * PurifierShell
@@ -31,7 +33,7 @@ public function main()
3133 /**
3234 * Gets the table from the shell args.
3335 *
34- * @return \Cake\ORM\Table;
36+ * @return \Cake\ORM\Table
3537 */
3638 protected function _getTable ()
3739 {
@@ -67,7 +69,7 @@ protected function _getFields(Table $table)
6769 /**
6870 * Loads the purifier behavior for the given table if not already attached.
6971 *
70- * @param \Cake\ORM\Table $table Table object.
72+ * @param \Cake\ORM\Table $table Table object.
7173 * @param array Set of fields to sanitize
7274 * @return void
7375 */
@@ -100,7 +102,7 @@ public function purify()
100102 }
101103 $ total = $ query ->all ()->count ();
102104
103- $ this ->info (__d ('Burzum/HtmlPurifier ' , 'Sanitizing fields `{0}` in table `{1}` ' , implode (', ' , $ fields ), $ table ->table ()));
105+ $ this ->info (__d ('Burzum/HtmlPurifier ' , 'Sanitizing fields `{0}` in table `{1}` ' , implode (', ' , $ fields ), $ table ->getTable ()));
104106
105107 $ this ->helper ('progress ' )->output (
106108 [
@@ -142,7 +144,7 @@ protected function _process(Table $table, $chunkCount, $chunkSize, $fields)
142144 ->select ($ fields )
143145 ->offset ($ chunkCount )
144146 ->limit ($ chunkSize )
145- ->orderDesc ($ table ->aliasField ($ table ->primarygetPrimaryKey ()))
147+ ->orderDesc ($ table ->aliasField ($ table ->getPrimaryKey ()))
146148 ->all ();
147149
148150 if (empty ($ results )) {
@@ -151,6 +153,7 @@ protected function _process(Table $table, $chunkCount, $chunkSize, $fields)
151153
152154 foreach ($ results as $ result ) {
153155 try {
156+ $ table ->patchEntity ($ result , $ result ->toArray ());
154157 $ table ->save ($ result );
155158 $ chunkCount ++;
156159 } catch (\Exception $ e ) {
@@ -162,7 +165,7 @@ protected function _process(Table $table, $chunkCount, $chunkSize, $fields)
162165 /**
163166 * {@inheritDoc}
164167 */
165- public function getOptionParser ()
168+ public function getOptionParser (): ConsoleOptionParser
166169 {
167170 $ parser = parent ::getOptionParser ();
168171
0 commit comments