You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I finally found some time and have started attempting to install the latest v0.8 on my laptop. Mostly, things are going well:
I have solr up and running. No brainer. A caveat here is that I am running two webservers: tomcat 7.40 for solr and apache for statedecoded. tomcat is on 8080 and apache in on 80. I can connection to localhost:8080/solr and select the statedecoded core and browse the schema and query against the server. It returns nothing because I haven't tried to load any data yet.
I can run phpinfo(); on the website. It looks good. php 5.4, MySQL is connected, PDO is connected, it shows that I can zlib and zip and tidy and xmllib.
I get to the admin statedecoded home page and admin page.
The 'test environment' says that I need to have xmllint installed. I can run the executable in the php directory. The test environment also says that I need to have zip available, but like I said, phpinfo(); says that I do.
So, should I be trying this with the Virginia.xml files. Have they been updated? Should I be trying to debug the test environment button? I am not trying to run this in a dev environment yet. I'm not a PHP programmer, though I may have a basic dev environment when I get things sorted better.
The 'test environment' says that I need to have xmllint installed. I can run the executable in the php directory.
Ah, yes. The problem here is that the environment test is Linux-specific, for xmllint and zip. The command which xmllint is run which, in Linux, returns the location of xmllint (e.g., /usr/local/bin/xmllint). I think we'll need to figure out a Windows equivalent command to find out if a command is valid. Do you have any idea of what that might be? I don't have access to a Windows machine, and I wouldn't know what I was doing anyway. :) If you don't know, of course, I'l research it.
The test environment also says that I need to have zip available, but like I said, phpinfo(); says that I do.
phpinfo() is probably reporting that PHP has an internal zip function. That's different than whether zip is installed and accessible at the command line. We use the latter because it's much, much faster than PHP's zip.
Ok, cool. But, I'll look into figuring out a windows version for a test for xmllint and zip. It'll be a useful intro to php.
Do you need these things working for a load? I don't have time tonight to try, and tomorrow is Monday (which means the school week starts.) So, this will probably be slow going for me 'cause of priorities. So, more as I get it sorted.
It seems that your configuration is to run Jetty for solr and apache for the statedecoded server. Is that correct?
But, I'll look into figuring out a windows version for a test for xmllint and zip.
It's really about finding a command that you can run at the command line to verify that they exist, that will either succeed or fail. PHP just runs that command, as if it were you typing it into the command line, and evaluates whether the program produced an error or succeeded.
Do you need these things working for a load?
You can always delete those environment tests from your local copy, and then run the importer. includes/class.ParserController.inc.php, specifically lines 1811–1829. You could just delete all 18 of those lines, and then the environment test wouldn't fail. As long as the commands zip and xmllint actually work at the command line, then everything ought to work just fine.
What I did was deleted all the XML files except those that started with "1-". That seemed an easy way to get going. I deleted the environment test lines and attempted a load. It said environment checked out. I can see that tables got created in MySQL but nothing has been loaded in MySQL or Solr, so I'm looking a little closer. Right now I'm working on getting the development env. in a little better shape so that maybe I can step through the code. I assume I don't need zip or xmllint for loading? I can run xmllint, but there is no command line zip at the moment.
It said environment checked out. I can see that tables got created in MySQL but nothing has been loaded in MySQL or Solr, so I'm looking a little closer.
Huh, then it didn't make it far. :-/ You might post here the output that was displayed when you ran the import. It should have displayed a series of status messages to the screen about what it was doing—that's liable to help figure out what's falling down.
Well, I have to go to class now. I figured out that the "new edition placeholder name" wasn't going to work, so I put in "first" as a place holder, and got back a huge (1MB error dump). I will have to look at this later, I have to go read some Chomsky for Human Rights class. Here are the first few errors if you see anything obvious.
Query failed: SELECT label FROM structure GROUP BY label ORDER BY depth ASC
( ! ) Notice: Undefined variable: sql_args in C:\Users\karl\www\includes\class.virginia.inc.php on line 2213
Failure: INSERT INTO laws SET date_created=now(), structure_id = :structure_id, catch_line = :catch_line, section = :section, text = :text, order_by = :order_by, history = :history, edition_id = :edition_id
array (size=7) ':structure_id' => boolean false ':catch_line' => string 'Contents and designation of Code.' (length=33) ':section' => string '1-1' (length=3) ':text' => string 'The laws embraced in this and the following titles, chapters, articles and sections of this act shall constitute, and be designated and cited as the "Code of Virginia," hereinafter referred to as "the Code" or "this Code."' (length=222) ':order_by' => string '0000000000100011' (length=16) ':history' => string 'Code 1919, § 1; R. P. 1948, § 1-1.' (length=36) ':edition_id' => string '1' (length=1)
Query failed: SELECT label FROM structure GROUP BY label ORDER BY depth ASC
( ! ) Notice: Undefined variable: sql_args in C:\Users\karl\www\includes\class.virginia.inc.php on line 2213
It can't insert records into the structure table. Although why, it's not saying—just "failure." Looking at the debug message, though, everything looks fine. Perhaps the database tables aren't being created? Are you able to peer into MySQL and see if the structure table exists in your database?
basically over and over again. I had to rename class.State.inc.php to class.Virginia.inc.php. Has the class.State.inc.php file been kept up to date with your Virginia?
Also, in regards to the structure issue. I notice that there is a structure.php in the htdocs directory. Is there maybe something that's keeping it from being referenced when running an Admin script? I the reference ./structure.php correct when running from htdocs/admin?
I haven't looked very close yet, I just wanted to get back to you on your question.
The tables get created if I run the script manually. So, there is obviously something wrong with the MySQL connection that is preventing the SQL commands from being execute properly.
So, there is obviously something wrong with the MySQL connection that is preventing the SQL commands from being execute properly.
Alright, it looks like @krues8dr has duplicated this! In #520, he points out a problem that is preventing such errors from being detected. There's a clear path to getting that fixed. I'm glad you pointed out this problem!
Separately, I'm going to spin up some Windows-based EC2 instances, since I see that's a thing. That'll make it easy for me to improve how this works under Windows.
There's a lot of stuff now that makes this a no-go. I've been trying to remove a lot of the shell exec commands and path-magic, but we're doing symlinking and other stuff that's just going to break this. I strongly recommend punting on this for 1.0.
This issue made sense when this was just a matter of some small tweaks. I figured somebody with experience with PHP for Windows could knock it out in a few hours. But if it's more complicated than that, let's punt.
Activity
waldoj commentedon Nov 18, 2013
Ah, yes. The problem here is that the environment test is Linux-specific, for xmllint and zip. The command
which xmllintis run which, in Linux, returns the location ofxmllint(e.g.,/usr/local/bin/xmllint). I think we'll need to figure out a Windows equivalent command to find out if a command is valid. Do you have any idea of what that might be? I don't have access to a Windows machine, and I wouldn't know what I was doing anyway. :) If you don't know, of course, I'l research it.phpinfo()is probably reporting that PHP has an internal zip function. That's different than whether zip is installed and accessible at the command line. We use the latter because it's much, much faster than PHP's zip.Don't worry—you can always run the "empty database" option, and undo anything that you've done by pressing the button. :)
For all of my development work, those are the files that I've been using, so they certainly ought to work just fine for you.
karlnicholas commentedon Nov 18, 2013
Ok, cool. But, I'll look into figuring out a windows version for a test for xmllint and zip. It'll be a useful intro to php.
Do you need these things working for a load? I don't have time tonight to try, and tomorrow is Monday (which means the school week starts.) So, this will probably be slow going for me 'cause of priorities. So, more as I get it sorted.
It seems that your configuration is to run Jetty for solr and apache for the statedecoded server. Is that correct?
waldoj commentedon Nov 18, 2013
It's really about finding a command that you can run at the command line to verify that they exist, that will either succeed or fail. PHP just runs that command, as if it were you typing it into the command line, and evaluates whether the program produced an error or succeeded.
You can always delete those environment tests from your local copy, and then run the importer.
includes/class.ParserController.inc.php, specifically lines 1811–1829. You could just delete all 18 of those lines, and then the environment test wouldn't fail. As long as the commandszipandxmllintactually work at the command line, then everything ought to work just fine.karlnicholas commentedon Nov 18, 2013
What I did was deleted all the XML files except those that started with "1-". That seemed an easy way to get going. I deleted the environment test lines and attempted a load. It said environment checked out. I can see that tables got created in MySQL but nothing has been loaded in MySQL or Solr, so I'm looking a little closer. Right now I'm working on getting the development env. in a little better shape so that maybe I can step through the code. I assume I don't need zip or xmllint for loading? I can run xmllint, but there is no command line zip at the moment.
waldoj commentedon Nov 18, 2013
Huh, then it didn't make it far. :-/ You might post here the output that was displayed when you ran the import. It should have displayed a series of status messages to the screen about what it was doing—that's liable to help figure out what's falling down.
karlnicholas commentedon Nov 18, 2013
Well, I have to go to class now. I figured out that the "new edition placeholder name" wasn't going to work, so I put in "first" as a place holder, and got back a huge (1MB error dump). I will have to look at this later, I have to go read some Chomsky for Human Rights class. Here are the first few errors if you see anything obvious.
Query failed: SELECT label FROM structure GROUP BY label ORDER BY depth ASC
( ! ) Notice: Undefined variable: sql_args in C:\Users\karl\www\includes\class.virginia.inc.php on line 2213
Call Stack
Time
Memory
Function
Location
1 0.0013 147984 {main}( ) ..\index.php:0
2 0.0111 348424 MasterController->execute( ) ..\index.php:288
3 0.0119 373384 require( 'C:\Users\karl\www\htdocs\admin\index.php' ) ..\class.MasterController.inc.php:46
4 1.1614 790264 ParserController->parse( ) ..\index.php:125
5 1.1615 791192 Parser->__construct( ) ..\class.ParserController.inc.php:527
6 1.2052 808312 Parser->get_structure_labels( ) ..\class.virginia.inc.php:318
null
Parsing data files
( ! ) Warning: Creating default object from empty value in C:\Users\karl\www\includes\class.virginia.inc.php on line 494
Call Stack
Time
Memory
Function
Location
1 0.0013 147984 {main}( ) ..\index.php:0
2 0.0111 348424 MasterController->execute( ) ..\index.php:288
3 0.0119 373384 require( 'C:\Users\karl\www\htdocs\admin\index.php' ) ..\class.MasterController.inc.php:46
4 1.1614 790264 ParserController->parse( ) ..\index.php:125
5 1.3594 808496 Parser->parse( ) ..\class.ParserController.inc.php:542
( ! ) Warning: Creating default object from empty value in C:\Users\karl\www\includes\class.virginia.inc.php on line 494
Call Stack
Time
Memory
Function
Location
1 0.0013 147984 {main}( ) ..\index.php:0
2 0.0111 348424 MasterController->execute( ) ..\index.php:288
3 0.0119 373384 require( 'C:\Users\karl\www\htdocs\admin\index.php' ) ..\class.MasterController.inc.php:46
4 1.1614 790264 ParserController->parse( ) ..\index.php:125
5 1.3594 808496 Parser->parse( ) ..\class.ParserController.inc.php:542
( ! ) Warning: Creating default object from empty value in C:\Users\karl\www\includes\class.virginia.inc.php on line 515
Call Stack
karlnicholas commentedon Nov 18, 2013
1 0.0013 147984 {main}( ) ..\index.php:0
2 0.0111 348424 MasterController->execute( ) ..\index.php:288
3 0.0119 373384 require( 'C:\Users\karl\www\htdocs\admin\index.php' ) ..\class.MasterController.inc.php:46
4 1.1614 790264 ParserController->parse( ) ..\index.php:125
5 1.5025 812424 Parser->store( ) ..\class.ParserController.inc.php:543
6 1.5025 813864 Parser->__construct( ) ..\class.virginia.inc.php:925
7 1.5025 813928 Parser->get_structure_labels( ) ..\class.virginia.inc.php:318
null
Failure: INSERT INTO structure SET identifier = :identifier, name = :name, label = :label, edition_id = :edition_id, depth = :depth, date_created=now()
array (size=5) ':identifier' => string '1' (length=1) ':name' => string 'General Provisions' (length=18) ':label' => string 'title' (length=5) ':edition_id' => string '1' (length=1) ':depth' => string '1' (length=1)
Failure: INSERT INTO structure SET identifier = :identifier, name = :name, label = :label, edition_id = :edition_id, depth = :depth, date_created=now(), parent_id = :parent_id
array (size=6) ':identifier' => string '1' (length=1) ':name' => string 'Code of Virginia' (length=16) ':label' => string 'chapter' (length=7) ':edition_id' => string '1' (length=1) ':depth' => string '2' (length=1) ':parent_id' => boolean false
Failure: INSERT INTO laws SET date_created=now(), structure_id = :structure_id, catch_line = :catch_line, section = :section, text = :text, order_by = :order_by, history = :history, edition_id = :edition_id
array (size=7) ':structure_id' => boolean false ':catch_line' => string 'Contents and designation of Code.' (length=33) ':section' => string '1-1' (length=3) ':text' => string 'The laws embraced in this and the following titles, chapters, articles and sections of this act shall constitute, and be designated and cited as the "Code of Virginia," hereinafter referred to as "the Code" or "this Code."' (length=222) ':order_by' => string '0000000000100011' (length=16) ':history' => string 'Code 1919, § 1; R. P. 1948, § 1-1.' (length=36) ':edition_id' => string '1' (length=1)
Query failed: SELECT label FROM structure GROUP BY label ORDER BY depth ASC
( ! ) Notice: Undefined variable: sql_args in C:\Users\karl\www\includes\class.virginia.inc.php on line 2213
waldoj commentedon Nov 19, 2013
This appears to be the root of the problem:
It can't insert records into the
structuretable. Although why, it's not saying—just "failure." Looking at the debug message, though, everything looks fine. Perhaps the database tables aren't being created? Are you able to peer into MySQL and see if thestructuretable exists in your database?karlnicholas commentedon Nov 19, 2013
Well, I tried again, pretty much with the same results. Structure is not being created. Other tables are:
The first error is:
[Tue Nov 19 13:35:45 2013] [warn] [client 127.0.0.1] mod_fcgid: stderr: PHP Notice: Constant EDITION_ID already defined in C:\Users\karl\www\includes\class.ParserController.inc.php on line 403, referer: http://localhost:8080/admin/?page=parse&noframe=1
Then:
[Tue Nov 19 13:35:45 2013] [warn] [client 127.0.0.1] mod_fcgid: stderr: PHP Notice: Undefined variable: sql_args in C:\Users\karl\www\includes\class.virginia.inc.php on line 2213, referer: http://localhost:8080/admin/?page=parse&noframe=1
basically over and over again. I had to rename class.State.inc.php to class.Virginia.inc.php. Has the class.State.inc.php file been kept up to date with your Virginia?
Also, in regards to the structure issue. I notice that there is a structure.php in the htdocs directory. Is there maybe something that's keeping it from being referenced when running an Admin script? I the reference ./structure.php correct when running from htdocs/admin?
I haven't looked very close yet, I just wanted to get back to you on your question.
| api_keys |
| dictionary |
| dictionary_general |
| editions |
| laws |
| laws_meta |
| laws_references |
| laws_views |
karlnicholas commentedon Nov 19, 2013
PS> admin/index.php won't run again: giving me this error: I will attempt to discern.
[Tue Nov 19 14:05:48 2013] [warn] [client 127.0.0.1] mod_fcgid: stderr: PHP Notice: Undefined index: edition_option in C:\Users\karl\www\htdocs\admin\index.php on line 344, referer: http://localhost:8080/admin/
========= UPDATE ========
Okay, I fixed this by deleting the row that got inserted into editions;
karlnicholas commentedon Nov 19, 2013
The tables get created if I run the script manually. So, there is obviously something wrong with the MySQL connection that is preventing the SQL commands from being execute properly.
mysql> source c:/users/karl/www/htdocs/admin/statedecoded.sql;
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected (1.02 sec)
Query OK, 0 rows affected (1.20 sec)
Query OK, 0 rows affected (0.56 sec)
Query OK, 0 rows affected (0.89 sec)
Query OK, 0 rows affected (1.03 sec)
Query OK, 0 rows affected (0.84 sec)
Query OK, 0 rows affected (0.84 sec)
Query OK, 0 rows affected, 1 warning (0.05 sec)
ERROR 1071 (42000): Specified key was too long; max key length is 767 bytes
Query OK, 0 rows affected (1.38 sec)
Query OK, 0 rows affected (1.27 sec)
Query OK, 0 rows affected (0.75 sec)
Query OK, 0 rows affected (0.69 sec)
Query OK, 116 rows affected (0.14 sec)
Records: 116 Duplicates: 0 Warnings: 0
Query OK, 111 rows affected (0.17 sec)
Records: 111 Duplicates: 0 Warnings: 0
Query OK, 101 rows affected (0.14 sec)
[....]
mysql> show tables;
+------------------------+
| Tables_in_statedecoded |
+------------------------+
| api_keys |
| dictionary |
| dictionary_general |
| editions |
| laws |
| laws_meta |
| laws_references |
| laws_views |
| structure |
| tags |
| text |
| text_sections |
+------------------------+
12 rows in set (0.00 sec)
karlnicholas commentedon Nov 19, 2013
Emptying the database
Clearing out the database
Deleted dictionary
Deleted laws
Deleted laws_references
Deleted text
Deleted laws_views
Deleted tags
Deleted text_sections
Deleted structure
Error in SQL: TRUNCATE permalinks
waldoj commentedon Dec 8, 2013
Alright, it looks like @krues8dr has duplicated this! In #520, he points out a problem that is preventing such errors from being detected. There's a clear path to getting that fixed. I'm glad you pointed out this problem!
Separately, I'm going to spin up some Windows-based EC2 instances, since I see that's a thing. That'll make it easy for me to improve how this works under Windows.
karlnicholas commentedon Dec 10, 2013
Really it's a design issue isn't it?
krusynth commentedon Nov 5, 2014
If anyone has any time to re-check this, that would be fantastic. Otherwise, I recommend closing as I think this has been resolved from #520.
waldoj commentedon Nov 5, 2014
It's just a matter of firing up a Windows EC2 instance. I just need to find 45 minutes to try this out.
[-]Test installing The State Decoded on Windows[/-][+]Test installing on Windows[/+]krusynth commentedon Mar 6, 2017
There's a lot of stuff now that makes this a no-go. I've been trying to remove a lot of the shell exec commands and path-magic, but we're doing symlinking and other stuff that's just going to break this. I strongly recommend punting on this for 1.0.
waldoj commentedon Mar 7, 2017
This issue made sense when this was just a matter of some small tweaks. I figured somebody with experience with PHP for Windows could knock it out in a few hours. But if it's more complicated than that, let's punt.