PHP Classes

File: tools/uniqueid.php

Recommend this page to a friend!
  Classes of Scott Arciszewski   CMS Airship   tools/uniqueid.php   Download  
File: tools/uniqueid.php
Role: Example script
Content type: text/plain
Description: Example script
Class: CMS Airship
Content management system with security features
Author: By
Last change: Boyscouting the tools directory.
Date: 7 years ago
Size: 586 bytes
 

Contents

Class file image Download
<?php
declare(strict_types=1);

require_once \
dirname(__DIR__).'/src/bootstrap.php';

/**
 * This gives each user a uniqueid if they do not already have one.
 *
 * It *should* be safe to remove, but we're holding off on doing that
 * until version 2.0.0.
 */

$db = \Airship\get_database();

foreach (
$db->run('SELECT * FROM airship_users WHERE uniqueid IS NULL OR LENGTH(uniqueid) < 24') as $r) {
   
$db->update(
       
'airship_users', [
           
'uniqueid' => \Airship\uniqueId()
        ], [
           
'userid' => $r['userid']
        ]
    );
    echo
"{$r['userid']}\n";
}