Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php echo pht('Populating files with mail keys...')."\n"; $table = new PhabricatorFile(..

Decoded Output download

<?php

echo pht('Populating files with mail keys...')."
";

$table = new PhabricatorFile();
$table_name = $table->getTableName();

$conn_w = $table->establishConnection('w');
$conn_w->openTransaction();

$sql = array();
foreach (new LiskRawMigrationIterator($conn_w, 'file') as $row) {
  // NOTE: MySQL requires that the INSERT specify all columns which don't
  // have default values when configured in strict mode. This query will
  // never actually insert rows, but we need to hand it values anyway.

  $sql[] = qsprintf(
    $conn_w,
    '(%d, %s, 0, 0, 0, 0, 0, 0, 0, 0)',
    $row['id'],
    Filesystem::readRandomCharacters(20));
}

if ($sql) {
  foreach (PhabricatorLiskDAO::chunkSQL($sql) as $chunk) {
    queryfx(
      $conn_w,
      'INSERT INTO %T
        (id, mailKey, phid, byteSize, storageEngine, storageFormat,
          storageHandle, dateCreated, dateModified, metadata) VALUES %LQ '.
      'ON DUPLICATE KEY UPDATE mailKey = VALUES(mailKey)',
      $table_name,
      $chunk);
  }
}

$table->saveTransaction();
echo pht('Done.')."
";
 ?>

Did this file decode correctly?

Original Code

<?php

echo pht('Populating files with mail keys...')."\n";

$table = new PhabricatorFile();
$table_name = $table->getTableName();

$conn_w = $table->establishConnection('w');
$conn_w->openTransaction();

$sql = array();
foreach (new LiskRawMigrationIterator($conn_w, 'file') as $row) {
  // NOTE: MySQL requires that the INSERT specify all columns which don't
  // have default values when configured in strict mode. This query will
  // never actually insert rows, but we need to hand it values anyway.

  $sql[] = qsprintf(
    $conn_w,
    '(%d, %s, 0, 0, 0, 0, 0, 0, 0, 0)',
    $row['id'],
    Filesystem::readRandomCharacters(20));
}

if ($sql) {
  foreach (PhabricatorLiskDAO::chunkSQL($sql) as $chunk) {
    queryfx(
      $conn_w,
      'INSERT INTO %T
        (id, mailKey, phid, byteSize, storageEngine, storageFormat,
          storageHandle, dateCreated, dateModified, metadata) VALUES %LQ '.
      'ON DUPLICATE KEY UPDATE mailKey = VALUES(mailKey)',
      $table_name,
      $chunk);
  }
}

$table->saveTransaction();
echo pht('Done.')."\n";

Function Calls

pht 1

Variables

None

Stats

MD5 de70c63cfd2626abdebd5eb942ab829d
Eval Count 0
Decode Time 88 ms