Fix Double-Escaped Text
In some circumstances, older data may have been escaped on the way into the Snipe-IT database, which means instead of seeing an apostrophe, you might see Snipe's Laptop
, or 13-" MacBook Pro
, etc. That shouldn't be happening with any newer data, but if you had older data that was affected, you can run:
php artisan snipeit:unescape
All this command line tool does is search for any name
entity with an ampersand in it, then walks through the results and tries to decode them and save them, which can save a lot of time with larger datasets.
foreach($classname::where("$field",'LIKE','%&%')->get() as $row) {
$this->info('Updating '.$field.' for '.$classname);
$row->{$field} = html_entity_decode($row->{$field},ENT_QUOTES);
$row->save();
$count[$classname][$field]++;
}
Updated over 3 years ago