Skip to content

Instantly share code, notes, and snippets.

@AdamEsterle
Forked from Geczy/gist:67a4251ee76baf41f4ef
Last active November 18, 2015 18:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AdamEsterle/5d86ca169bfa42c07fef to your computer and use it in GitHub Desktop.
Save AdamEsterle/5d86ca169bfa42c07fef to your computer and use it in GitHub Desktop.
<?php
$urls = Repo::all();
$correctKeys = \DB::connection()->getSchemaBuilder()->getColumnListing("packages");
unset($correctKeys[0], $correctKeys[1]);
foreach ($urls as $repo) {
$text_filename = $repo->id . '.txt';
if (!Storage::exists($text_filename)) {
continue;
}
$fullPath = storage_path() . '/app/' . $text_filename;
start_measure('fopen', 'Package via fgets');
$fp = fopen($fullPath, "r");
$package = [];
while (FALSE !== ($line = fgets($fp))) {
if ($line == "\n") {
// no more foreach
// foreach ($package as $key => $pack) {
// }
$all[$repo->id][] = $package;
$package = [];
continue;
}
if (0 === strpos($line, " ") || 0 === strpos($line, "\t") || strpos($line, ':') < 0) {
end($package);
$last = key($package);
$package[$last] = $package[$last] . "\n" . trim($line);
continue;
}
// build the $package array as you go
$vals = explode(':', rtrim($line), 2);
if (in_array(strtolower($vals[0]), $correctKeys)) {
$package[$vals[0]] = trim($vals[1]);
}
}
var_dump($all);
exit;
Package: abgrouper
Version: 0.3
Section: Utilities
Maintainer: Spektro <support@iblacklist.com.br>
Architecture: iphoneos-arm
Filename: debs2.0/abgrouper_0.3.deb
Size: 315648
MD5sum: 7616d2567e1c0fa642f4da4529d4ad60
Name: ABGrouper
Description: Create, Manage and Delete GROUPS of contacts in your AddressBook. Additionally, it ables you to export Groups of contacts as lists for iBlacklist software and backup/restore iBlacklist database. A new section will appear if you have iBlacklist installed on your device.
Author: Spektro <support@iblacklist.com.br>
Depiction: http://moreinfo.thebigboss.org/moreinfo/abgrouperDp.php
dev: alexandre
homepage: http://moreinfo.thebigboss.org/moreinfo/abgrouper.php
Package: actionmenu
Version: 1.3.0
Priority: optional
Section: System
Depends: mobilesubstrate (>= 0.9.5000), firmware (>= 3), preferenceloader (>= 2.2.2), cydia (>= 1.1.1)
Conflicts: actionmenu-pluspack (<< 1.2)
Architecture: iphoneos-arm
Filename: debs2.0/actionmenu_1.3.0_iphoneos-arm.deb
Size: 313522
Installed-Size: 1404
MD5sum: 2105e8c6bde2126413860628bbb9931a
Name: Action Menu
Website: http://rpetri.ch/cydia/actionmenu/
Description: Adds actions to the action menu
Author: Ryan Petrich <rpetrich@gmail.com>
Depiction: http://rpetri.ch/cydia/actionmenu/
array (size=1)
1 =>
array (size=15266)
0 =>
array (size=14)
'Package' => string 'abgrouper' (length=9)
'Version' => string '0.3' (length=3)
'Section' => string 'Utilities' (length=9)
'Maintainer' => string 'Spektro <support@iblacklist.com.br>' (length=35)
'Architecture' => string 'iphoneos-arm' (length=12)
'Filename' => string 'debs2.0/abgrouper_0.3.deb' (length=25)
'Size' => string '315648' (length=6)
'MD5sum' => string '7616d2567e1c0fa642f4da4529d4ad60' (length=32)
'Name' => string 'ABGrouper' (length=9)
'Description' => string 'Create, Manage and Delete GROUPS of contacts in your AddressBook. Additionally, it ables you to export Groups of contacts as lists for iBlacklist software and backup/restore iBlacklist database. A new section will appear if you have iBlacklist installed on your device.' (length=269)
'Author' => string 'Spektro <support@iblacklist.com.br>' (length=35)
'Depiction' => string 'http://moreinfo.thebigboss.org/moreinfo/abgrouperDp.php' (length=55)
'dev' => string 'alexandre' (length=9)
'homepage' => string 'http://moreinfo.thebigboss.org/moreinfo/abgrouper.php' (length=53)
1 =>
array (size=16)
'Package' => string 'actionmenu' (length=10)
'Version' => string '1.3.0' (length=5)
'Priority' => string 'optional' (length=8)
'Section' => string 'System' (length=6)
'Depends' => string 'mobilesubstrate (>= 0.9.5000), firmware (>= 3), preferenceloader (>= 2.2.2), cydia (>= 1.1.1)' (length=93)
'Conflicts' => string 'actionmenu-pluspack (<< 1.2)' (length=28)
'Architecture' => string 'iphoneos-arm' (length=12)
'Filename' => string 'debs2.0/actionmenu_1.3.0_iphoneos-arm.deb' (length=41)
'Size' => string '313522' (length=6)
'Installed-Size' => string '1404' (length=4)
'MD5sum' => string '2105e8c6bde2126413860628bbb9931a' (length=32)
'Name' => string 'Action Menu' (length=11)
'Website' => string 'http://rpetri.ch/cydia/actionmenu/' (length=34)
'Description' => string 'Adds actions to the action menu' (length=31)
'Author' => string 'Ryan Petrich <rpetrich@gmail.com>' (length=33)
'Depiction' => string 'http://rpetri.ch/cydia/actionmenu/' (length=34)
2 =>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment